Patchwork Error out on -fsanitize=thread -fsanitize=address

login
register
mail settings
Submitter Jakub Jelinek
Date May 6, 2013, 6:55 p.m.
Message ID <20130506185537.GO28963@tucnak.redhat.com>
Download mbox | patch
Permalink /patch/241758/
State New
Headers show

Comments

Jakub Jelinek - May 6, 2013, 6:55 p.m.
Hi!

While these two sanitizing modes don't conflict on the compiler side, the
runtimes are incompatible with each other (each assumes different memory
layout).  We'd need a special runtime library that would handle both at the
same time, probably not worth the hassle.

Ok for trunk/4.8?

2013-05-06  Jakub Jelinek  <jakub@redhat.com>

	* gcc.c (SANITIZER_SPEC): Reject -fsanitize=address -fsanitize=thread
	linking.


	Jakub
Dodji Seketeli - May 17, 2013, 11:59 a.m.
Jakub Jelinek <jakub@redhat.com> writes:


> 2013-05-06  Jakub Jelinek  <jakub@redhat.com>
>
> 	* gcc.c (SANITIZER_SPEC): Reject -fsanitize=address -fsanitize=thread
> 	linking.

This looks OK to me, thanks.

Patch

--- gcc/gcc.c.jj	2013-04-15 16:55:04.000000000 +0200
+++ gcc/gcc.c	2013-05-06 17:25:42.306455151 +0200
@@ -716,7 +716,8 @@  proper position among the other output f
 #ifndef SANITIZER_SPEC
 #define SANITIZER_SPEC "\
 %{!nostdlib:%{!nodefaultlibs:%{fsanitize=address:" LIBASAN_SPEC "\
-    %{static:%ecannot specify -static with -fsanitize=address}}\
+    %{static:%ecannot specify -static with -fsanitize=address}\
+    %{fsanitize=thread:%e-fsanitize=address is incompatible with -fsanitize=thread}}\
     %{fsanitize=thread:" LIBTSAN_SPEC "\
     %{!pie:%{!shared:%e-fsanitize=thread linking must be done with -pie or -shared}}}}}"
 #endif