Patchwork r196201 - in /trunk: gcc/ChangeLog gcc/config/i...

login
register
mail settings
Submitter Jakub Jelinek
Date March 8, 2013, 5:19 p.m.
Message ID <20130308171908.GU12913@tucnak.redhat.com>
Download mbox | patch
Permalink /patch/226168/
State New
Headers show

Comments

Jakub Jelinek - March 8, 2013, 5:19 p.m.
On Fri, Feb 22, 2013 at 01:58:09PM +0100, Jakub Jelinek wrote:
> 2013-02-22  Jakub Jelinek  <jakub@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  <jakub@redhat.com>

	* config/gnu-user.h (LIBTSAN_EARLY_SPEC): Don't link against
	libasan_preinit.o.



	Jakub

Patch

--- 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