<div dir="ltr">I think so. I'd CC Matt Morehouse on it.</div><br><div class="gmail_quote"><div dir="ltr">On Thu, Aug 23, 2018 at 10:16 AM David Greene <<a href="mailto:dag@cray.com" target="_blank">dag@cray.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Ok, that makes sense.  Should there be code to test the result of dlsym<br>
and report an error to the user?  Faulting simply because one uses<br>
--static during the link stage isn't very friendly.  It would be nice to<br>
get an error with a helpful message about linking libc dynamically.<br>
<br>
Would there be interest in a patch to implement this?<br>
<br>
                          -David<br>
<br>
Reid Kleckner via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> writes:<br>
<br>
> Saying that sanitizers "do not support static linking" seems strange<br>
> because we strongly advise users to link the sanitizer libraries<br>
> themselves statically. This gives the best user experience, because it<br>
> puts the interceptors into the executable, so they always come first<br>
> in dynamic symbol search order.<br>
><br>
> What I think you are saying is that the sanitizers do not support<br>
> linking statically with libc. This is probably true. It would be<br>
> difficult to modify the interceptors to work when libc is linked<br>
> statically, so it's probably not supported.<br>
><br>
> Hopefully that explains why the sanitizer libraries are static, but<br>
> they don't exactly support linking with -static.<br>
><br>
> On Thu, Aug 23, 2018 at 10:04 AM David Greene via llvm-dev<br>
> <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
><br>
>     I am guessing that sanitizers are not supported with static<br>
>     linking.<br>
>     The AddressSanitizer document says so explicitly but the others do<br>
>     not.<br>
>     Yet the interceptors use dlsym to set up certain system calls, so<br>
>     by<br>
>     definition they can't support static linking.<br>
>     <br>
>     Given that sanitizers won't work with static linking, why are<br>
>     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<br>
>     problem<br>
>     that turned out to be dlsym returning nullptr due to static<br>
>     linking.<br>
>     <br>
>     It seems like either users should not be able to link sanitizer<br>
>     runtime<br>
>     when linking statically or there should be a runtime check that<br>
>     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>
><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>