[cfe-dev] [UBSan] Is static linking supported?

David Greene via cfe-dev cfe-dev at lists.llvm.org
Mon Aug 27 08:37:27 PDT 2018


[ Trying to unify these two threads. ]

I am unsure of how we should proceed.  I was about to prepare a patch to
test for a nullptr return value from dlsym and emit a helpful error
message to the user.  That may still be useful as dlsym could still
return nullptr even in a dynamically-linked executable.

But it sounds like some more work needs to be done on UBSan to make it
work with static binaries again.

Is the nullptr check patch still desired?  If so, is there any reason to
delay it until other issues with UBSan can be worked out?

                          -David

Troy Johnson via cfe-dev <cfe-dev at lists.llvm.org> writes:

>> > The standalone version of the UBSan runtime used on Windows does
>> > install its own signal handlers. Maybe that causes a bad interaction
>> > with Troy's program?
>
> I was running on Linux, not Windows.
>
>> >> >> No, that's not expected :). Could you share the options you used
>> >> >> to compile and link it, and the backtrace you get?
>
> I was trying the test.cc example here:
> https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#usage
>
> But with the addition of -static.  It linked, but immediately seg faulted when I ran it.
>
> Notably, if you try -static with another sanitizer, like
> -fsanitize=address, you get linker errors with the word "dynamic" in
> it, so it becomes pretty clear that you are doing something
> unexpected.
>
> The successful link of -fsanitize=undefined -static plus the lack of
> any disclaimer in the documentation made me assume it should work.
>
> -Troy
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



More information about the cfe-dev mailing list