[cfe-users] Address Sanitizer Link Error
Peter Caspers
pcaspers1973 at gmail.com
Wed May 7 02:11:20 PDT 2014
what I observe is that if I use clang (instead of clang++) for the
link step, I get a different error (undefined reference to symbol
___cxa_free_exception@@CXXABI_1.3). I thought, that clang++ is just a
synonym for clang ? How does that magic happen ?
Thanks again
Peter
On 7 May 2014 11:08, Peter Caspers <pcaspers1973 at gmail.com> wrote:
> I tried the link step from the command line manually, but get the same
> error messages.
> In which library is __asan_memcpy expected to reside ?
> Thanks
> Peter
>
> On 6 May 2014 12:23, Jeffrey Walton <noloader at gmail.com> wrote:
>> On Tue, May 6, 2014 at 5:36 AM, Peter Caspers <pcaspers1973 at gmail.com> wrote:
>>> yes, I use clang with the sanitize option to link. I have the
>>> following libs installed
>>>
>>> peter at peter-ThinkPad-W520:/usr/local/lib/clang/3.5.0/lib/linux$ ls
>>> libclang_rt.asan-x86_64.a libclang_rt.lsan-x86_64.a
>>> libclang_rt.san-x86_64.a libclang_rt.ubsan-x86_64.a
>>> libclang_rt.dfsan-x86_64.a libclang_rt.msan-x86_64.a
>>> libclang_rt.tsan-x86_64.a
>>> libclang_rt.full-x86_64.a libclang_rt.profile-x86_64.a
>>> libclang_rt.ubsan_cxx-x86_64.a
>>>
>>> You think that should work then ?
>> How do you invoke Clang? Are the sanitizer flags part of CFLAGS and CXXFLAGS?
>>
>> Is this an Autools project? Sometimes you have to be creative with
>> Autotools projects. For example, you might need to do:
>>
>> export CC="clang -fsanitize=undefined -fsanitize=address"
>> export CXX="clang -fsanitize=undefined -fsanitize=address
>> -fno-sanitize=vptr"
>>
>> That's because there will sometimes be a link line that *omits* CFLAGS
>> and CXXFLAGS. For example:
>>
>> # Link using the compiler...
>> $(CC) -o $(program_name) $(OBJECTS) $(LDFLAGS) $(LDLIBS)
>>
>> On Mac OS X, I also find I need to set DYLD_FALLBACK_LIBRARY_PATH
>> before executing:
>>
>> export DYLD_FALLBACK_LIBRARY_PATH=/usr/local/lib/clang/3.4/lib/darwin/
>> ./my_program
>>
>> I don't recall doing similar on Linux. (But I may have done it and
>> forgotten about it).
>>
>> Jeff
More information about the cfe-users
mailing list