1 |
commit: 80732e30b491ef045fab6c0be2f8d4b7ac4ad3a4 |
2 |
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Feb 26 08:02:23 2021 +0000 |
4 |
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Feb 26 08:04:39 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=80732e30 |
7 |
|
8 |
sys-devel/gdb: fix 'cet' detection on i586 |
9 |
|
10 |
Reported-by: Worx |
11 |
Bug: https://bugs.gentoo.org/771765 |
12 |
Package-Manager: Portage-3.0.15, Repoman-3.0.2 |
13 |
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org> |
14 |
|
15 |
sys-devel/gdb/files/gdb-10.1-cet.patch | 103 +++++++++++++++++++++++++++++++++ |
16 |
sys-devel/gdb/gdb-10.1.ebuild | 1 + |
17 |
2 files changed, 104 insertions(+) |
18 |
|
19 |
diff --git a/sys-devel/gdb/files/gdb-10.1-cet.patch b/sys-devel/gdb/files/gdb-10.1-cet.patch |
20 |
new file mode 100644 |
21 |
index 00000000000..7477ff90ac9 |
22 |
--- /dev/null |
23 |
+++ b/sys-devel/gdb/files/gdb-10.1-cet.patch |
24 |
@@ -0,0 +1,103 @@ |
25 |
+https://bugs.gentoo.org/771765 |
26 |
+https://sourceware.org/PR27397 |
27 |
+ |
28 |
+On i586-like CPUs endbr32 added by -Wl,-z,ibt,-z,shstk |
29 |
+generates crashing binaries and causes ./configure failure. |
30 |
+ |
31 |
+From 847e4b3207f97762dc641db8d3b188081c3370c3 Mon Sep 17 00:00:00 2001 |
32 |
+From: "H.J. Lu" <hjl.tools@×××××.com> |
33 |
+Date: Fri, 12 Feb 2021 16:30:23 -0800 |
34 |
+Subject: [PATCH] GCC_CET_HOST_FLAGS: Check if host supports multi-byte NOPs |
35 |
+ |
36 |
+--- |
37 |
+ config/cet.m4 | 19 ++++++++++++++++--- |
38 |
+ libiberty/configure | 29 +++++++++++++++++++++++++++++ |
39 |
+ 2 files changed, 45 insertions(+), 3 deletions(-) |
40 |
+ |
41 |
+diff --git a/config/cet.m4 b/config/cet.m4 |
42 |
+index c67fb4f35b6..7718be1afe8 100644 |
43 |
+--- a/config/cet.m4 |
44 |
++++ b/config/cet.m4 |
45 |
+@@ -130,6 +130,18 @@ fi |
46 |
+ if test x$may_have_cet = xyes; then |
47 |
+ if test x$cross_compiling = xno; then |
48 |
+ AC_TRY_RUN([ |
49 |
++int |
50 |
++main () |
51 |
++{ |
52 |
++ asm ("endbr32"); |
53 |
++ return 0; |
54 |
++} |
55 |
++ ], |
56 |
++ [have_multi_byte_nop=yes], |
57 |
++ [have_multi_byte_nop=no]) |
58 |
++ have_cet=no |
59 |
++ if test x$have_multi_byte_nop = xyes; then |
60 |
++ AC_TRY_RUN([ |
61 |
+ static void |
62 |
+ foo (void) |
63 |
+ { |
64 |
+@@ -155,9 +167,10 @@ main () |
65 |
+ bar (); |
66 |
+ return 0; |
67 |
+ } |
68 |
+- ], |
69 |
+- [have_cet=no], |
70 |
+- [have_cet=yes]) |
71 |
++ ], |
72 |
++ [have_cet=no], |
73 |
++ [have_cet=yes]) |
74 |
++ fi |
75 |
+ if test x$enable_cet = xno -a x$have_cet = xyes; then |
76 |
+ AC_MSG_ERROR([Intel CET must be enabled on Intel CET enabled host]) |
77 |
+ fi |
78 |
+diff --git a/libiberty/configure b/libiberty/configure |
79 |
+index 160b8c9e8b1..29a690d44fc 100755 |
80 |
+--- a/libiberty/configure |
81 |
++++ b/libiberty/configure |
82 |
+@@ -5539,6 +5539,34 @@ else |
83 |
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext |
84 |
+ /* end confdefs.h. */ |
85 |
+ |
86 |
++int |
87 |
++main () |
88 |
++{ |
89 |
++ asm ("endbr32"); |
90 |
++ return 0; |
91 |
++} |
92 |
++ |
93 |
++_ACEOF |
94 |
++if ac_fn_c_try_run "$LINENO"; then : |
95 |
++ have_multi_byte_nop=yes |
96 |
++else |
97 |
++ have_multi_byte_nop=no |
98 |
++fi |
99 |
++rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ |
100 |
++ conftest.$ac_objext conftest.beam conftest.$ac_ext |
101 |
++fi |
102 |
++ |
103 |
++ have_cet=no |
104 |
++ if test x$have_multi_byte_nop = xyes; then |
105 |
++ if test "$cross_compiling" = yes; then : |
106 |
++ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 |
107 |
++$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} |
108 |
++as_fn_error $? "cannot run test program while cross compiling |
109 |
++See \`config.log' for more details" "$LINENO" 5; } |
110 |
++else |
111 |
++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext |
112 |
++/* end confdefs.h. */ |
113 |
++ |
114 |
+ static void |
115 |
+ foo (void) |
116 |
+ { |
117 |
+@@ -5575,6 +5603,7 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ |
118 |
+ conftest.$ac_objext conftest.beam conftest.$ac_ext |
119 |
+ fi |
120 |
+ |
121 |
++ fi |
122 |
+ if test x$enable_cet = xno -a x$have_cet = xyes; then |
123 |
+ as_fn_error $? "Intel CET must be enabled on Intel CET enabled host" "$LINENO" 5 |
124 |
+ fi |
125 |
+-- |
126 |
+2.29.2 |
127 |
+ |
128 |
|
129 |
diff --git a/sys-devel/gdb/gdb-10.1.ebuild b/sys-devel/gdb/gdb-10.1.ebuild |
130 |
index 68826d3db64..f3521cbb070 100644 |
131 |
--- a/sys-devel/gdb/gdb-10.1.ebuild |
132 |
+++ b/sys-devel/gdb/gdb-10.1.ebuild |
133 |
@@ -84,6 +84,7 @@ BDEPEND=" |
134 |
|
135 |
PATCHES=( |
136 |
"${FILESDIR}"/${PN}-8.3.1-verbose-build.patch |
137 |
+ "${FILESDIR}"/${PN}-10.1-cet.patch |
138 |
) |
139 |
|
140 |
pkg_setup() { |