This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug sanitizer/56393] SIGSEGV when -fsanitize=address and dynamic lib with global objects


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]