<div dir="ltr">The sanitizer libc interceptors (malloc, etc) also need to be linked into the executable because the loader searches the executable first.<div><br></div><div>I think the sanitizers also rely on the initial executable TLS model.</div><div><br></div><div>Given the complexities, I don't think it's worth the effort to split. It might be worth it if there were more desire to support the shared library sanitizer build that GCC prefers.</div><div><br></div><div>What about creating an msan interface DSO for the purposes of satisfying -z defs? The executable will always be searched first, so the interface DSO could be empty or full of ud2a.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 21, 2015 at 5:59 AM, Rafael Espíndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I recently tried to enabled building llvm libraries with -Wl,-z,defs.<br>
The intention was to detect missing dependencies on ELF, so that we<br>
don't<br>
get into a situation where a .so builds, but the equivalent .dylib or<br>
.dll fails.<br>
<br>
This failed when building with msan because of undefined references to<br>
functions like __msan_memcpy.<br>
<br>
Unfortunately, I don't think elf linkers have a way of informing them<br>
that a given symbol will be provided at runtime. It is possible to<br>
pass a dummy executable build with msan, but that gets recorded in<br>
DT_NEEDED.<br>
<br>
My understanding is that the msan library provides two things: an<br>
initialization code that has to run really early and auxiliary<br>
functions like __msan_memcpy.<br>
<br>
Would it be possible to split libclang_rt.msan-x86_64.a such that the<br>
utility functions are available on a .so (or at least a -fPIC .a)?<br>
That library could be linked with every .so. The early init logic<br>
would still only be linked with executables.<br>
<br>
Cheers,<br>
Rafael<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</blockquote></div><br></div>