On Tue, Mar 25, 2014 at 2:32 PM, Jakub Jelinek <ja...@redhat.com> wrote:
> On Tue, Mar 25, 2014 at 09:17:07PM +0100, Jakub Jelinek wrote:
>> On Tue, Mar 25, 2014 at 08:57:21PM +0100, Jakub Jelinek wrote:
>> > It works fine for ubsan, and your fix is not the right thing to do,
>> > e.g. bootstrap-ubsan reveals some bugs in libiberty which would be 
>> > otherwise
>> > unnoticed if you always filter away the sanitizing options from libiberty.
>> >
>> > So, I think my patch is the right thing to do for ubsan bootstraps, and for
>> > asan bootstraps we'll need something different (build libiberty twice, or
>> > build selected libiberty objects inside lto-plugin/ directory again, or
>> > something similar).  You do want the libiberty parts in cc1, cc1plus, xgcc
>> > etc. instrumented.
>>
>> Seems libiberty builds (optionally) everything also into pic/ subdirectory,
>> I think best would be if it in case it found -fsanitize=address in CFLAGS
>> also built everything into noasan/ subdirectory with additional
>> -fno-sanitize=address, and filter out -fsanitize=address just in lto-plugin
>> Makefile and use noasan/libiberty.a preferrably over pic/libiberty.a over
>> libiberty.a.
>> I guess I can cook up a patch tomorrow for that, though probably won't have
>> cycles to fully test that.
>
> Here is completely untested patch that should do that (on top of the two
> PR56781 patches I've posted earlier today).  Can you give them a shot?
>
> 2014-03-25  Jakub Jelinek  <ja...@redhat.com>
>
>         PR sanitizer/56781
> lto-plugin/
>         * Makefile.am (CFLAGS, LDFLAGS): Filter out -fsanitize=address.
>         (liblto_plugin_la_LIBADD, liblto_plugin_la_LDFLAGS,
>         liblto_plugin_la_DEPENDENCIES): Prefer ../libiberty/noasan/libiberty.a
>         over ../libiberty/pic/libiberty.a if the former exists.
>         * Makefile.in: Regenerated.
> libiberty/
>         * maint-tool: Also emit rule for noasan/ subdirectory.
>         * configure.ac (NOASANFLAG): Set and substitute.
>         * Makefile.in: Regenerated.
>         (NOASANFLAG): Set.
>         (all, $(TARGETLIB), mostlyclean): Handle noasan subdir like pic
>         subdir.
>         (stamp-noasandir): New goal.
>         * configure: Regenerated.
>

I got

/export/gnu/import/git/gcc/libiberty/configure: line 4977: syntax
error near unexpected token `-fsanitize=address'
/export/gnu/import/git/gcc/libiberty/configure: line 4977: `  *
-fsanitize=address *) NOASANFLAG=-fno-sanitize=address ;;'
checking fcntl.h usability... yes

H.J.

Reply via email to