commit:     414f21a6b310ec7d4e0885dd7ac5e379cd49dfe2
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 18 10:18:07 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Dec 18 10:21:20 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=414f21a6

sys-libs/glibc: ignore CFLAGS+LDFLAGS in do_run_test for binpkgs

With binpkgs, CFLAGS and LDFLAGS will come from the builder environment
and may not be compatible with an old glibc on the system before a new
one is merged.

In the case reported to me by Kerin, an old glibc was installed w/o
DT_RELR support, and LDFLAGS on the binhost builder had 
-Wl,-z,pack-relative-relocs,
so the built test binary (which would run against the system's old glibc)
couldn't be executed, meaning the "syscall test" failed.

Set CFLAGS to just -O2 and blank LDFLAGS to avoid this.

It did also wrongly diagnose the failure because the function both
compiles + runs and the error message can't distinguish between those. If
we fail to build it, things are likely fine, there's only a problem if we
fail to run it. I haven't addressed that here.

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

 sys-libs/glibc/glibc-2.42-r2.ebuild | 2 +-
 sys-libs/glibc/glibc-9999.ebuild    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.42-r2.ebuild 
b/sys-libs/glibc/glibc-2.42-r2.ebuild
index 25498b338615..3d1194e0e022 100644
--- a/sys-libs/glibc/glibc-2.42-r2.ebuild
+++ b/sys-libs/glibc/glibc-2.42-r2.ebuild
@@ -295,7 +295,7 @@ do_run_test() {
 
        if [[ ${MERGE_TYPE} == "binary" ]] ; then
                # ignore build failures when installing a binary package #324685
-               do_compile_test "" "$@" 2>/dev/null || return 0
+               CFLAGS="-O2" LDFLAGS="" do_compile_test "" "$@" 2>/dev/null || 
return 0
        else
                ebegin "Performing simple compile test for ABI=${ABI}"
                if ! do_compile_test "" "$@" ; then

diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index af95e206646e..095b33bd38e5 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -295,7 +295,7 @@ do_run_test() {
 
        if [[ ${MERGE_TYPE} == "binary" ]] ; then
                # ignore build failures when installing a binary package #324685
-               do_compile_test "" "$@" 2>/dev/null || return 0
+               CFLAGS="-O2" LDFLAGS="" do_compile_test "" "$@" 2>/dev/null || 
return 0
        else
                ebegin "Performing simple compile test for ABI=${ABI}"
                if ! do_compile_test "" "$@" ; then

Reply via email to