[cfe-dev] -fsanitize=undefined and shared libraries

zapadinsky zapadinsky at gmail.com
Fri Jan 11 17:08:15 PST 2013


Will Dietz wrote
> In a different direction, I notice that we don't link in the ubsan 
> runtime when building a shared library.  Why is this? (to avoid code 
> duplication, issues with -fPIC, some static initializer/internal state 
> concern?)  Removing this check on my local clang copy has resolved 
> this issue for me, and is presently how I'm building programs. 
> However, I'm reluctant to propose this as a solution without knowing 
> why things are the way they are first :). 

Yes without this crunch the .so library have "U __ubsan_handle_add_overflow"
symbol according to nm. And it is impossible to load and use this library
through dlopen() for example.
Your patch with __attribute__((visibility("default"))) didn't help :( I have
recompiled my llvm clang compiler-rt and still have undefined
__ubsan_handle_add_overflow in .so 
Code duplication is not a big problem, this handlers are so tiny.



--
View this message in context: http://clang-developers.42468.n3.nabble.com/fsanitize-undefined-and-shared-libraries-tp4029561p4029663.html
Sent from the Clang Developers mailing list archive at Nabble.com.



More information about the cfe-dev mailing list