crosstool-ng/packages/glibc/2.29/0002-x86-Assume-enable-cet-if-GCC-defaults-to-CET-BZ-2522.patch
Alexey Neyman 86c2982568 Run patches thru manage-packages -P
This refreshes the line numbers, removes any fuzz (which would make any
future forward ports easier) and standardizes the patch/file headers
(which makes them easier to read).

Signed-off-by: Alexey Neyman <stilor@att.net>
2022-02-11 00:47:51 -08:00

75 lines
2.0 KiB
Diff

From 0b4c3e1e0b8656149d4556d2f81a2958426ebc94 Mon Sep 17 00:00:00 2001
From: Florian Weimer <fweimer@redhat.com>
Date: Tue, 3 Dec 2019 21:08:49 +0100
Subject: [PATCH] x86: Assume --enable-cet if GCC defaults to CET [BZ #25225]
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.
(cherry picked from commit 9fb8139079ef0bb1aa33a4ae418cbb113b9b9da7)
---
configure | 23 ++++++++++++++++++++++-
configure.ac | 9 ++++++++-
2 files changed, 30 insertions(+), 2 deletions(-)
--- a/configure
+++ b/configure
@@ -3777,11 +3777,32 @@
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
--- a/configure.ac
+++ b/configure.ac
@@ -472,11 +472,18 @@
[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