commit:     f43c7cd9e5a92d784af5e21ba22083cdb70c0e51
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Fri May 15 23:11:54 2020 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Fri May 15 23:12:14 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f43c7cd9

sys-libs/glibc: avoid GPREL overflow on ia64, bug #723268

-fno-common had unintended side-effect to optimise more
accesses to global variables as module-local via GPREL22
relocations. Unfortunately glibc is large enough to overflow
GPREL22 offset.

Let's add a -fcommon workaround back to pessimize code slightly
that refers module-local globals. We'll need an equivalen of
-fPIC to do it consistently.

Bug: https://bugs.gentoo.org/723268
Package-Manager: Portage-2.3.99, Repoman-2.3.22
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 sys-libs/glibc/glibc-2.30-r8.ebuild | 6 ++++++
 sys-libs/glibc/glibc-2.31-r3.ebuild | 6 ++++++
 sys-libs/glibc/glibc-9999.ebuild    | 6 ++++++
 3 files changed, 18 insertions(+)

diff --git a/sys-libs/glibc/glibc-2.30-r8.ebuild 
b/sys-libs/glibc/glibc-2.30-r8.ebuild
index aea0098e69f..0421d5e61db 100644
--- a/sys-libs/glibc/glibc-2.30-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.30-r8.ebuild
@@ -305,6 +305,12 @@ setup_target_flags() {
                                einfo "Auto adding -march=${t} to CFLAGS_x86 
#185404 (ABI=${ABI})"
                        fi
                ;;
+               ia64)
+                       # Workaround GPREL22 overflow by slightly pessimizing 
global
+                       # references to go via 64-bit relocations instead of 
22-bit ones.
+                       # This allows building glibc on ia64 without an 
overflow: #723268
+                       append-flags -fcommon
+               ;;
                mips)
                        # The mips abi cannot support the GNU style hashes. 
#233233
                        filter-ldflags -Wl,--hash-style=gnu 
-Wl,--hash-style=both

diff --git a/sys-libs/glibc/glibc-2.31-r3.ebuild 
b/sys-libs/glibc/glibc-2.31-r3.ebuild
index c05055b8811..5580625ba6d 100644
--- a/sys-libs/glibc/glibc-2.31-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r3.ebuild
@@ -299,6 +299,12 @@ setup_target_flags() {
                                einfo "Auto adding -march=${t} to CFLAGS_x86 
#185404 (ABI=${ABI})"
                        fi
                ;;
+               ia64)
+                       # Workaround GPREL22 overflow by slightly pessimizing 
global
+                       # references to go via 64-bit relocations instead of 
22-bit ones.
+                       # This allows building glibc on ia64 without an 
overflow: #723268
+                       append-flags -fcommon
+               ;;
                mips)
                        # The mips abi cannot support the GNU style hashes. 
#233233
                        filter-ldflags -Wl,--hash-style=gnu 
-Wl,--hash-style=both

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index bba57f5d607..2355e5bce34 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -298,6 +298,12 @@ setup_target_flags() {
                                einfo "Auto adding -march=${t} to CFLAGS_x86 
#185404 (ABI=${ABI})"
                        fi
                ;;
+               ia64)
+                       # Workaround GPREL22 overflow by slightly pessimizing 
global
+                       # references to go via 64-bit relocations instead of 
22-bit ones.
+                       # This allows building glibc on ia64 without an 
overflow: #723268
+                       append-flags -fcommon
+               ;;
                mips)
                        # The mips abi cannot support the GNU style hashes. 
#233233
                        filter-ldflags -Wl,--hash-style=gnu 
-Wl,--hash-style=both

Reply via email to