]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
ld: Compile some tests with -mdirect-extern-access
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 19 Aug 2025 11:59:10 +0000 (04:59 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 20 Aug 2025 20:33:15 +0000 (13:33 -0700)
commitcf03cf4e8879bbfe6b90160ff3fda63feb2a898f
tree618b3e78f7361f102bc5d05c3fd28793f5b8c27d
parent46373d8d659e049f0a4c73a2654911b4c4b8010c
ld: Compile some tests with -mdirect-extern-access

When GCC enables -mno-direct-extern-access by default, some tests fail
without -mdirect-extern-access.  Define DIRECT_EXTERN_ACCESS_CFLAGS
to compile these tests with -mdirect-extern-access.  Also pass
"-z noindirect-extern-access" to linker to support the C library
compiled with -mno-direct-extern-access.

PR ld/33267
* testsuite/config/default.exp (DIRECT_EXTERN_ACCESS_CFLAGS): New.
* testsuite/ld-elf/linux-x86.exp: Compile some tests with
$DIRECT_EXTERN_ACCESS_CFLAGS.
* testsuite/ld-elfvers/vers.exp (need_direct_extern_access): New
for i?86.
Compile tests with $need_direct_extern_access.
* testsuite/ld-i386/i386.exp: Compile some tests with
$DIRECT_EXTERN_ACCESS_CFLAGS.
* testsuite/ld-ifunc/ifunc.exp (need_direct_extern_access): New
for i?86.
Compile tests with $need_direct_extern_access.
* testsuite/ld-shared/shared.exp (need_direct_extern_access): New
for i?86.
Compile tests with $need_direct_extern_access.
* testsuite/ld-srec/srec.exp (CFLAGS_FOR_TARGET_TEST): Add
$DIRECT_EXTERN_ACCESS_CFLAGS.
(CXXFLAGS_FOR_TARGET_TEST): Likewise.
* testsuite/ld-vsb/vsb.exp (need_direct_extern_access): New
for i?86.
Compile tests with $need_direct_extern_access.
* testsuite/ld-x86-64/x86-64.exp: Compile some tests with
$DIRECT_EXTERN_ACCESS_CFLAGS and link some tests with
"-Wl,-z,noindirect-extern-access".

Co-Authored-By: Sam James <sam@gentoo.org>
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Signed-off-by: Sam James <sam@gentoo.org>
ld/testsuite/config/default.exp
ld/testsuite/ld-elf/linux-x86.exp
ld/testsuite/ld-elfvers/vers.exp
ld/testsuite/ld-i386/i386.exp
ld/testsuite/ld-ifunc/ifunc.exp
ld/testsuite/ld-shared/shared.exp
ld/testsuite/ld-srec/srec.exp
ld/testsuite/ld-vsb/vsb.exp
ld/testsuite/ld-x86-64/x86-64.exp