This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug driver/64998] New: -shared -static-libasan does not actually link libasan
- From: "holger dot grund at ix-n dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 10 Feb 2015 11:48:06 +0000
- Subject: [Bug driver/64998] New: -shared -static-libasan does not actually link libasan
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64998
Bug ID: 64998
Summary: -shared -static-libasan does not actually link libasan
Product: gcc
Version: 4.9.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: driver
Assignee: unassigned at gcc dot gnu.org
Reporter: holger.grund@ix-n.net
It was my expectation that I could statically link libasan into a shared object
with:
$ cat t.c
void foo(char* x) { x[4] = 1; }
$ gcc -fsanitize=address t.c -shared -fPIC -static-libasan
However, it seems that -lasan is never passed to the linker and I end up with
lots of unresolved symbols:
$ readelf -s a.out | grep asan
9: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND __asan_init_v3
10: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND __asan_report_store1
51: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND __asan_init_v3
52: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND __asan_report_store1
$ gcc -fsanitize=address t.c -shared -fPIC -static-libasan
-Wl,-Bstatic,-lasan,-Bdynamic
seems to produce the expected output.