commit:     8a2668b938264825869a7a0c6c7ac0799156cf96
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 24 01:26:18 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jun 24 01:26:18 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8a2668b9

sys-libs/glibc: pass -fcf-protection=none based on CTARGET

Closes: https://bugs.gentoo.org/932250
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.39-r6.ebuild | 13 ++++++++-----
 sys-libs/glibc/glibc-2.39-r7.ebuild | 13 ++++++++-----
 sys-libs/glibc/glibc-2.39-r9.ebuild | 13 ++++++++-----
 sys-libs/glibc/glibc-9999.ebuild    | 13 ++++++++-----
 4 files changed, 32 insertions(+), 20 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.39-r6.ebuild 
b/sys-libs/glibc/glibc-2.39-r6.ebuild
index 6772a8cdcc8b..d4820cc75723 100644
--- a/sys-libs/glibc/glibc-2.39-r6.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r6.ebuild
@@ -522,11 +522,14 @@ setup_flags() {
        # dealing with CET in ld.so. So if CET is supposed to be
        # disabled for glibc, be explicit about it.
        if ! use cet; then
-               if use amd64 || use x86; then
-                       append-flags '-fcf-protection=none'
-               elif use arm64; then
-                       append-flags '-mbranch-protection=none'
-               fi
+               case ${ABI}-${CTARGET} in
+                       amd64-x86_64-*|x32-x86_64-*-*-gnux32)
+                               append-flags '-fcf-protection=none'
+                               ;;
+                       arm64-aarch64*)
+                               append-flags '-mbranch-protection=none'
+                               ;;
+               esac
        fi
 }
 

diff --git a/sys-libs/glibc/glibc-2.39-r7.ebuild 
b/sys-libs/glibc/glibc-2.39-r7.ebuild
index ceafcc6e5084..90f211bebf68 100644
--- a/sys-libs/glibc/glibc-2.39-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r7.ebuild
@@ -522,11 +522,14 @@ setup_flags() {
        # dealing with CET in ld.so. So if CET is supposed to be
        # disabled for glibc, be explicit about it.
        if ! use cet; then
-               if use amd64 || use x86; then
-                       append-flags '-fcf-protection=none'
-               elif use arm64; then
-                       append-flags '-mbranch-protection=none'
-               fi
+               case ${ABI}-${CTARGET} in
+                       amd64-x86_64-*|x32-x86_64-*-*-gnux32)
+                               append-flags '-fcf-protection=none'
+                               ;;
+                       arm64-aarch64*)
+                               append-flags '-mbranch-protection=none'
+                               ;;
+               esac
        fi
 }
 

diff --git a/sys-libs/glibc/glibc-2.39-r9.ebuild 
b/sys-libs/glibc/glibc-2.39-r9.ebuild
index e6650fa8057d..da579ed2837b 100644
--- a/sys-libs/glibc/glibc-2.39-r9.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r9.ebuild
@@ -515,11 +515,14 @@ setup_flags() {
        # dealing with CET in ld.so. So if CET is supposed to be
        # disabled for glibc, be explicit about it.
        if ! use cet; then
-               if use amd64 || use x86; then
-                       append-flags '-fcf-protection=none'
-               elif use arm64; then
-                       append-flags '-mbranch-protection=none'
-               fi
+               case ${ABI}-${CTARGET} in
+                       amd64-x86_64-*|x32-x86_64-*-*-gnux32)
+                               append-flags '-fcf-protection=none'
+                               ;;
+                       arm64-aarch64*)
+                               append-flags '-mbranch-protection=none'
+                               ;;
+               esac
        fi
 }
 

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 270b0a868557..a1512de95b17 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -515,11 +515,14 @@ setup_flags() {
        # dealing with CET in ld.so. So if CET is supposed to be
        # disabled for glibc, be explicit about it.
        if ! use cet; then
-               if use amd64 || use x86; then
-                       append-flags '-fcf-protection=none'
-               elif use arm64; then
-                       append-flags '-mbranch-protection=none'
-               fi
+               case ${ABI}-${CTARGET} in
+                       amd64-x86_64-*|x32-x86_64-*-*-gnux32)
+                               append-flags '-fcf-protection=none'
+                               ;;
+                       arm64-aarch64*)
+                               append-flags '-mbranch-protection=none'
+                               ;;
+               esac
        fi
 }
 

Reply via email to