rust-fuzz/afl.rs

Linker flags unrecognized when installing afl via cargo

danben opened this issue · 0 comments

I'm using clang/llvm version 12 on Ubuntu 20.04, and I'm inside of an anaconda environment. I believe that I also tried this on version 10 with the same results. FWIW I haven't been able to find an LLVM manual that mentions these linker flags.

Error message:

--- stderr
 cc1: note: disable pass tree-cunrolli for functions in the range of [0, 4294967295]
 clang: error: -Wl,-O2: 'linker' input unused [-Werror,-Wunused-command-line-argument]
 clang: error: -Wl,--sort-common: 'linker' input unused [-Werror,-Wunused-command-line-argument]
 clang: error: -Wl,--as-needed: 'linker' input unused [-Werror,-Wunused-command-line-argument]
 clang: error: -Wl,-z,relro: 'linker' input unused [-Werror,-Wunused-command-line-argument]
 clang: error: -Wl,-z,now: 'linker' input unused [-Werror,-Wunused-command-line-argument]
 clang: error: -Wl,--disable-new-dtags: 'linker' input unused [-Werror,-Wunused-command-line-argument]
 clang: error: -Wl,--gc-sections: 'linker' input unused [-Werror,-Wunused-command-line-argument]
 clang: error: -Wl,-rpath,/home/danben/anaconda3/lib: 'linker' input unused [-Werror,-Wunused-command-line-argument]
 clang: error: -Wl,-rpath-link,/home/danben/anaconda3/lib: 'linker' input unused [-Werror,-Wunused-command-line-argument]
 clang: error: -ldl: 'linker' input unused [-Werror,-Wunused-command-line-argument]
 clang: error: -lrt: 'linker' input unused [-Werror,-Wunused-command-line-argument]
 clang: error: -lm: 'linker' input unused [-Werror,-Wunused-command-line-argument]
 make[1]: *** [GNUmakefile.llvm:362: instrumentation/afl-common.o] Error 1

Command to compile (generated by cargo install afl:
/usr/lib/llvm-12/bin/clang -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /home/danben/anaconda3/include -ggdb3 -O0 -Wall -Wextra -Werror -g -Wno-pointer-sign -Wno-variadic-macros -Wall -Wextra -Wpointer-arith -I include/ -DAFL_PATH=\"/lib/afl\" -DBIN_PATH=\"/bin\" -DDOC_PATH=\"/share/doc/afl\" -Wall -g -Wno-cast-qual -Wno-variadic-macros -Wno-pointer-sign -I ./include/ -I ./instrumentation/ -DAFL_PATH=\"/lib/afl\" -DBIN_PATH=\"/bin\" -DLLVM_BINDIR=\"/usr/lib/llvm-12/bin\" -DVERSION=\"++3.01a\" -DLLVM_LIBDIR=\"/usr/lib/llvm-12/lib\" -DLLVM_VERSION=\"12.0.0\" -Wno-deprecated -DAFL_CLANG_FLTO=\"-flto=full\" -DAFL_REAL_LD=\"/usr/lib/llvm-12/bin/ld.lld\" -DAFL_CLANG_LDPATH=\"1\" -DAFL_CLANG_FUSELD=\"1\" -DCLANG_BIN=\"/usr/lib/llvm-12/bin/clang\" -DCLANGPP_BIN=\"/usr/lib/llvm-12/bin/clang++\" -DUSE_BINDIR=1 -Wno-unused-function -fdebug-prefix-map="/home/danben/.cargo/registry/src/github.com-1ecc6299db9ec823/afl-0.10.1/AFLplusplus=llvm_mode" -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /home/danben/anaconda3/include -c src/afl-common.c -o instrumentation/afl-common.o -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,--disable-new-dtags -Wl,--gc-sections -Wl,-rpath,/home/danben/anaconda3/lib -Wl,-rpath-link,/home/danben/anaconda3/lib -L/home/danben/anaconda3/lib -ldl -lrt -lm