Commit: Adjust linker tests for --rosegment
Checks
Commit Message
Hi Guys,
*sigh* It is always the way. You check in a patch and then you
realise that you had forgotten something. In this case I checked in
the --rosegment patch and then realised that I had not checked the
all of the linker tests still passed for a toolchain configured with
--enable-separate-code=yes --enable-rosegment=yes. Sure enough when
I did I found some linker tests that do not expect the segment layout
with --rosegment.
So I am checking in the attached patch to fix those tests.
Cheers
Nick
Comments
On Thu, Jun 13, 2024 at 8:59 AM Nick Clifton <nickc@redhat.com> wrote:
>
> Hi Guys,
>
> *sigh* It is always the way. You check in a patch and then you
> realise that you had forgotten something. In this case I checked in
> the --rosegment patch and then realised that I had not checked the
> all of the linker tests still passed for a toolchain configured with
> --enable-separate-code=yes --enable-rosegment=yes. Sure enough when
> I did I found some linker tests that do not expect the segment layout
> with --rosegment.
>
> So I am checking in the attached patch to fix those tests.
>
> Cheers
> Nick
Hi Nick,
Thanks for making adjustments. My view point (and also Jakub's I
think) remains that .rodata/.eh_frame/.eh_frame_hdr should be moved
before .text so that there is one single read-only PT_LOAD segment to
minimize the size penalty due to -z separate-code and a large
max-page-size.
https://sourceware.org/pipermail/binutils/2024-June/134546.html
While I don't know what ports don't like .rodata/.eh_frame before
.text, given that lld has been using the one read-only PT_LOAD segment
for such a long time and
i386/x86-64/arm/aarch64/mips/ppc32/ppc64/riscv/s390x all work, I
believe all the popular architectures are happy with .rodata/.eh_frame
before .text .
@@ -1,5 +1,5 @@
#source: mbind1.s
-#ld: -shared -z common-page-size=0x1000 -z max-page-size=0x200000
+#ld: -shared -z common-page-size=0x1000 -z max-page-size=0x200000 --no-rosegment
#readelf: -S -l --wide
#target: *-*-linux* *-*-gnu* arm*-*-uclinuxfdpiceabi
#xfail: ![check_shared_lib_support]
@@ -1,5 +1,5 @@
#source: mbind1.s
-#ld: -pie -z common-page-size=0x1000 -z max-page-size=0x200000
+#ld: -pie -z common-page-size=0x1000 -z max-page-size=0x200000 --no-rosegment
#readelf: -S -l --wide
#target: *-*-linux* *-*-gnu* arm*-*-uclinuxfdpiceabi
#xfail: ![check_pie_support]
@@ -1,4 +1,4 @@
-#ld: -z separate-code
+#ld: -z separate-code --no-rosegment
#objcopy_linked_file: -R .foo
#readelf: -lW
#target: *-*-linux-gnu *-*-gnu* *-*-nacl* arm*-*-uclinuxfdpiceabi
@@ -191,7 +191,7 @@ set i386tests {
{"Reloc section order"
"-shared -melf_i386 -z nocombreloc -z notext" "" "--32"
{reloc.s} {{objdump -hw reloc.d}} "reloc.so"}
- {"Basic --emit-relocs support" "-shared -melf_i386 --emit-relocs" "" "--32"
+ {"Basic --emit-relocs support" "-shared -melf_i386 --emit-relocs --no-rosegment" "" "--32"
{emit-relocs.s} {{readelf --relocs emit-relocs.rd}} "emit-relocs.so"}
{"-z combreloc relocation sections" "-shared -melf_i386 -z combreloc" ""
"--32" {combreloc.s} {{readelf -r combreloc.d}} "combreloc.so"}
@@ -1,5 +1,5 @@
#as: --x32
-#ld: -m elf32_x86_64 -shared --no-ld-generated-unwind-info --hash-style=sysv $NO_DT_RELR_LDFLAGS
+#ld: -m elf32_x86_64 -shared --no-ld-generated-unwind-info --hash-style=sysv $NO_DT_RELR_LDFLAGS --no-rosegment
#readelf: -d -S --wide
#target: x86_64-*-linux*
@@ -1,6 +1,6 @@
#source: mark-plt-1.s
#as: --x32
-#ld: -melf32_x86_64 -shared -z mark-plt
+#ld: -melf32_x86_64 -shared -z mark-plt --no-rosegment
#readelf: -drW
#...
@@ -1,6 +1,6 @@
#source: mark-plt-1.s
#as: --64
-#ld: -melf_x86_64 -shared -z mark-plt
+#ld: -melf_x86_64 -shared -z mark-plt --no-rosegment
#readelf: -drW
#...
@@ -1,6 +1,6 @@
#source: mark-plt-1.s
#as: --x32
-#ld: -melf32_x86_64 -shared -z mark-plt --hash-style=both
+#ld: -melf32_x86_64 -shared -z mark-plt --hash-style=both --no-rosegment
#objdump: -dw
#...
@@ -1,6 +1,6 @@
#source: mark-plt-1.s
#as: --64
-#ld: -melf_x86_64 -shared -z mark-plt --hash-style=both
+#ld: -melf_x86_64 -shared -z mark-plt --hash-style=both --no-rosegment
#objdump: -dw
#...
@@ -1,6 +1,6 @@
#source: mark-plt-1.s
#as: --x32
-#ld: -melf32_x86_64 -shared -z mark-plt -z ibtplt
+#ld: -melf32_x86_64 -shared -z mark-plt -z ibtplt --no-rosegment
#readelf: -drW
#...
@@ -1,6 +1,6 @@
#source: mark-plt-1.s
#as: --64
-#ld: -melf_x86_64 -shared -z mark-plt -z ibtplt
+#ld: -melf_x86_64 -shared -z mark-plt -z ibtplt --no-rosegment
#readelf: -drW
#...
@@ -1,6 +1,6 @@
#source: mark-plt-1.s
#as: --x32
-#ld: -melf32_x86_64 -shared -z mark-plt -z ibtplt --hash-style=both
+#ld: -melf32_x86_64 -shared -z mark-plt -z ibtplt --hash-style=both --no-rosegment
#objdump: -dw
#...
@@ -1,6 +1,6 @@
#source: mark-plt-1.s
#as: --64
-#ld: -melf_x86_64 -shared -z mark-plt -z ibtplt --hash-style=both
+#ld: -melf_x86_64 -shared -z mark-plt -z ibtplt --hash-style=both --no-rosegment
#objdump: -dw
#...
@@ -27,7 +27,7 @@ if {![istarget "x86_64-*-linux*"] } {
run_ld_link_tests [list \
[list \
"Build pe-x86-64-1" \
- "-m elf_x86_64 --entry=begin -z max-page-size=0x1000 -z separate-code" \
+ "-m elf_x86_64 --entry=begin -z max-page-size=0x1000 -z separate-code --no-rosegment" \
"" \
"" \
{pe-x86-64-1a.obj.bz2 pe-x86-64-1b.obj.bz2 pe-x86-64-1c.obj.bz2} \
@@ -36,7 +36,7 @@ run_ld_link_tests [list \
] \
[list \
"Build pe-x86-64-2" \
- "-m elf_x86_64 --entry=begin -z max-page-size=0x1000 -z separate-code" \
+ "-m elf_x86_64 --entry=begin -z max-page-size=0x1000 -z separate-code --no-rosegment" \
"" \
"" \
{pe-x86-64-2a.obj.bz2 pe-x86-64-2b.obj.bz2 pe-x86-64-2c.obj.bz2} \
@@ -45,7 +45,7 @@ run_ld_link_tests [list \
] \
[list \
"Build pe-x86-64-3" \
- "-m elf_x86_64 --entry=begin -z max-page-size=0x1000 -z separate-code" \
+ "-m elf_x86_64 --entry=begin -z max-page-size=0x1000 -z separate-code --no-rosegment" \
"" \
"" \
{pe-x86-64-3a.obj.bz2 pe-x86-64-3b.obj.bz2 pe-x86-64-3c.obj.bz2 \
@@ -55,7 +55,7 @@ run_ld_link_tests [list \
] \
[list \
"Build pe-x86-64-4" \
- "-m elf_x86_64 --entry=begin -z max-page-size=0x1000 -z separate-code" \
+ "-m elf_x86_64 --entry=begin -z max-page-size=0x1000 -z separate-code --no-rosegment" \
"" \
"" \
{pe-x86-64-4a.obj.bz2 pe-x86-64-4b.obj.bz2 pe-x86-64-4c.obj.bz2 \
@@ -65,7 +65,7 @@ run_ld_link_tests [list \
] \
[list \
"Build pe-x86-64-5" \
- "-m elf_x86_64 --entry=begin -z max-page-size=0x1000 -z separate-code" \
+ "-m elf_x86_64 --entry=begin -z max-page-size=0x1000 -z separate-code --no-rosegment" \
"" \
"" \
{pe-x86-64-5.obj.bz2 } \
@@ -75,7 +75,7 @@ run_ld_link_tests [list \
] \
[list \
"Build pe-x86-64-6" \
- "-m elf_x86_64 --entry=main -z max-page-size=0x1000 -z separate-code" \
+ "-m elf_x86_64 --entry=main -z max-page-size=0x1000 -z separate-code --no-rosegment" \
"" \
"" \
{pe-x86-64-6.obj.bz2 } \
@@ -1,6 +1,6 @@
#source: pr19609-4.s
#as: --64 -mrelax-relocations=yes
-#ld: -melf_x86_64 -Ttext=0x70000000 -Tdata=0xa0000000 --no-relax -z max-page-size=0x1000 -z separate-code
+#ld: -melf_x86_64 -Ttext=0x70000000 -Tdata=0xa0000000 --no-relax -z max-page-size=0x1000 -z separate-code --no-rosegment
#objdump: -dw
.*: +file format .*
@@ -1,6 +1,6 @@
#source: pr19609-6.s
#as: --64 -mrelax-relocations=yes
-#ld: -melf_x86_64 --defsym foobar=0x80000000 -z max-page-size=0x1000 -z separate-code
+#ld: -melf_x86_64 --defsym foobar=0x80000000 -z max-page-size=0x1000 -z separate-code --no-rosegment
#objdump: -dw
.*: +file format .*
@@ -1,6 +1,6 @@
#source: pr19609-6.s
#as: --64 -mrelax-relocations=yes
-#ld: -melf_x86_64 --defsym foobar=0x80000000 --no-relax -z max-page-size=0x1000 -z separate-code
+#ld: -melf_x86_64 --defsym foobar=0x80000000 --no-relax -z max-page-size=0x1000 -z separate-code --no-rosegment
#objdump: -dw
.*: +file format .*
@@ -1,6 +1,6 @@
#source: pr19609-7.s
#as: --64 -mrelax-relocations=yes
-#ld: -melf_x86_64 -Ttext=0x80000000 --no-relax -z max-page-size=0x1000 -z separate-code
+#ld: -melf_x86_64 -Ttext=0x80000000 --no-relax -z max-page-size=0x1000 -z separate-code --no-rosegment
#objdump: -dw
.*: +file format .*
@@ -1,6 +1,6 @@
#source: pr19609-7.s
#as: --x32 -mrelax-relocations=yes
-#ld: -melf32_x86_64 -Ttext=0x80000000 --no-relax -z max-page-size=0x1000 -z separate-code
+#ld: -melf32_x86_64 -Ttext=0x80000000 --no-relax -z max-page-size=0x1000 -z separate-code --no-rosegment
#objdump: -dw
.*: +file format .*
@@ -2,7 +2,7 @@
#source: sframe-foo.s
#source: sframe-bar.s
#objdump: --sframe=.sframe
-#ld: -shared
+#ld: -shared --no-rosegment
#name: SFrame for plt0 and pltN
.*: +file format .*
@@ -2,7 +2,7 @@
#source: sframe-foo.s
#source: sframe-bar.s
#objdump: --sframe=.sframe
-#ld: -shared
+#ld: -shared --no-rosegment
#name: SFrame simple link
.*: +file format .*