ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD. #796
Description
I work ASAN with GCC6.3, for later libFuzzer test.
But I got error as :
==48458==ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.
I can fix it by export LD_PRELOAD=/path/libasan.so.3
But I still confused,my code is ok with GCC4.9 and ASAN libasan.so.1.
So I try force link libasan.so by -lasan in the first place, it don't work.
Then I add -v to link command ,I found something
/usr/bin/../libexec/gcc/x86_64-pc-linux-gnu/6.3.0/collect2 -plugin /usr/bin/../libexec/gcc/x86_64-pc-linux-gnu/6.3.0/liblto_plugin.so -plugin-opt=/usr/bin/../libexec/gcc/x86_64-pc-linux-gnu/6.3.0/lto-wrapper -plugin-opt=-fresolution=/tmp/ccVmBBY4.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -lasan
gcc 6.3 use collect2 to do link instead of ld ,and it link ld-linux-x86-64.so.2 before libasan.so.
Do I get the real reason?
Any help will be appreciated.
Activity