[cfe-dev] i386 -faddress-sanitizer

Alexander Potapenko glider at google.com
Thu Oct 18 06:29:19 PDT 2012


Are you linking with ld or clang?
-faddress-sanitizer is a Clang flag, so if you're running `ld $LDFLAGS
...` to link your program, it won't work.

On Thu, Oct 18, 2012 at 5:12 PM, Carsten Mattner
<carstenmattner at gmail.com> wrote:
> On Thu, Oct 18, 2012 at 12:27 AM, Eli Friedman wrote:
>> On Wed, Oct 17, 2012 at 1:43 PM, Carsten Mattner
>> <carstenmattner at gmail.com> wrote:
>>> Is it expected that -faddress-sanitizer  does not work on i386 and fails
>>> to properly link resulting in errors like 'undefined symbol: __asan_init'
>>> at runtime?
>>>
>>> I have ./lib/clang/3.2/lib/linux/libclang_rt.asan-i386.a in llvm's installation,
>>> but it doesn't look like it's linked automatically into the executable.
>>>
>>> CFLAGS:
>>> -faddress-sanitizer -O1 -fno-omit-frame-pointer -g $PROJECT_FLAGS
>>
>> You need to pass in -faddress-sanitizer both when compiling and when
>> linking an application.  Try something like
>> "LDFLAGS=-faddress-sanitizer".
>
> Oh that makes a lot of sense and is kind of obvious in hindsight.
> Yet it didn't work in a quick test. Any options I flags to pass for
> verbose printfs to see what's happening you can suggest?
> In the next test I'll also try to explicitly link the libasan archive
> manually for ruling out issues with that archive.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev



-- 
Alexander Potapenko
Software Engineer
Google Moscow



More information about the cfe-dev mailing list