diff mbox

gcc fstack-protector-explicit

Message ID 20150122204745.GO1746@tucnak.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Jan. 22, 2015, 8:47 p.m. UTC
On Thu, Jan 22, 2015 at 09:35:45AM -0700, Jeff Law wrote:
> >Though wonder if for the TARGET_LIBC_PROVIDES_SSP case LINK_SSP_SPEC
> >shouldn't be
> >#define LINK_SSP_SPEC "{fstack-protector|fstack-protector-strong|fstack-protector-explicit|fstack-protector-all:}"
> >and
> >gcc/config/freebsd.h:
> >#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all:-lssp_nonshared}"
> >should be changed too (adding both -string and -explicit).
> Ranier, sorry about the breakage on Solaris.
> 
> WRT other LINK_SPECs, yea, they all need to check the 4 variants of
> -fstack-protector-whatever and if any are found, link in libssp.
> 
> Patch to fix that pre-approved.

Here is what I've committed.

2015-01-22  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
	    Jakub Jelinek  <jakub@redhat.com>

	* gcc.c (LINK_SSP_SPEC): Handle -fstack-protector-explicit
	for !TARGET_LIBC_PROVIDES_SSP version and
	-fstack-protector-{all,strong,explicit} otherwise.
	* config/freebsd.h (LINK_SSP_SPEC): Handle
	-fstack-protector-{strong,explicit}.



	Jakub
diff mbox

Patch

--- gcc/gcc.c.jj	2015-01-22 11:59:32.000000000 +0100
+++ gcc/gcc.c	2015-01-22 17:42:17.965531999 +0100
@@ -728,9 +728,12 @@  proper position among the other output f
 
 #ifndef LINK_SSP_SPEC
 #ifdef TARGET_LIBC_PROVIDES_SSP
-#define LINK_SSP_SPEC "%{fstack-protector:}"
+#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
+		       "|fstack-protector-strong|fstack-protector-explicit:}"
 #else
-#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-strong|fstack-protector-all:-lssp_nonshared -lssp}"
+#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
+		       "|fstack-protector-strong|fstack-protector-explicit" \
+		       ":-lssp_nonshared -lssp}"
 #endif
 #endif
 
--- gcc/config/freebsd.h.jj	2015-01-05 13:07:15.000000000 +0100
+++ gcc/config/freebsd.h	2015-01-22 17:43:12.504603764 +0100
@@ -49,7 +49,9 @@  along with GCC; see the file COPYING3.
 #endif
 
 #ifdef TARGET_LIBC_PROVIDES_SSP
-#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all:-lssp_nonshared}"
+#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \
+		       "|fstack-protector-strong|fstack-protector-explicit" \
+		       ":-lssp_nonshared}"
 #endif
 
 #undef TARGET_LIBC_HAS_FUNCTION