Patchwork [asan] PATCH: PR driver/55379: Issue an error for -static with fsanitize=address

login
register
mail settings
Submitter H.J. Lu
Date Nov. 22, 2012, 2:39 p.m.
Message ID <20121122143910.GA23803@gmail.com>
Download mbox | patch
Permalink /patch/201053/
State New
Headers show

Comments

H.J. Lu - Nov. 22, 2012, 2:39 p.m.
Hi,

fsanitize=address doesn't work with static link.  This patch issues
an error when both are specified.  OK to install?

Thanks.


H.J.
---
2012-11-22  H.J. Lu  <hongjiu.lu@intel.com>

	PR driver/55379
	* gcc.c (LINK_COMMAND_SPEC): Issue an error for -static with
	-fsanitize=address.
Jakub Jelinek - Nov. 22, 2012, 3:09 p.m.
On Thu, Nov 22, 2012 at 06:39:11AM -0800, H.J. Lu wrote:
> fsanitize=address doesn't work with static link.  This patch issues
> an error when both are specified.  OK to install?

> 2012-11-22  H.J. Lu  <hongjiu.lu@intel.com>
> 
> 	PR driver/55379

Replace driver/ with sanitizer/

> 	* gcc.c (LINK_COMMAND_SPEC): Issue an error for -static with
> 	-fsanitize=address.

Ok with that change.

> diff --git a/gcc/gcc.c b/gcc/gcc.c
> index 0f8bcea..41474aa 100644
> --- a/gcc/gcc.c
> +++ b/gcc/gcc.c
> @@ -696,7 +696,7 @@ proper position among the other output files.  */
>      %{fgnu-tm:%:include(libitm.spec)%(link_itm)}\
>      %(mflib) " STACK_SPLIT_SPEC "\
>      %{fprofile-arcs|fprofile-generate*|coverage:-lgcov}\
> -    %{fsanitize=address:" LIBASAN_SPEC "}\
> +    %{fsanitize=address:" LIBASAN_SPEC "%{static:%ecannot specify -static with -fsanitize=address}}\
>      %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
>      %{!nostdlib:%{!nostartfiles:%E}} %{T*} }}}}}}"
>  #endif

	Jakub

Patch

diff --git a/gcc/gcc.c b/gcc/gcc.c
index 0f8bcea..41474aa 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -696,7 +696,7 @@  proper position among the other output files.  */
     %{fgnu-tm:%:include(libitm.spec)%(link_itm)}\
     %(mflib) " STACK_SPLIT_SPEC "\
     %{fprofile-arcs|fprofile-generate*|coverage:-lgcov}\
-    %{fsanitize=address:" LIBASAN_SPEC "}\
+    %{fsanitize=address:" LIBASAN_SPEC "%{static:%ecannot specify -static with -fsanitize=address}}\
     %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
     %{!nostdlib:%{!nostartfiles:%E}} %{T*} }}}}}}"
 #endif