]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
ld: Use --no-rosegment to ld for PR ld/22393 tests
authorH.J. Lu <hjl.tools@gmail.com>
Fri, 20 Sep 2024 19:44:22 +0000 (03:44 +0800)
committerH.J. Lu <hjl.tools@gmail.com>
Fri, 20 Sep 2024 21:03:18 +0000 (05:03 +0800)
The commit

bf6d7087de0 ld: Move the .note.build-id section to near the start of the memory map

moves the .note.build-id section before text sections.  When --rosegment
and -z separate-code are used together, the .note.gnu.property section
is placed between the .note.build-id section and text sections in the
same PT_LOAD segment by orphan placement.  Pass --no-rosegment to ld for
PR ld/22393 tests to avoid linker test failures.

PR ld/32190
* testsuite/ld-elf/pr22393-2a.rd: Pass --no-rosegment to ld.
* testsuite/ld-elf/pr22393-2b.rd: Likewise.
* testsuite/ld-elf/shared.exp: Pass --no-rosegment to ld when
building pr22393-2 tests.
* testsuite/ld-x86-64/pr22393-3a.rd: Pass --no-rosegment to ld.
* testsuite/ld-x86-64/pr22393-3b.rd: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Pass --no-rosegment to ld when
building pr22393-3 tests.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
ld/testsuite/ld-elf/pr22393-2a.rd
ld/testsuite/ld-elf/pr22393-2b.rd
ld/testsuite/ld-elf/shared.exp
ld/testsuite/ld-x86-64/pr22393-3a.rd
ld/testsuite/ld-x86-64/pr22393-3b.rd
ld/testsuite/ld-x86-64/x86-64.exp

index 0050f1bdad25ec0bb0a66f1a412a0f67aa7c366f..a9c5478bb71001e30d4ad585a61927fd6962842e 100644 (file)
@@ -1,5 +1,5 @@
 #source: pr22393-1.s
-#ld: -shared -z separate-code
+#ld: -shared -z separate-code --no-rosegment
 #readelf: -l --wide
 #target: *-*-linux-gnu *-*-gnu* *-*-nacl*
 
index 0050f1bdad25ec0bb0a66f1a412a0f67aa7c366f..a9c5478bb71001e30d4ad585a61927fd6962842e 100644 (file)
@@ -1,5 +1,5 @@
 #source: pr22393-1.s
-#ld: -shared -z separate-code
+#ld: -shared -z separate-code --no-rosegment
 #readelf: -l --wide
 #target: *-*-linux-gnu *-*-gnu* *-*-nacl*
 
