From 02aa6328a720c86d0157c4582f7e5bac72ae9296 Mon Sep 17 00:00:00 2001 From: James Le Cuirot Date: Sat, 11 Jun 2022 22:11:12 +0100 Subject: sys-libs/glibc: Add stack-realign flag for compat with old 32-bit x86 binaries Older 32-bit x86 binaries aligned the stack to 4 bytes, whereas modern binaries align to 16 bytes. These older binaries sometimes segfault when newer libraries use SSE instructions. This is becoming increasingly common. Applying the -mstackrealign flag to the 32-bit build works around the issue but at a performance cost. Other popular distributions always apply this. [sam: There's no good choices here. As Ionen pointed out (I'd missed any reports of this), this ends up getting worse with GCC 12's default-on vectorisation at -O2. Let's make it optional for now for 32-bit/x86 (irrelevant for other arches, it's specific to x86 ABI). ncurses is going to need similar treatment. If we end up having to do this for far more packages, we may revisit and e.g. just append-flags in ebuilds for right ABI and tell users to set -mno-stackrealign, or similar. Another option would be to set this globally by default (again, this is only ever for x86), but it'd possibly be a big performance hit (and bad enough doing it in glibc, but it's unavoidable). The only saving grace here is that there aren't _that_ many libraries with such longevity & ABI stability from back then that older applications are using.] Bug: https://bugs.gentoo.org/616402 Bug: https://github.com/taviso/123elf/issues/12 Signed-off-by: James Le Cuirot Closes: https://github.com/gentoo/gentoo/pull/25858 Signed-off-by: Sam James --- sys-libs/glibc/metadata.xml | 1 + 1 file changed, 1 insertion(+) (limited to 'sys-libs/glibc/metadata.xml') diff --git a/sys-libs/glibc/metadata.xml b/sys-libs/glibc/metadata.xml index e00a008ac5c3..bcaf604fa542 100644 --- a/sys-libs/glibc/metadata.xml +++ b/sys-libs/glibc/metadata.xml @@ -17,6 +17,7 @@ Provide prebuilt libgcc.a and crt files if missing. Only needed for ABI switch. Build, and enable support for, the Name Service Cache Daemon protect stack of glibc internals + Realign the stack in the 32-bit build for compatibility with older binaries at slight performance cost Enable static PIE support (runtime files for -static-pie gcc option). Make internal pt_chown helper setuid -- not needed if using Linux and have /dev/pts mounted with gid=5 enable systemtap static probe points -- cgit v1.2.3-65-gdbad