This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Implement -fsanitize=null + new sanopt pass
- From: Jakub Jelinek <jakub at redhat dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: Marek Polacek <polacek at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 29 Nov 2013 20:32:34 +0100
- Subject: Re: [PATCH] Implement -fsanitize=null + new sanopt pass
- Authentication-results: sourceware.org; auth=none
- References: <20131112231348 dot GU30062 at redhat dot com> <20131118135141 dot GC892 at tucnak dot redhat dot com> <20131118144455 dot GB30062 at redhat dot com> <CAMe9rOo44zKgbxikhig1SiCFmRyAZS2C3Y=4g9Ma6fJK__yCXQ at mail dot gmail dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Fri, Nov 29, 2013 at 11:22:00AM -0800, H.J. Lu wrote:
> On Mon, Nov 18, 2013 at 6:44 AM, Marek Polacek <polacek@redhat.com> wrote:
> > On Mon, Nov 18, 2013 at 02:51:41PM +0100, Jakub Jelinek wrote:
> >> On Wed, Nov 13, 2013 at 12:13:48AM +0100, Marek Polacek wrote:
> >> > --- gcc/config/bootstrap-ubsan.mk.mp 2013-11-12 13:46:13.345182065 +0100
> >> > +++ gcc/config/bootstrap-ubsan.mk 2013-11-12 13:46:49.812314016 +0100
> >> > @@ -2,6 +2,6 @@
> >> >
> >> > STAGE2_CFLAGS += -fsanitize=undefined
> >> > STAGE3_CFLAGS += -fsanitize=undefined
> >> > -POSTSTAGE1_LDFLAGS += -fsanitize=undefined -static-libubsan -lpthread \
> >> > +POSTSTAGE1_LDFLAGS += -fsanitize=undefined -static-libubsan -lpthread -ldl \
> >>
> >> Hopefully with my pending patch you can remove the -lpthread -ldl again, but
> >> ok for now.
> >
>
> You shouldn't use -ldl directly. Not all OSes have libdl. You
> should extract the libdl check from gcc/configure.ac and
> set LIBDL instead by changing gcc/Makefile.in
-static-libubsan should add all the libraries needed of libubsan.a by now,
so -lpthread -ldl should be just removed from POSTSTAGE1_LDFLAGS.
Jakub