<div dir="ltr">Saying that sanitizers "do not support static linking" seems strange because we strongly advise users to link the sanitizer libraries themselves statically. This gives the best user experience, because it puts the interceptors into the executable, so they always come first in dynamic symbol search order.<div><br></div><div>What I think you are saying is that the sanitizers do not support linking statically with libc. This is probably true. It would be difficult to modify the interceptors to work when libc is linked statically, so it's probably not supported.<br><br></div><div>Hopefully that explains why the sanitizer libraries are static, but they don't exactly support linking with -static.</div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Aug 23, 2018 at 10:04 AM David Greene via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I am guessing that sanitizers are not supported with static linking.<br>
The AddressSanitizer document says so explicitly but the others do not.<br>
Yet the interceptors use dlsym to set up certain system calls, so by<br>
definition they can't support static linking.<br>
<br>
Given that sanitizers won't work with static linking, why are static<br>
libraries created for them?<br>
<br>
Should there be an error check in the interceptor code for dlsym<br>
returning nullptr?  I just spent a bunch of time tracking down a problem<br>
that turned out to be dlsym returning nullptr due to static linking.<br>
<br>
It seems like either users should not be able to link sanitizer runtime<br>
when linking statically or there should be a runtime check that dlsym<br>
doesn't return nullptr.  Ideally both.<br>
<br>
                          -David<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>