diff mbox

Put -lasan always very early on the ld command line (PR sanitizer/55374)

Message ID 1537661.SE9S0Nd4UY@polaris
State New
Headers show

Commit Message

Eric Botcazou Feb. 5, 2013, 8:37 a.m. UTC
> 2013-01-22  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR sanitizer/55374
> 	* gcc.c (LIBASAN_SPEC): Define just to ADD_STATIC_LIBASAN_LIBS if
> 	LIBASAN_EARLY_SPEC is defined.
> 	(LIBASAN_EARLY_SPEC): Define to empty string if not already defined.
> 	(LINK_COMMAND_SPEC): Add LIBASAN_EARLY_SPEC for -fsanitize=address,
> 	before %o.
> 	* config/gnu-user.h (LIBASAN_EARLY_SPEC): Define.

This has introduced a syntax error for gcc.c when you're building a quick 
cross-compiler.  Fixed by the attached patchlet.

Tested on x86_64-suse-linux, OK for the mainline?


2013-02-05  Eric Botcazou  <ebotcazou@adacore.com>

	PR sanitizer/55374
	* config/gnu-user.h (LIBASAN_EARLY_SPEC): Add missing guard.

Comments

Jakub Jelinek Feb. 5, 2013, 8:52 a.m. UTC | #1
On Tue, Feb 05, 2013 at 09:37:29AM +0100, Eric Botcazou wrote:
> Tested on x86_64-suse-linux, OK for the mainline?
> 
> 
> 2013-02-05  Eric Botcazou  <ebotcazou@adacore.com>
> 
> 	PR sanitizer/55374
> 	* config/gnu-user.h (LIBASAN_EARLY_SPEC): Add missing guard.

Yes, thanks.

> Index: config/gnu-user.h
> ===================================================================
> --- config/gnu-user.h	(revision 195694)
> +++ config/gnu-user.h	(working copy)
> @@ -102,10 +102,12 @@ see the files COPYING3 and COPYING.RUNTI
>     it for -shared link, the executable should be compiled with -static-libasan
>     in that case, and for executable link link with --{,no-}whole-archive around
>     it to force everything into the executable.  */
> +#if defined(HAVE_LD_STATIC_DYNAMIC)
>  #undef LIBASAN_EARLY_SPEC
>  #define LIBASAN_EARLY_SPEC "%{static-libasan:%{!shared:" \
>    LD_STATIC_OPTION " --whole-archive -lasan --no-whole-archive " \
>    LD_DYNAMIC_OPTION "}}%{!static-libasan:-lasan}"
> +#endif
>  
>  /* Additional libraries needed by -static-libasan.  */
>  #undef STATIC_LIBASAN_LIBS

	Jakub
diff mbox

Patch

Index: config/gnu-user.h
===================================================================
--- config/gnu-user.h	(revision 195694)
+++ config/gnu-user.h	(working copy)
@@ -102,10 +102,12 @@  see the files COPYING3 and COPYING.RUNTI
    it for -shared link, the executable should be compiled with -static-libasan
    in that case, and for executable link link with --{,no-}whole-archive around
    it to force everything into the executable.  */
+#if defined(HAVE_LD_STATIC_DYNAMIC)
 #undef LIBASAN_EARLY_SPEC
 #define LIBASAN_EARLY_SPEC "%{static-libasan:%{!shared:" \
   LD_STATIC_OPTION " --whole-archive -lasan --no-whole-archive " \
   LD_DYNAMIC_OPTION "}}%{!static-libasan:-lasan}"
+#endif
 
 /* Additional libraries needed by -static-libasan.  */
 #undef STATIC_LIBASAN_LIBS