]> xenbits.xensource.com Git - people/julieng/freebsd.git/commitdiff
Only use -fstack-protector-strong with supported compilers
authorngie <ngie@FreeBSD.org>
Sat, 17 Oct 2015 19:48:17 +0000 (19:48 +0000)
committerngie <ngie@FreeBSD.org>
Sat, 17 Oct 2015 19:48:17 +0000 (19:48 +0000)
This includes clang 3.5.0+, gcc 4.2.1, gcc 4.8.4+

This allows me to do subdirectory makes again after setting
MAKESYSPATH on 10.2-RELEASE as it comes with clang 3.4.1.

As a sidenote: this isn't technically correct for all vintages
of gcc 4.2.1, but will be correct when gcc is rebuilt/reinstalled
after r286074, so this version check should be good enough.

X-MFC with: r288669
Differential Revision: https://reviews.freebsd.org/D3924
Reviewed by: emaste, pfg

share/mk/bsd.sys.mk

index d5a469676d41727c6694458ec7a244412721a54b..68351a0d22a73016eb4a99ef2fb6ce28038ec2a3 100644 (file)
@@ -148,9 +148,13 @@ CXXFLAGS.clang+=    -Wno-c++11-extensions
 
 .if ${MK_SSP} != "no" && \
     ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips"
+.if (${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 30500) || \
+    (${COMPILER_TYPE} == "gcc" && \
+     (${COMPILER_VERSION} == 40201 || ${COMPILER_VERSION} >= 40800))
 # Don't use -Wstack-protector as it breaks world with -Werror.
 SSP_CFLAGS?=   -fstack-protector-strong
 CFLAGS+=       ${SSP_CFLAGS}
+.endif
 .endif # SSP && !ARM && !MIPS
 
 # Allow user-specified additional warning flags, plus compiler specific flag overrides.