index 281c3f5d93c6897e17a42b92040559e7c7a550fb..e13e7e0588ce273acd76c533eab5f73749abbee3 100644 (file)
@@ -1410,7 +1410,7 @@ if { [istarget *-*-linux*]
        ] \
        [list \
            "Build pr22393-2a.so" \
-           "-shared -Wl,-z,separate-code" \
+           "-shared -Wl,-z,separate-code,--no-rosegment" \
            "-fPIC" \
            {pr22393-2a.c} \
            {{readelf -lW pr22393-2a.rd} \
@@ -1419,7 +1419,7 @@ if { [istarget *-*-linux*]
        ] \
        [list \
            "Build pr22393-2a-now.so" \
-           "-shared -Wl,-z,separate-code,-z,now" \
+           "-shared -Wl,-z,separate-code,-z,now,--no-rosegment" \
            "-fPIC" \
            {pr22393-2a.c} \
            {{readelf -lW pr22393-2a.rd} \
@@ -1428,7 +1428,7 @@ if { [istarget *-*-linux*]
        ] \
        [list \
            "Build pr22393-2" \
-           "$NOPIE_LDFLAGS -Wl,-z,separate-code,--no-as-needed tmpdir/pr22393-2a.so" \
+           "$NOPIE_LDFLAGS -Wl,-z,separate-code,--no-rosegment,--no-as-needed tmpdir/pr22393-2a.so" \
            "$NOPIE_CFLAGS" \
            {pr22393-2b.c} \
            {{readelf -lW pr22393-2a.rd} \
@@ -1437,7 +1437,7 @@ if { [istarget *-*-linux*]
        ] \
        [list \
            "Build pr22393-2 (PIE)" \
-           "-pie -Wl,-z,separate-code,--no-as-needed tmpdir/pr22393-2a-now.so" \
+           "-pie -Wl,-z,separate-code,--no-rosegment,--no-as-needed tmpdir/pr22393-2a-now.so" \
            "-fPIE" \
            {pr22393-2b.c} \
            {{readelf -lW pr22393-2a.rd} \
@@ -1446,7 +1446,7 @@ if { [istarget *-*-linux*]
        ] \
        [list \
            "Build pr22393-2 (static)" \
-           "-static -Wl,-z,separate-code" \
+           "-static -Wl,-z,separate-code,--no-rosegment" \
            "" \
            {pr22393-2a.c pr22393-2b.c} \
            {{readelf -lW pr22393-2a.rd} \
index b17e09b06db2dc5089af1a6a4eb8225a201920ef..4027ed3443bfa8bbabff7a103932e0d74e66872c 100644 (file)
@@ -1,5 +1,5 @@
 #source: pr22393-1.s
-#ld: -shared -z separate-code
+#ld: -shared -z separate-code --no-rosegment
 #readelf: -l --wide
 #target: *-*-linux-gnu *-*-gnu*
 
index b17e09b06db2dc5089af1a6a4eb8225a201920ef..4027ed3443bfa8bbabff7a103932e0d74e66872c 100644 (file)
@@ -1,5 +1,5 @@
 #source: pr22393-1.s
-#ld: -shared -z separate-code
+#ld: -shared -z separate-code --no-rosegment
 #readelf: -l --wide
 #target: *-*-linux-gnu *-*-gnu*
 
index d87ab1f89163072466dd95ff36dfd67a3b4ada08..cf78fffe29f642bccb0a115f1818ffb0963ba300 100644 (file)
@@ -1219,7 +1219,7 @@ if { [isnative] && [check_compiler_available] } {
        ] \
        [list \
            "Build pr22393-3a.so" \
-           "-shared -Wl,-z,separate-code,-z,max-page-size=0x1000" \
+           "-shared -Wl,-z,separate-code,-z,max-page-size=0x1000,--no-rosegment" \
            "-fPIC -Wa,-mx86-used-note=yes" \
            {pr22393-3a.c} \
            {{readelf -lW pr22393-3a.rd} \
@@ -1228,7 +1228,7 @@ if { [isnative] && [check_compiler_available] } {
        ] \
        [list \
            "Build pr22393-3a-now.so" \
-           "-shared -Wl,-z,separate-code,-z,now,-z,max-page-size=0x1000" \
+           "-shared -Wl,-z,separate-code,-z,now,-z,max-page-size=0x1000,--no-rosegment" \
            "-fPIC -Wa,-mx86-used-note=yes" \
            {pr22393-3a.c} \
            {{readelf -lW pr22393-3a.rd} \
@@ -1237,7 +1237,7 @@ if { [isnative] && [check_compiler_available] } {
        ] \
        [list \
            "Build pr22393-3" \
-           "$NOPIE_LDFLAGS -Wl,-z,separate-code,-z,max-page-size=0x1000,--no-as-needed tmpdir/pr22393-3a.so" \
+           "$NOPIE_LDFLAGS -Wl,-z,separate-code,-z,max-page-size=0x1000,--no-rosegment,--no-as-needed tmpdir/pr22393-3a.so" \
            "$NOPIE_CFLAGS -Wa,-mx86-used-note=yes" \
            {pr22393-3b.c} \
            {{readelf -lW pr22393-3a.rd} \
@@ -1246,7 +1246,7 @@ if { [isnative] && [check_compiler_available] } {
        ] \
        [list \
            "Build pr22393-3 (PIE)" \
-           "-pie -Wl,-z,separate-code,-z,max-page-size=0x1000,--no-as-needed tmpdir/pr22393-3a-now.so" \
+           "-pie -Wl,-z,separate-code,-z,max-page-size=0x1000,--no-rosegment,--no-as-needed tmpdir/pr22393-3a-now.so" \
            "-fPIE -Wa,-mx86-used-note=yes" \
            {pr22393-3b.c} \
            {{readelf -lW pr22393-3a.rd} \
@@ -1255,7 +1255,7 @@ if { [isnative] && [check_compiler_available] } {
        ] \
        [list \
            "Build pr22393-3 (static)" \
-           "-static -Wl,-z,separate-code,-z,max-page-size=0x1000" \
+           "-static -Wl,-z,separate-code,-z,max-page-size=0x1000,--no-rosegment" \
            "-Wa,-mx86-used-note=yes" \
            {pr22393-3a.c pr22393-3b.c} \
            {{readelf -lW pr22393-3a.rd} \