diff options
author | Igor Tsimbalist <igor.v.tsimbalist@intel.com> | 2017-11-17 14:34:39 +0100 |
---|---|---|
committer | Igor Tsimbalist <itsimbal@gcc.gnu.org> | 2017-11-17 14:34:39 +0100 |
commit | 1ecae1fc238a6b02b3cc2de6a24d73966bc45a03 (patch) | |
tree | daa0015bf7667568564bbd9abcd7fbe77ef2942f /libgcc/configure | |
parent | a851ce04f7050dd82aa8344e7b68ee8319fb7b6f (diff) | |
download | gcc-1ecae1fc238a6b02b3cc2de6a24d73966bc45a03.zip gcc-1ecae1fc238a6b02b3cc2de6a24d73966bc45a03.tar.gz gcc-1ecae1fc238a6b02b3cc2de6a24d73966bc45a03.tar.bz2 |
Enable building libgcc with CET options.
Enable building libgcc with CET options by default on Linux/x86 if
binutils supports CET v2.0. It can be disabled with --disable-cet.
It is an error to configure GCC with --enable-cet if bintuiils
doesn't support CET v2.0.
ENDBR instruction is added to __morestack_large_model since it is
called indirectly.
2017-11-17 Igor Tsimbalist <igor.v.tsimbalist@intel.com>
config/
* cet.m4: New file.
gcc/
* config.gcc (extra_headers): Add cet.h for x86 targets.
* config/i386/cet.h: New file.
* doc/install.texi: Add --enable-cet/--disable-cet.
libgcc/
* Makefile.in (configure_deps): Add $(srcdir)/../config/cet.m4.
(CET_FLAGS): New.
* config/i386/morestack.S: Include <cet.h>.
(__morestack_large_model): Add _CET_ENDBR at function entrance.
* config/i386/resms64.h: Include <cet.h>.
* config/i386/resms64f.h: Likewise.
* config/i386/resms64fx.h: Likewise.
* config/i386/resms64x.h: Likewise.
* config/i386/savms64.h: Likewise.
* config/i386/savms64f.h: Likewise.
* config/i386/t-linux (HOST_LIBGCC2_CFLAGS): Add $(CET_FLAGS).
(CRTSTUFF_T_CFLAGS): Likewise.
* configure.ac: Include ../config/cet.m4.
Set and substitute CET_FLAGS.
* configure: Regenerated.
From-SVN: r254868
Diffstat (limited to 'libgcc/configure')
-rw-r--r-- | libgcc/configure | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/libgcc/configure b/libgcc/configure index 20169b1..38a28c2 100644 --- a/libgcc/configure +++ b/libgcc/configure @@ -573,6 +573,7 @@ vis_hide real_host_noncanonical accel_dir_suffix force_explicit_eh_registry +CET_FLAGS fixed_point enable_decimal_float decimal_float @@ -675,6 +676,7 @@ with_build_libsubdir enable_largefile enable_decimal_float with_system_libunwind +enable_cet enable_explicit_exception_frame_registration with_glibc_version enable_tls @@ -1314,6 +1316,8 @@ Optional Features: enable decimal float extension to C. Selecting 'bid' or 'dpd' choses which decimal floating point format to use + --enable-cet enable Intel CET in target libraries + [default=default] --enable-explicit-exception-frame-registration register exception tables explicitly at module start, for use e.g. for compatibility with @@ -4773,6 +4777,74 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sjlj_exceptions" >&5 $as_echo "$ac_cv_sjlj_exceptions" >&6; } + # Check whether --enable-cet was given. +if test "${enable_cet+set}" = set; then : + enableval=$enable_cet; + case "$enableval" in + yes|no|default) ;; + *) as_fn_error "Unknown argument to enable/disable cet" "$LINENO" 5 ;; + esac + +else + enable_cet=default +fi + + +case "$host" in + i[34567]86-*-linux* | x86_64-*-linux*) + case "$enable_cet" in + default) + # Check if assembler supports CET. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +asm ("setssbsy"); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + enable_cet=yes +else + enable_cet=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ;; + yes) + # Check if assembler supports CET. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +asm ("setssbsy"); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + as_fn_error "assembler with CET support is required for --enable-cet" "$LINENO" 5 +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ;; + esac + ;; + *) + enable_cet=no + ;; +esac +if test x$enable_cet = xyes; then + CET_FLAGS="-fcf-protection -mcet" +fi + + + # Check whether --enable-explicit-exception-frame-registration was given. if test "${enable_explicit_exception_frame_registration+set}" = set; then : enableval=$enable_explicit_exception_frame_registration; |