This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug sanitizer/56393] SIGSEGV when -fsanitize=address and dynamic lib with global objects
- From: "david.abdurachmanov at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 01 Jun 2013 21:34:47 +0000
- Subject: [Bug sanitizer/56393] SIGSEGV when -fsanitize=address and dynamic lib with global objects
- Auto-submitted: auto-generated
- References: <bug-56393-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56393
--- Comment #25 from David Abdurachmanov <david.abdurachmanov at gmail dot com> ---
I downloaded GCC 4.8.1 (final) and binutils 2.23.1 (default ld.gold). The
problem is that boost and a lot other C/C++ packages are not compiled w/ ASan.
One way would be to guarantee every single C/C++ RPM package correctly
compiling w/ ASan (quite some effort). I prefer to instrument the main software
(+ some critical C/C++ packages in future) for now.
I assume I cannot use -static-libasan for shared objects (-shared) as
PREINIT_ARRAY section would be a duplicate. Then -static-libasan should be only
used for the final executable binary?
I tried something like that:
c++ -fsanitize=address -shared -Wl,-E -Wl,-z,defs -Wl,-v ./test.o -o libtest.so
-static-libasan
I see it doesn't pass to linker:
<long_path>/lib64/libasan_preinit.o -Bstatic --whole-archive -lasan
--no-whole-archive -Bdynamic
And linker dies w/ undefined references of ASan.
Do I need to make sure that **only** executable binaries gets ASan linked
statically (-static-libasan)? (Thus they always have PREINIT_ARRAY section
initializing ASan).
david