]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
x86: Assume --enable-cet if GCC defaults to CET [BZ #25225]
authorFlorian Weimer <fweimer@redhat.com>
Tue, 3 Dec 2019 19:26:28 +0000 (20:26 +0100)
committerFlorian Weimer <fweimer@redhat.com>
Tue, 3 Dec 2019 19:26:28 +0000 (20:26 +0100)
This links in CET support if GCC defaults to CET.  Otherwise, __CET__
is defined, yet CET functionality is not compiled and linked into the
dynamic loader, resulting in a linker failure due to undefined
references to _dl_cet_check and _dl_open_check.

NEWS
configure
configure.ac

diff --git a/NEWS b/NEWS
index 1f60f3eb197699e0ede2535aa77ab69c815b2a7f..a02fa10df9b6b41188a83a0be53a4e3a4c37dfe5 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -25,6 +25,7 @@ The following bugs are resolved with this release:
   [25189] Don't use a custom wrapper macro around __has_include
   [25203] libio: Disable vtable validation for pre-2.1 interposed handles
   [25204] Ignore LD_PREFER_MAP_32BIT_EXEC for SUID programs
+  [25225] ld.so fails to link on x86 if GCC defaults to -fcf-protection
 
 \f
 Version 2.30
index c773c487b542b3beb12fa2c70c8ea123b7bee5cd..6d26b8246f2d8f7004a43f266c169488c3eb3632 100755 (executable)
--- a/configure
+++ b/configure
@@ -3777,11 +3777,32 @@ else
 fi
 
 
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+#ifndef __CET__
+#error no CET compiler support
+#endif
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  libc_cv_compiler_default_cet=yes
+else
+  libc_cv_compiler_default_cet=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
 # Check whether --enable-cet was given.
 if test "${enable_cet+set}" = set; then :
   enableval=$enable_cet; enable_cet=$enableval
 else
-  enable_cet=no
+  enable_cet=$libc_cv_compiler_default_cet
 fi
 
 
index 598ba6c4aed08a3bcced95577a39c48dfef69dc1..7436485419a953ed0bee4c956aff6eaeb9c6d730 100644 (file)
@@ -472,11 +472,18 @@ AC_ARG_ENABLE([mathvec],
              [build_mathvec=$enableval],
              [build_mathvec=notset])
 
+AC_TRY_COMPILE([], [
+#ifndef __CET__
+# error no CET compiler support
+#endif],
+              [libc_cv_compiler_default_cet=yes],
+              [libc_cv_compiler_default_cet=no])
+
 AC_ARG_ENABLE([cet],
              AC_HELP_STRING([--enable-cet],
                             [enable Intel Control-flow Enforcement Technology (CET), x86 only]),
              [enable_cet=$enableval],
-             [enable_cet=no])
+             [enable_cet=$libc_cv_compiler_default_cet])
 
 # We keep the original values in `$config_*' and never modify them, so we
 # can write them unchanged into config.make.  Everything else uses