On Fri, Feb 22, 2013 at 01:58:09PM +0100, Jakub Jelinek wrote: > 2013-02-22 Jakub Jelinek <ja...@redhat.com> > > PR sanitizer/56393 > * config/gnu-user.h (LIBASAN_EARLY_SPEC): Link in libasan_preinit.o > if not linking a shared library. > > --- gcc/config/gnu-user.h.jj 2013-02-05 16:55:01.000000000 +0100 > +++ gcc/config/gnu-user.h 2013-02-22 13:02:11.000000000 +0100 > @@ -104,11 +104,13 @@ see the files COPYING3 and COPYING.RUNTI > it to force everything into the executable. And similarly for -ltsan. */ > #if defined(HAVE_LD_STATIC_DYNAMIC) > #undef LIBASAN_EARLY_SPEC > -#define LIBASAN_EARLY_SPEC "%{static-libasan:%{!shared:" \ > +#define LIBASAN_EARLY_SPEC "%{!shared:libasan_preinit%O%s} " \ > + "%{static-libasan:%{!shared:" \ > LD_STATIC_OPTION " --whole-archive -lasan --no-whole-archive " \ > LD_DYNAMIC_OPTION "}}%{!static-libasan:-lasan}" > #undef LIBTSAN_EARLY_SPEC > -#define LIBTSAN_EARLY_SPEC "%{static-libtsan:%{!shared:" \ > +#define LIBTSAN_EARLY_SPEC "%{!shared:libasan_preinit%O%s} " \ > + "%{static-libtsan:%{!shared:" \ > LD_STATIC_OPTION " --whole-archive -ltsan --no-whole-archive " \ > LD_DYNAMIC_OPTION "}}%{!static-libtsan:-ltsan}" > #endif
No idea what I've been thinking that I also changed LIBTSAN_EARLY_SPEC. Obviously for -fsanitize=thread we shouldn't link in libasan_preinit.o, that is never going to work. Fixed thusly, committed as obvious to trunk: 2013-03-08 Jakub Jelinek <ja...@redhat.com> * config/gnu-user.h (LIBTSAN_EARLY_SPEC): Don't link against libasan_preinit.o. --- gcc/config/gnu-user.h.jj 2013-02-22 17:05:05.000000000 +0100 +++ gcc/config/gnu-user.h 2013-03-08 18:11:53.147370936 +0100 @@ -109,8 +109,7 @@ see the files COPYING3 and COPYING.RUNTI LD_STATIC_OPTION " --whole-archive -lasan --no-whole-archive " \ LD_DYNAMIC_OPTION "}}%{!static-libasan:-lasan}" #undef LIBTSAN_EARLY_SPEC -#define LIBTSAN_EARLY_SPEC "%{!shared:libasan_preinit%O%s} " \ - "%{static-libtsan:%{!shared:" \ +#define LIBTSAN_EARLY_SPEC "%{static-libtsan:%{!shared:" \ LD_STATIC_OPTION " --whole-archive -ltsan --no-whole-archive " \ LD_DYNAMIC_OPTION "}}%{!static-libtsan:-ltsan}" #endif Jakub