http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55374
--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-01-22 10:52:55 UTC --- One way out of this would be for libasan.a to be an *.o object rather than *.a archive: mv libasan.a libasan_a.a gcc -Wl,-r -nostdlib -o libasan.a -Wl,--whole-archive libasan_a.a -Wl,--no-whole-archive and then it could be linked early. ASAN_STATIC_LIBS (-ldl -lpthread) for Linux would obviously come late in the command line, where we currently emitted -lasan too. -lasan resp. -Bstatic -lasan -Bdynamic would need to go before %o in LINK_COMMAND_SPEC in that case.