[cfe-dev] [UBSan] Is static linking supported?
Vedant Kumar via cfe-dev
cfe-dev at lists.llvm.org
Thu Aug 23 11:13:30 PDT 2018
> On Aug 23, 2018, at 10:59 AM, David Greene <dag at cray.com> wrote:
>
> According to Reid Kleckner over on llvm-dev sanitizers will not work at
> all with a statically-linked libc, as the interceptors use dlsym to set
> up calls to sigaction and the like. That matched my findings while
> debugging the problem we're seeing.
Good point, that might be the issue here.
> If sanitizers are supposed to work
> with static linking, then it seems like the dependence on dlsym needs to
> be broken.
>
> Otherwise, the sanitizers should catch a nullptr return value from dlsym
> and report a friendly user error message. I can write a patch to do
> that if it seems like a good idea. Even when linking dynamically, it
> would be good to check the return value of dlsym and report the error to
> the user.
+ 1.
vedant
>
> -David
>
> Vedant Kumar via cfe-dev <cfe-dev at lists.llvm.org> writes:
>
>> On some platforms it's possible to statically link against the
>> ASan/UBSan runtimes using the undocumented -static-libsan option. The
>> default behavior on Darwin, Android, and Fuchsia is to link against a
>> DSO.
>>
>> On Aug 23, 2018, at 8:57 AM, Troy Johnson via cfe-dev
>> <cfe-dev at lists.llvm.org> wrote:
>>
>>
>>
>>
>> The address sanitizer is documented as not supported with static
>> linking, but UBSan does not include the same disclaimer. UBSan
>> does not work for me with statically-linked executables. Instead,
>> the executables segfault immediately when attempting to install
>> signal handlers. Is this expected?
>>
>> No, that's not expected :). Could you share the options you used to
>> compile and link it, and the backtrace you get?
>>
>> vedant
>>
>>
>>
>> -Troy
>>
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>
>>
>> _______________________________________________
>> 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