https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77982

--- Comment #5 from Kostya Serebryany <kcc at gcc dot gnu.org> ---
(In reply to Pawel Sikora from comment #3)
> (In reply to Kostya Serebryany from comment #2)
> > Is -flto important here?
> > Does this happen with clang? (does not happen for me)
> > Does this happen if you use statically linked asan (-static-libasan)?
> 
> ad1). lto isn't important.
> ad2). with static libasan testcase works.
> ad3). i can't verify with clang on fedora 24 due to linking error:
> 
> clang++ -fuse-ld=gold -g2 -O -fsanitize=address s.cpp -shared -o s.so -fPIC
> clang++ -fuse-ld=gold -g2 -O -fsanitize=address m.cpp -o m
> /usr/bin/ld.gold: error: cannot open
> /usr/bin/../lib64/clang/3.8.0/lib/linux/libclang_rt.asan-x86_64.a: No such
> file or directory
> /usr/bin/ld.gold: error: cannot open
> /usr/bin/../lib64/clang/3.8.0/lib/linux/libclang_rt.asan_cxx-x86_64.a: No
> such file or directory

Apparently, the clang installation is broken. 
Besides 3.8 is too old and is irrelevant anyway. 
Your test case works for me with clang trunk (clang links asan runtime
statically) 

> m.cpp:5: error: undefined reference to '__asan_init'
> m.cpp:5: error: undefined reference to '__asan_version_mismatch_check_v6'
> m.cpp:5: error: undefined reference to '__asan_register_globals'
> m.cpp:5: error: undefined reference to '__asan_unregister_globals'

>> ./s.so: undefined symbol: __asan_option_detect_stack_use_after_return
This does not happen with clang.

So, this looks like a gcc-specific bug, probably related to dynamic linking of
asan-rt. 

Hopefully the GCC folks can help. Ejecting myself from here. 
If something like this reproduces in clang trunk, please summon me back.

Reply via email to