diff options
| author | H.J. Lu <hjl.tools@gmail.com> | 2026-03-18 13:58:35 -0700 |
|---|---|---|
| committer | H.J. Lu <hjl.tools@gmail.com> | 2026-04-03 16:25:25 +0800 |
| commit | db4f00be62d3396374df989b5f938c3ebec6833e (patch) | |
| tree | 8752400919b2244a5474e26709a810c7d296eddb /binutils | |
| parent | 5ae26f34ef5ac863203d63fffc968d63e823172f (diff) | |
| download | fsf-binutils-gdb-db4f00be62d3396374df989b5f938c3ebec6833e.tar.gz fsf-binutils-gdb-db4f00be62d3396374df989b5f938c3ebec6833e.tar.bz2 fsf-binutils-gdb-db4f00be62d3396374df989b5f938c3ebec6833e.zip | |
ld: Pass --no-rosegment to ld in some linker tests
For elf/x86, --rosegment places code after read-only data, instead of
before read-only data. Pass --no-rosegment to ld in some linker tests
to avoid extra linker test failures when binutils is configured with
--enable-rosegment for elf/x86.
binutils/
PR ld/34003
* testsuite/lib/binutils-common.exp (check_rosegment_support): New.
(run_dump_test): Make NO_ROSEGMENT_LDFLAGS global.
ld/
PR ld/34003
* testsuite/config/default.exp (NO_ROSEGMENT_LDFLAGS): New.
* testsuite/ld-elf/mbind1a.d: Pass $NO_ROSEGMENT_LDFLAGS to ld.
* testsuite/ld-elf/pr26256-2b.d: Likewise.
* testsuite/ld-srec/srec.exp (extra_flags): Add
$NO_ROSEGMENT_LDFLAGS.
* testsuite/ld-x86-64/no-plt.exp: Pass -Wl,--no-rosegment to
compiler.
* testsuite/ld-x86-64/pr27491-1c.d: Pass --no-rosegment to ld.
* testsuite/ld-x86-64/pr27491-2.d: Likewise.
* testsuite/ld-x86-64/pr27491-3.d: Likewise.
* testsuite/ld-x86-64/pr27491-4.d: Likewise.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Diffstat (limited to 'binutils')
| -rw-r--r-- | binutils/testsuite/lib/binutils-common.exp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp index 8683202a3cc..34bc3a5af64 100644 --- a/binutils/testsuite/lib/binutils-common.exp +++ b/binutils/testsuite/lib/binutils-common.exp @@ -430,6 +430,23 @@ proc check_memory_seal_support { } { return $memory_seal_available_saved } +proc check_rosegment_support { } { + global rosegment_available_saved + global ld + + if {![info exists rosegment_available_saved]} { + set ld_output [remote_exec host $ld "--no-rosegment"] + if { [string first "not supported" $ld_output] >= 0 + || [string first "unrecognized option" $ld_output] >= 0 + || [string first "--no-rosegment ignored" $ld_output] >= 0 } { + set rosegment_available_saved 0 + } else { + set rosegment_available_saved 1 + } + } + return $rosegment_available_saved +} + # Check for support of the .noinit section, used for data that is not # initialized at load, or during the application's initialization sequence. proc supports_noinit_section {} { @@ -1042,6 +1059,7 @@ proc run_dump_test { name {extra_options {}} } { global SIZE SIZEFLAGS global copyfile env runtests srcdir subdir verbose base_dir global DT_RELR_LDFLAGS NO_DT_RELR_LDFLAGS + global NO_ROSEGMENT_LDFLAGS if [string match "*/*" $name] { set file $name |
