diff mbox

Implement -fsanitize=null + new sanopt pass

Message ID 20131129200246.GL31608@redhat.com
State New
Headers show

Commit Message

Marek Polacek Nov. 29, 2013, 8:02 p.m. UTC
On Fri, Nov 29, 2013 at 08:57:23PM +0100, Jakub Jelinek wrote:
> On Fri, Nov 29, 2013 at 08:55:26PM +0100, Marek Polacek wrote:
> > 2013-11-29  Marek Polacek  <polacek@redhat.com>
> > 
> > 	* bootstrap-ubsan.mk (POSTSTAGE1_LDFLAGS): Remove -lpthread -ldl.
> > 
> > --- gcc/bootstrap-ubsan.mk.mp3	2013-11-29 20:50:04.788238860 +0100
> > +++ gcc/bootstrap-ubsan.mk	2013-11-29 20:50:25.870322185 +0100
> > @@ -2,6 +2,6 @@
> >  
> >  STAGE2_CFLAGS += -fsanitize=undefined
> >  STAGE3_CFLAGS += -fsanitize=undefined
> > -POSTSTAGE1_LDFLAGS += -fsanitize=undefined -static-libubsan -lpthread -ldl \
> > +POSTSTAGE1_LDFLAGS += -fsanitize=undefined -static-libubsan \
> >  		      -B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/ubsan/ \
> >  		      -B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/ubsan/.libs
> 
> Please add -B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/ too, so that
> it is able to find libsanitizer.spec.  Ok with that change.

Thanks, will apply the following then.

2013-11-29  Marek Polacek  <polacek@redhat.com>

	* bootstrap-ubsan.mk (POSTSTAGE1_LDFLAGS): Remove -lpthread -ldl.
	Add -B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/.


	Marek

Comments

H.J. Lu Nov. 29, 2013, 9:35 p.m. UTC | #1
On Fri, Nov 29, 2013 at 12:02 PM, Marek Polacek <polacek@redhat.com> wrote:
> On Fri, Nov 29, 2013 at 08:57:23PM +0100, Jakub Jelinek wrote:
>> On Fri, Nov 29, 2013 at 08:55:26PM +0100, Marek Polacek wrote:
>> > 2013-11-29  Marek Polacek  <polacek@redhat.com>
>> >
>> >     * bootstrap-ubsan.mk (POSTSTAGE1_LDFLAGS): Remove -lpthread -ldl.
>> >
>> > --- gcc/bootstrap-ubsan.mk.mp3      2013-11-29 20:50:04.788238860 +0100
>> > +++ gcc/bootstrap-ubsan.mk  2013-11-29 20:50:25.870322185 +0100
>> > @@ -2,6 +2,6 @@
>> >
>> >  STAGE2_CFLAGS += -fsanitize=undefined
>> >  STAGE3_CFLAGS += -fsanitize=undefined
>> > -POSTSTAGE1_LDFLAGS += -fsanitize=undefined -static-libubsan -lpthread -ldl \
>> > +POSTSTAGE1_LDFLAGS += -fsanitize=undefined -static-libubsan \
>> >                   -B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/ubsan/ \
>> >                   -B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/ubsan/.libs
>>
>> Please add -B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/ too, so that
>> it is able to find libsanitizer.spec.  Ok with that change.
>
> Thanks, will apply the following then.
>
> 2013-11-29  Marek Polacek  <polacek@redhat.com>
>
>         * bootstrap-ubsan.mk (POSTSTAGE1_LDFLAGS): Remove -lpthread -ldl.
>         Add -B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/.
>
> --- gcc/bootstrap-ubsan.mk.mp3  2013-11-29 20:50:04.788238860 +0100
> +++ gcc/bootstrap-ubsan.mk      2013-11-29 20:58:23.322131822 +0100
> @@ -2,6 +2,7 @@
>
>  STAGE2_CFLAGS += -fsanitize=undefined
>  STAGE3_CFLAGS += -fsanitize=undefined
> -POSTSTAGE1_LDFLAGS += -fsanitize=undefined -static-libubsan -lpthread -ldl \
> +POSTSTAGE1_LDFLAGS += -fsanitize=undefined -static-libubsan \
> +                     -B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/ \
>                       -B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/ubsan/ \
>                       -B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/ubsan/.libs
>
>         Marek

I pushed it to binutils-gdb.
diff mbox

Patch

--- gcc/bootstrap-ubsan.mk.mp3	2013-11-29 20:50:04.788238860 +0100
+++ gcc/bootstrap-ubsan.mk	2013-11-29 20:58:23.322131822 +0100
@@ -2,6 +2,7 @@ 
 
 STAGE2_CFLAGS += -fsanitize=undefined
 STAGE3_CFLAGS += -fsanitize=undefined
-POSTSTAGE1_LDFLAGS += -fsanitize=undefined -static-libubsan -lpthread -ldl \
+POSTSTAGE1_LDFLAGS += -fsanitize=undefined -static-libubsan \
+		      -B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/ \
 		      -B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/ubsan/ \
 		      -B$$r/prev-$(TARGET_SUBDIR)/libsanitizer/ubsan/.libs