[cfe-users] Address Sanitizer Link Error

Peter Caspers pcaspers1973 at gmail.com
Wed May 7 02:08:39 PDT 2014


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