public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sergei Trofimovich" <slyfox@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-devel/binutils/files/, sys-devel/binutils/
Date: Fri, 26 Feb 2021 08:04:46 +0000 (UTC)	[thread overview]
Message-ID: <1614326677.c4e8d909d36eae58cc8aa9e69259179d666b1458.slyfox@gentoo> (raw)

commit:     c4e8d909d36eae58cc8aa9e69259179d666b1458
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 26 07:56:43 2021 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri Feb 26 08:04:37 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c4e8d909

sys-devel/binutils: fix 'cet' detection on i586

Reported-by: Worx
Bug: https://bugs.gentoo.org/771765
Package-Manager: Portage-3.0.15, Repoman-3.0.2
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-devel/binutils/binutils-2.35.1-r1.ebuild       |   2 +
 sys-devel/binutils/binutils-2.35.2.ebuild          |   2 +
 sys-devel/binutils/binutils-2.36.1.ebuild          |   2 +
 sys-devel/binutils/files/binutils-2.35.1-cet.patch | 103 +++++++++++++++++++++
 4 files changed, 109 insertions(+)

diff --git a/sys-devel/binutils/binutils-2.35.1-r1.ebuild b/sys-devel/binutils/binutils-2.35.1-r1.ebuild
index feee11a5ded..18c80a28f88 100644
--- a/sys-devel/binutils/binutils-2.35.1-r1.ebuild
+++ b/sys-devel/binutils/binutils-2.35.1-r1.ebuild
@@ -68,6 +68,8 @@ BDEPEND="
 
 RESTRICT="!test? ( test )"
 
+PATCHES=("${FILESDIR}"/${PN}-2.35.1-cet.patch)
+
 MY_BUILDDIR=${WORKDIR}/build
 
 src_unpack() {

diff --git a/sys-devel/binutils/binutils-2.35.2.ebuild b/sys-devel/binutils/binutils-2.35.2.ebuild
index 2aff2770014..215e42f2c73 100644
--- a/sys-devel/binutils/binutils-2.35.2.ebuild
+++ b/sys-devel/binutils/binutils-2.35.2.ebuild
@@ -67,6 +67,8 @@ BDEPEND="
 
 RESTRICT="!test? ( test )"
 
+PATCHES=("${FILESDIR}"/${PN}-2.35.1-cet.patch)
+
 MY_BUILDDIR=${WORKDIR}/build
 
 src_unpack() {

diff --git a/sys-devel/binutils/binutils-2.36.1.ebuild b/sys-devel/binutils/binutils-2.36.1.ebuild
index 3d820fcc6f8..95875f24d78 100644
--- a/sys-devel/binutils/binutils-2.36.1.ebuild
+++ b/sys-devel/binutils/binutils-2.36.1.ebuild
@@ -67,6 +67,8 @@ BDEPEND="
 
 RESTRICT="!test? ( test )"
 
+PATCHES=("${FILESDIR}"/${PN}-2.35.1-cet.patch)
+
 MY_BUILDDIR=${WORKDIR}/build
 
 src_unpack() {

diff --git a/sys-devel/binutils/files/binutils-2.35.1-cet.patch b/sys-devel/binutils/files/binutils-2.35.1-cet.patch
new file mode 100644
index 00000000000..7477ff90ac9
--- /dev/null
+++ b/sys-devel/binutils/files/binutils-2.35.1-cet.patch
@@ -0,0 +1,103 @@
+https://bugs.gentoo.org/771765
+https://sourceware.org/PR27397
+
+On i586-like CPUs endbr32 added by -Wl,-z,ibt,-z,shstk
+generates crashing binaries and causes ./configure failure.
+
+From 847e4b3207f97762dc641db8d3b188081c3370c3 Mon Sep 17 00:00:00 2001
+From: "H.J. Lu" <hjl.tools@gmail.com>
+Date: Fri, 12 Feb 2021 16:30:23 -0800
+Subject: [PATCH] GCC_CET_HOST_FLAGS: Check if host supports multi-byte NOPs
+
+---
+ config/cet.m4       | 19 ++++++++++++++++---
+ libiberty/configure | 29 +++++++++++++++++++++++++++++
+ 2 files changed, 45 insertions(+), 3 deletions(-)
+
+diff --git a/config/cet.m4 b/config/cet.m4
+index c67fb4f35b6..7718be1afe8 100644
+--- a/config/cet.m4
++++ b/config/cet.m4
+@@ -130,6 +130,18 @@ fi
+ if test x$may_have_cet = xyes; then
+   if test x$cross_compiling = xno; then
+     AC_TRY_RUN([
++int
++main ()
++{
++  asm ("endbr32");
++  return 0;
++}
++    ],
++    [have_multi_byte_nop=yes],
++    [have_multi_byte_nop=no])
++    have_cet=no
++    if test x$have_multi_byte_nop = xyes; then
++      AC_TRY_RUN([
+ static void
+ foo (void)
+ {
+@@ -155,9 +167,10 @@ main ()
+   bar ();
+   return 0;
+ }
+-    ],
+-    [have_cet=no],
+-    [have_cet=yes])
++      ],
++      [have_cet=no],
++      [have_cet=yes])
++    fi
+     if test x$enable_cet = xno -a x$have_cet = xyes; then
+       AC_MSG_ERROR([Intel CET must be enabled on Intel CET enabled host])
+     fi
+diff --git a/libiberty/configure b/libiberty/configure
+index 160b8c9e8b1..29a690d44fc 100755
+--- a/libiberty/configure
++++ b/libiberty/configure
+@@ -5539,6 +5539,34 @@ else
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ 
++int
++main ()
++{
++  asm ("endbr32");
++  return 0;
++}
++
++_ACEOF
++if ac_fn_c_try_run "$LINENO"; then :
++  have_multi_byte_nop=yes
++else
++  have_multi_byte_nop=no
++fi
++rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
++  conftest.$ac_objext conftest.beam conftest.$ac_ext
++fi
++
++    have_cet=no
++    if test x$have_multi_byte_nop = xyes; then
++      if test "$cross_compiling" = yes; then :
++  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
++$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
++as_fn_error $? "cannot run test program while cross compiling
++See \`config.log' for more details" "$LINENO" 5; }
++else
++  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++
+ static void
+ foo (void)
+ {
+@@ -5575,6 +5603,7 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+   conftest.$ac_objext conftest.beam conftest.$ac_ext
+ fi
+ 
++    fi
+     if test x$enable_cet = xno -a x$have_cet = xyes; then
+       as_fn_error $? "Intel CET must be enabled on Intel CET enabled host" "$LINENO" 5
+     fi
+-- 
+2.29.2
+


             reply	other threads:[~2021-02-26  8:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-26  8:04 Sergei Trofimovich [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-03-23 16:02 [gentoo-commits] repo/gentoo:master commit in: sys-devel/binutils/files/, sys-devel/binutils/ Sam James
2023-02-22 22:26 Sam James
2022-08-10 15:02 Maciej Barć
2020-07-25 11:32 Andreas K. Hüttel
2020-03-09 20:07 Sergei Trofimovich
2020-02-03  9:50 Sergei Trofimovich
2018-07-17 14:26 Andreas Hüttel
2018-07-17 14:20 Andreas Hüttel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1614326677.c4e8d909d36eae58cc8aa9e69259179d666b1458.slyfox@gentoo \
    --to=slyfox@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox