commit:     8adde117f4abc70c3ae8cd7b9d50c24e3a9e3eb8
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 30 16:47:35 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jul 30 16:47:35 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8adde117

sys-devel/binutils: use case on CTARGET instead

'use' isn't reliable for cross.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-devel/binutils/binutils-2.41.ebuild | 44 ++++++++++++++++++---------------
 sys-devel/binutils/binutils-9999.ebuild | 44 ++++++++++++++++++---------------
 2 files changed, 48 insertions(+), 40 deletions(-)

diff --git a/sys-devel/binutils/binutils-2.41.ebuild 
b/sys-devel/binutils/binutils-2.41.ebuild
index 143d9cf7857b..925731fdf56b 100644
--- a/sys-devel/binutils/binutils-2.41.ebuild
+++ b/sys-devel/binutils/binutils-2.41.ebuild
@@ -301,28 +301,32 @@ src_configure() {
                $(use_enable gprofng)
        )
 
-       if use amd64 || use arm64 || use x86 ; then
-               # These hardening options are available from 2.39+ but
-               # they unconditionally enable the behaviour even on arches
-               # where e.g. execstacks can't be avoided.
-               # See https://sourceware.org/bugzilla/show_bug.cgi?id=29592.
-               #
-               # TODO: Get the logic for this fixed upstream so it doesn't
-               # create impossible broken combinations on some arches, like 
mips.
-               #
-               # TODO: Get the logic for this fixed upstream so --disable-* 
works
-               # as expected.
-               myconf+=(
-                       --enable-warn-execstack=yes
-                       --enable-warn-rwx-segments=yes
-               )
-
-               if use hardened ; then
+       case ${CTARGET} in
+               x86_64-*|aarch64*|arm64*|i[3456]*)
+                       # These hardening options are available from 2.39+ but
+                       # they unconditionally enable the behaviour even on 
arches
+                       # where e.g. execstacks can't be avoided.
+                       # See 
https://sourceware.org/bugzilla/show_bug.cgi?id=29592.
+                       #
+                       # TODO: Get the logic for this fixed upstream so it 
doesn't
+                       # create impossible broken combinations on some arches, 
like mips.
+                       #
+                       # TODO: Get the logic for this fixed upstream so 
--disable-* works
+                       # as expected.
                        myconf+=(
-                               --enable-default-execstack=no
+                               --enable-warn-execstack=yes
+                               --enable-warn-rwx-segments=yes
                        )
-               fi
-       fi
+
+                       if use hardened ; then
+                               myconf+=(
+                                       --enable-default-execstack=no
+                               )
+                       fi
+                       ;;
+               *)
+                       ;;
+       esac
 
        if use elibc_musl ; then
                # Override our earlier setting for musl, as textrels don't

diff --git a/sys-devel/binutils/binutils-9999.ebuild 
b/sys-devel/binutils/binutils-9999.ebuild
index 143d9cf7857b..925731fdf56b 100644
--- a/sys-devel/binutils/binutils-9999.ebuild
+++ b/sys-devel/binutils/binutils-9999.ebuild
@@ -301,28 +301,32 @@ src_configure() {
                $(use_enable gprofng)
        )
 
-       if use amd64 || use arm64 || use x86 ; then
-               # These hardening options are available from 2.39+ but
-               # they unconditionally enable the behaviour even on arches
-               # where e.g. execstacks can't be avoided.
-               # See https://sourceware.org/bugzilla/show_bug.cgi?id=29592.
-               #
-               # TODO: Get the logic for this fixed upstream so it doesn't
-               # create impossible broken combinations on some arches, like 
mips.
-               #
-               # TODO: Get the logic for this fixed upstream so --disable-* 
works
-               # as expected.
-               myconf+=(
-                       --enable-warn-execstack=yes
-                       --enable-warn-rwx-segments=yes
-               )
-
-               if use hardened ; then
+       case ${CTARGET} in
+               x86_64-*|aarch64*|arm64*|i[3456]*)
+                       # These hardening options are available from 2.39+ but
+                       # they unconditionally enable the behaviour even on 
arches
+                       # where e.g. execstacks can't be avoided.
+                       # See 
https://sourceware.org/bugzilla/show_bug.cgi?id=29592.
+                       #
+                       # TODO: Get the logic for this fixed upstream so it 
doesn't
+                       # create impossible broken combinations on some arches, 
like mips.
+                       #
+                       # TODO: Get the logic for this fixed upstream so 
--disable-* works
+                       # as expected.
                        myconf+=(
-                               --enable-default-execstack=no
+                               --enable-warn-execstack=yes
+                               --enable-warn-rwx-segments=yes
                        )
-               fi
-       fi
+
+                       if use hardened ; then
+                               myconf+=(
+                                       --enable-default-execstack=no
+                               )
+                       fi
+                       ;;
+               *)
+                       ;;
+       esac
 
        if use elibc_musl ; then
                # Override our earlier setting for musl, as textrels don't

Reply via email to