summaryrefslogtreecommitdiff
path: root/config/cet.m4
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2018-01-16 16:46:51 -0800
committerH.J. Lu <hjl.tools@gmail.com>2018-01-16 16:46:51 -0800
commitd77a5ebe0c1683f4f95b11718df53f8b51fd2833 (patch)
treeb665bf4c9da0ca133ef6261e4a7fc945c04b189a /config/cet.m4
parent69ac5e6150ff3db96156a17f93382f9ef9438611 (diff)
downloadgcc-d77a5ebe0c1683f4f95b11718df53f8b51fd2833.tar.gz
Add --enable-cet-propertyhjl/cet/master
CET is enabled by run-time loader only if all modules have CET property: [hjl@gnu-tools-1 gcc]$ readelf -n crtbegin.o Displaying notes found in: .note.gnu.property Owner Data size Description GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 Properties: x86 feature: IBT, SHSTK [hjl@gnu-tools-1 gcc]$ Linker will create CET property only if all input object files have CET property. To create GCC run-time libraries with CET property, CET enabled glibc must be used to build GCC. We can add --enable-cet-property to GCC, which will pass "-z ibt -z shstk" to linker when creating target run-time libraries. We only need it for libgcc and libstdc++, which are used to build and test glibc. config/ PR target/83910 * cet.m4 (GCC_CET_LDFLAGS): New to support --enable-cet-property. libgcc/ PR target/83910 * Makefile.in (CET_LDFLAGS): New. * configure.ac (CET_LDFLAGS): New AC_SUBST. * configure: Regenerated. * config/i386/t-linux (SHLIB_LDFLAGS): Append $(CET_LDFLAGS). libgcc/ PR target/83910 * configure.ac (CET_LDFLAGS): New AC_SUBST. * configure: Regenerated. * src/Makefile.am (CXXLINK): Add $(CET_LDFLAGS). * src/Makefile.in: Regenerated.
Diffstat (limited to 'config/cet.m4')
-rw-r--r--config/cet.m421
1 files changed, 21 insertions, 0 deletions
diff --git a/config/cet.m4 b/config/cet.m4
index 715f4bded19..df4fcc1def2 100644
--- a/config/cet.m4
+++ b/config/cet.m4
@@ -36,3 +36,24 @@ if test x$enable_cet = xyes; then
$1="-fcf-protection -mcet"
fi
])
+
+AC_DEFUN([GCC_CET_LDFLAGS],[dnl
+GCC_ENABLE(cet-property, no, ,[enable Intel CET property in target libraries],
+ permit yes|no|default)
+case "$host" in
+ i[[34567]]86-*-linux* | x86_64-*-linux*)
+ if test x$enable_cet_property = xyes; then
+ # Check if CET is enabled.
+ if test x$enable_cet != xyes; then
+ AC_MSG_ERROR([CET must be enabled for --enable-cet-property])
+ fi
+ fi
+ ;;
+ *)
+ enable_cet_property=no
+ ;;
+esac
+if test x$enable_cet_property = xyes; then
+ $1="-Wl,-z,ibt,-z,shstk"
+fi
+])