Travis
June 22, 2026, 11:44pm
1
Any ideas what might be happening in this issue? I would like to include some c files to fuzz against with AFL but end up with undefined symbols when I tried.
I’m hoping to understand whats wrong and maybe how to fix it if you have any insight.
opened 08:37AM - 15 Jun 26 UTC
Apologies if I've missed something. But with zig nightly and zig-afk-kit latest… commit, it seems we can't `addCSourceFiles` to an afl obj as shown [here](https://github.com/kristoff-it/zig-afl-kit/#im-a-c-or-c-programmer-can-i-use-this).
I've created a [repo-duction](https://github.com/archaistvolts/afl-kit-repro) with a shell.nix. I know flakes are recommended but hopefully this makes it easy enough to reproduce. The error is `undefined reference to 'foo'`. Its similar to what I've seen trying the same in my zroaring project. This prevents me from fuzzing against CRoaring with AFL. I've 'worked around' this issue by fuzzing against a std.HashMap(u32). But that is error prone and slow and I'd love to delete it.
I'd be glad to PR a fix for this if I could get some direction.
```console
[/tmp] $ git clone https://github.com/archaistvolts/afl-kit-repro
Cloning into 'afl-kit-repro'...
remote: Enumerating objects: 8, done.
remote: Counting objects: 100% (8/8), done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 8 (delta 0), reused 8 (delta 0), pack-reused 0 (from 0)
Receiving objects: 100% (8/8), done.
[/tmp] $ cd afl-kit-repro/
[/tmp/afl-kit-repro] $ nix-shell
[/tmp/afl-kit-repro] $ zig version
0.17.0-dev.857+2b2b85c5f
[/tmp/afl-kit-repro] $ zig build --release=safe
install
└─ install generated to fuzz-afl
└─ run /nix/store/skp570k5ldsfkbn2l7bb04h52c8jq9ai-aflplusplus-4.40c/bin/afl-cc (fuzz_obj) failure
warning: overriding the module target triple with x86_64-unknown-linux-gnu [-Woverride-module]
'-avx10.1' is not a recognized feature for this target (ignoring feature)
'-avx10.2' is not a recognized feature for this target (ignoring feature)
'-prefer-legacy-setcc' is not a recognized feature for this target (ignoring feature)
'-slow-pmullq' is not a recognized feature for this target (ignoring feature)
'-avx10.1' is not a recognized feature for this target (ignoring feature)
'-avx10.2' is not a recognized feature for this target (ignoring feature)
'-prefer-legacy-setcc' is not a recognized feature for this target (ignoring feature)
'-slow-pmullq' is not a recognized feature for this target (ignoring feature)
1 warning generated.
/nix/store/s2946bl9ciwzhafd66jhansrmxq9xhqm-binutils-2.46/bin/ld.bfd: /tmp/nix-shell-580880-0/fuzz_obj-e822fd.o: in function `fuzz.zig_fuzz_test1':
/tmp/afl-kit-repro/src/fuzz.zig:10:(.text.fuzz.zig_fuzz_test[fuzz.zig_fuzz_test]+0x31): undefined reference to `foo'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: process exited with code 1
failed command: /nix/store/skp570k5ldsfkbn2l7bb04h52c8jq9ai-aflplusplus-4.40c/bin/afl-cc -O3 -o ./.zig-cache/o/2e372654b2f64706ca2f78cb6b62d4c5/fuzz_obj /tmp/afl-kit-repro/zig-pkg/afl_kit-0.1.0-NdJ3ctQfAACNK1UANoF4pwkWOdW-JGLXHby9OE9-xMPq/afl.c ./.zig-cache/o/792a2abb8896d9eeee7eed99f5ff201e/fuzz_obj.bc
```