summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2018-04-08 20:28:37 +0000
committeremaste <emaste@FreeBSD.org>2018-04-08 20:28:37 +0000
commit7dbd5eee062b4d1f1ace1162c866c8c65b390760 (patch)
tree519a0684006eb7d663b5e05bc007400b712f2284 /share
parentfbfeda2489a09bb11113511e18dbab2f8e91240c (diff)
downloadFreeBSD-src-7dbd5eee062b4d1f1ace1162c866c8c65b390760.zip
FreeBSD-src-7dbd5eee062b4d1f1ace1162c866c8c65b390760.tar.gz
MFC r328972: add retpoline compiler and linker feature flags
These features indicate that the compiler and linker support the retpoline speculative execution vulnerability (CVE-2017-5715) mitigation.
Diffstat (limited to 'share')
-rw-r--r--share/mk/bsd.compiler.mk12
-rw-r--r--share/mk/bsd.linker.mk7
2 files changed, 14 insertions, 5 deletions
diff --git a/share/mk/bsd.compiler.mk b/share/mk/bsd.compiler.mk
index b562415..086087c 100644
--- a/share/mk/bsd.compiler.mk
+++ b/share/mk/bsd.compiler.mk
@@ -19,7 +19,9 @@
# COMPILER_FEATURES will contain one or more of the following, based on
# compiler support for that feature:
#
-# - c++11 : supports full (or nearly full) C++11 programming environment.
+# - c++11: supports full (or nearly full) C++11 programming environment.
+# - retpoline: supports the retpoline speculative execution vulnerability
+# mitigation.
#
# These variables with an X_ prefix will also be provided if XCC is set.
#
@@ -168,11 +170,13 @@ ${X_}COMPILER_FREEBSD_VERSION= unknown
.endif
.endif
+${X_}COMPILER_FEATURES=
.if ${${X_}COMPILER_TYPE} == "clang" || \
(${${X_}COMPILER_TYPE} == "gcc" && ${${X_}COMPILER_VERSION} >= 40800)
-${X_}COMPILER_FEATURES= c++11
-.else
-${X_}COMPILER_FEATURES=
+${X_}COMPILER_FEATURES+= c++11
+.endif
+.if ${${X_}COMPILER_TYPE} == "clang" && ${${X_}COMPILER_VERSION} >= 60000
+${X_}COMPILER_FEATURES+= retpoline
.endif
.else
diff --git a/share/mk/bsd.linker.mk b/share/mk/bsd.linker.mk
index 2110423..d4ab693 100644
--- a/share/mk/bsd.linker.mk
+++ b/share/mk/bsd.linker.mk
@@ -12,7 +12,9 @@
# LINKER_FEATURES may contain one or more of the following, based on
# linker support for that feature:
#
-# - build-id : support for generating a Build-ID note
+# - build-id: support for generating a Build-ID note
+# - retpoline: support for generating PLT with retpoline speculative
+# execution vulnerability mitigation
#
# These variables with an X_ prefix will also be provided if XLD is set.
#
@@ -73,6 +75,9 @@ ${X_}LINKER_FEATURES+= build-id
.if ${${X_}LINKER_TYPE} != "lld" || ${${X_}LINKER_VERSION} >= 50000
${X_}LINKER_FEATURES+= filter
.endif
+.if ${${X_}LINKER_TYPE} == "lld" && ${${X_}LINKER_VERSION} >= 60000
+${X_}LINKER_FEATURES+= retpoline
+.endif
.endif
.else
# Use LD's values
OpenPOWER on IntegriCloud