]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
ld: Adjust x86 and x86-64 tests for -z mark-plt
authorH.J. Lu <hjl.tools@gmail.com>
Sat, 6 Jan 2024 14:43:04 +0000 (06:43 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Sat, 6 Jan 2024 15:10:15 +0000 (07:10 -0800)
To support -z mark-plt enabled by default, adjust x86 tests to accept
non-zero r_addend for JUMP_SLOT relocation and pass -z nomark-plt to
x86-64 tests if -z mark-plt changes the expected outputs.

* testsuite/ld-elf/indirect-extern-access-2.rd: Allow non-zero
r_addend for JUMP_SLOT relocation.
* testsuite/ld-elf/pr23161d.rd: Likewise.
* testsuite/ld-ifunc/ifunc-25c-x86.d: Likewise.
* testsuite/ld-ifunc/ifunc-16-x86-64-now.d: Pass -z nomark-plt
to linker.
* testsuite/ld-ifunc/ifunc-16-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-local-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-x86-64-now.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-20-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-5b-x86-64.d: Likewise.
* testsuite/ld-ifunc/pr17154-x86-64-now.d: Likewise.
* testsuite/ld-ifunc/pr17154-x86-64.d: Likewise.
* testsuite/ld-x86-64/dt-relr-1a-x32.d: Likewise.
* testsuite/ld-x86-64/dt-relr-1a.d: Likewise.
* testsuite/ld-x86-64/dt-relr-1b-x32.d: Likewise.
* testsuite/ld-x86-64/dt-relr-1b.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-2a-x32.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-2a.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-3a-x32.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-3a.d: Likewise.
* testsuite/ld-x86-64/pr19636-2d.d: Likewise.
* testsuite/ld-x86-64/pr19636-2e.d: Likewise.
* testsuite/ld-x86-64/pr19636-2f.d: Likewise.
* testsuite/ld-x86-64/pr19636-2l.d: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Pass -z nomark-plt to linker
in 6 tests.

26 files changed:
ld/testsuite/ld-elf/indirect-extern-access-2.rd
ld/testsuite/ld-elf/pr23161d.rd
ld/testsuite/ld-ifunc/ifunc-16-x86-64-now.d
ld/testsuite/ld-ifunc/ifunc-16-x86-64.d
ld/testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d
ld/testsuite/ld-ifunc/ifunc-2-local-x86-64.d
ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d
ld/testsuite/ld-ifunc/ifunc-2-x86-64.d
ld/testsuite/ld-ifunc/ifunc-20-x86-64.d
ld/testsuite/ld-ifunc/ifunc-25c-x86.d
ld/testsuite/ld-ifunc/ifunc-5b-x86-64.d
ld/testsuite/ld-ifunc/pr17154-x86-64-now.d
ld/testsuite/ld-ifunc/pr17154-x86-64.d
ld/testsuite/ld-x86-64/dt-relr-1a-x32.d
ld/testsuite/ld-x86-64/dt-relr-1a.d
ld/testsuite/ld-x86-64/dt-relr-1b-x32.d
ld/testsuite/ld-x86-64/dt-relr-1b.d
ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d
ld/testsuite/ld-x86-64/ibt-plt-2a.d
ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d
ld/testsuite/ld-x86-64/ibt-plt-3a.d
ld/testsuite/ld-x86-64/pr19636-2d.d
ld/testsuite/ld-x86-64/pr19636-2e.d
ld/testsuite/ld-x86-64/pr19636-2f.d
ld/testsuite/ld-x86-64/pr19636-2l.d
ld/testsuite/ld-x86-64/x86-64.exp

index 9c7d72fae25d3d08dcaae5c77bd8bf2178c74002..89c9e2ed33636f8cf1ce5f450af2fd6f39b02cb8 100644 (file)
@@ -1,5 +1,5 @@
 #...
-[a-f0-9]+ +[0-9a-f]+ +R_.*_JUMP_SLO(T|) +[a-f0-9]+ +indirect_extern_access( \+ 0|)
+[a-f0-9]+ +[0-9a-f]+ +R_.*_JUMP_SLO(T|) +[a-f0-9]+ +indirect_extern_access( \+ [a-f0-9]+|)
 #...
 Displaying notes found in: .note.gnu.property
 [      ]+Owner[        ]+Data size[    ]+Description
index 338cfad336b2af1ae1da947b661d2914c587ee34..e7756b3f61b0afff4183a32b6988ee1af50a7efd 100644 (file)
@@ -1,6 +1,6 @@
 Relocation section '\.rel(a|)\.plt' at offset 0x[0-9a-f]+ contains 1 entry:
  +Offset +Info +Type +Sym.* Value +Sym.* Name( \+ Addend|)
-[a-f0-9]+ +[0-9a-f]+ +R_.*_JUMP_SLOT +[a-f0-9]+ +foo( \+ 0|)
+[a-f0-9]+ +[0-9a-f]+ +R_.*_JUMP_SLOT +[a-f0-9]+ +foo( \+ [a-f0-9]+|)
 
 Symbol table '\.dynsym' contains [0-9]+ entries:
  +Num: +Value +Size Type +Bind +Vis +Ndx Name
index db6c0e285a13705b2515f880e08bb32ee56d541c..32ab488ca7ab3a4d77cb9ad3d45b2060f2695cec 100644 (file)
@@ -1,6 +1,6 @@
 #source: ifunc-16-x86.s
 #as: --64
-#ld: -z now -shared -melf_x86_64
+#ld: -z now -z nomark-plt -shared -melf_x86_64
 #readelf: -r --wide
 #target: x86_64-*-*
 
index d69626d3021ff364cdd6b2ba4127fdb3ae640c26..06c1ed90b923e26f9dddb58963c5a7699c587f04 100644 (file)
@@ -1,6 +1,6 @@
 #source: ifunc-16-x86.s
 #as: --64
-#ld: -shared -melf_x86_64
+#ld: -z nomark-plt -shared -melf_x86_64
 #readelf: -r --wide
 #target: x86_64-*-*
 
index e038b37a6d6a4ba76f77842759bccad33930864b..6d98d66ebd435a251ad02bfb13d006141e2eb4b7 100644 (file)
@@ -1,6 +1,6 @@
 #source: ifunc-2-local-x86-64.s
 #as: --64
-#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
+#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code -z nomark-plt $NO_DT_RELR_LDFLAGS
 #objdump: -dw
 #target: x86_64-*-*
 
index 14a5728032753ce714f54ca562fcb41291ebab4c..4d2f4bff82cae353cddab51bd5833afdb18a246e 100644 (file)
@@ -1,5 +1,5 @@
 #as: --64
-#ld: -shared -melf_x86_64 --hash-style=sysv -z noseparate-code
+#ld: -shared -melf_x86_64 --hash-style=sysv -z noseparate-code -z nomark-plt
 #objdump: -dw
 #target: x86_64-*-*
 
index 47db0125612c8f72a0368251724f54f0e4926fde..8b248d393b01a0687bb5f67a08d0331816b936f1 100644 (file)
@@ -1,6 +1,6 @@
 #source: ifunc-2-x86-64.s
 #as: --64
-#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
+#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code -z nomark-plt $NO_DT_RELR_LDFLAGS
 #objdump: -dw
 #target: x86_64-*-*
 
index 2a1f2698a2a9bd1aca27a78f323251c6d2d3cd10..8eb7583a3d3e0ad27339dc2ba6424bd619d5fcb6 100644 (file)
@@ -1,5 +1,5 @@
 #as: --64
-#ld: -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code -z nomark-plt
 #objdump: -dw
 #target: x86_64-*-*
 
index 0ea46a6a2d2d0ad39c5856c945b574ed3c8dd3c0..5cd12aa4e3f78457c8e9ca65013628af28680729 100644 (file)
@@ -1,5 +1,5 @@
 #source: ifunc-20.s
-#ld: -shared -m elf_x86_64 -z nocombreloc
+#ld: -shared -m elf_x86_64 -z nocombreloc -z nomark-plt
 #as: --64
 #readelf: -r --wide
 #target: x86_64-*-*
index e2401a9f16070f9d891e875f0a3170bce2321b60..c278c5784d6872b573010e872228b2d7aac8a85a 100644 (file)
@@ -9,4 +9,4 @@ Relocation section '.rel(a|).dyn' at offset 0x[0-9a-f]+ contains 1 entry:
 
 Relocation section '.rel(a|).plt' at offset 0x[0-9a-f]+ contains 1 entry:
  +Offset +Info +Type +Sym.* Value +Symbol's Name.*
-[0-9a-f]+[ ]+[0-9a-f]+[ ]+R_(386|X86_64)_JUMP_SLOT +foo\(\) +foo( \+ 0|)
+[0-9a-f]+[ ]+[0-9a-f]+[ ]+R_(386|X86_64)_JUMP_SLOT +foo\(\) +foo( \+ [0-9a-f]+|)
index 02aff6b7c8527476921dc79ce13096ecb1aedf7e..715271f65ffc4d16b09bac8e047f9b8c18f2e1e0 100644 (file)
@@ -1,6 +1,6 @@
 #source: ifunc-5-x86-64.s
 #as: --64
-#ld: -melf_x86_64 -shared -z nocombreloc
+#ld: -melf_x86_64 -shared -z nocombreloc -z nomark-plt
 #readelf: -r --wide
 #target: x86_64-*-*
 
index f6920272b6340f68c5419d8898b14eafb5213c4b..4d2ae8413f20f1d2ff42bc8b5427858e4cf01c35 100644 (file)
@@ -1,6 +1,6 @@
 #source: pr17154-x86.s
 #as: --64
-#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
+#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code -z nomark-plt $NO_DT_RELR_LDFLAGS
 #objdump: -dw
 #target: x86_64-*-*
 
index 90918426ee549efe113bbcaf5644a2c8ddc40c51..fbe6e225d5c94578ef11fe512efe911246d280c9 100644 (file)
@@ -1,6 +1,6 @@
 #source: pr17154-x86.s
 #as: --64
-#ld: -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
+#ld: -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code -z nomark-plt $NO_DT_RELR_LDFLAGS
 #objdump: -dw
 #target: x86_64-*-*
 
index 3b603cd4b0156235f16dbd1b0293269ddf6e4870..8f2f6fc2f74fc8ae411dd9d6040013f5fefd8df4 100644 (file)
@@ -1,6 +1,6 @@
 #source: dt-relr-1.s
 #as: --x32
-#ld: -shared -melf32_x86_64 $DT_RELR_LDFLAGS
+#ld: -shared -melf32_x86_64 $DT_RELR_LDFLAGS -z nomark-plt
 #readelf: -r -s --wide
 #target: x86_64-*-linux*
 
index abf2352a92a897d8c67d46ce64aadae41aa168bd..218594dfb985759b2220f6947bd9242c9b1ce6eb 100644 (file)
@@ -1,6 +1,6 @@
 #source: dt-relr-1.s
 #as: --64
-#ld: -shared -melf_x86_64 $DT_RELR_LDFLAGS
+#ld: -shared -melf_x86_64 $DT_RELR_LDFLAGS -z nomark-plt
 #readelf: -r -s --wide
 #target: x86_64-*-linux*
 
index 05c376c5d466c4e1b63fd114ff302e0008de40a9..0ddffc82429858f723e04ac835e61fc4876e9f88 100644 (file)
@@ -1,6 +1,6 @@
 #source: dt-relr-1.s
 #as: --x32
-#ld: -shared -melf32_x86_64 $DT_RELR_LDFLAGS -z nocombreloc
+#ld: -shared -melf32_x86_64 $DT_RELR_LDFLAGS -z nocombreloc -z nomark-plt
 #readelf: -r -s --wide
 #target: x86_64-*-linux*
 
index 703b68f6fa81766dae1230e69882f049006e5b44..4e462dd1fcb0cdf83578f177aaaeda837602fd24 100644 (file)
@@ -1,6 +1,6 @@
 #source: dt-relr-1.s
 #as: --64
-#ld: -shared -melf_x86_64 $DT_RELR_LDFLAGS -z nocombreloc
+#ld: -shared -melf_x86_64 $DT_RELR_LDFLAGS -z nocombreloc -z nomark-plt
 #readelf: -r -s --wide
 #target: x86_64-*-linux*
 
index e4e6fabff17b62bb19b8da9eb21b7fd3651256f8..31201c6498f9f856f7daac69c459b3dad7bf5ca7 100644 (file)
@@ -1,6 +1,6 @@
 #source: ibt-plt-2.s
 #as: --x32
-#ld: -shared -m elf32_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
+#ld: -shared -m elf32_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS -z nomark-plt
 #objdump: -dw
 
 .*: +file format .*
index 6f8ec7e0b1f88d093058488a8d68c7900f28371a..7f66eedbcfd3caeb81321479521cbfb62aa40635 100644 (file)
@@ -1,6 +1,6 @@
 #source: ibt-plt-2.s
 #as: --64 -defsym __64_bit__=1
-#ld: -shared -m elf_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
+#ld: -shared -m elf_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS -z nomark-plt
 #objdump: -dw
 
 .*: +file format .*
index b738e951420eb965a0b4b62cf929d3fb1ed9439f..0ba3d07adad8dc24b70b4bf4ec4b975ca222ccfb 100644 (file)
@@ -1,6 +1,6 @@
 #source: ibt-plt-3.s
 #as: --x32
-#ld: -shared -m elf32_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
+#ld: -shared -m elf32_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS -z nomark-plt
 #objdump: -dw
 
 .*: +file format .*
index a0ef8b11597195f66cfde2d43500953b5f653148..306592ac9cc65fdb5dec3e1e1848a8d7bde4a591 100644 (file)
@@ -1,6 +1,6 @@
 #source: ibt-plt-3.s
 #as: --64 -defsym __64_bit__=1
-#ld: -shared -m elf_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
+#ld: -shared -m elf_x86_64 -z ibtplt --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS -z nomark-plt
 #objdump: -dw
 
 .*: +file format .*
index 092992be9d47e0135b285b19a38cf3c7e4f4ff19..75c87871684082cd14aa5346ebe71c8b2d237a2c 100644 (file)
@@ -1,6 +1,6 @@
 #source: pr19636-2.s
 #as: --64 -mrelax-relocations=no
-#ld: -pie -m elf_x86_64 --no-dynamic-linker --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
+#ld: -pie -m elf_x86_64 --no-dynamic-linker --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS -z nomark-plt
 #objdump: -dw
 
 .*: +file format .*
index 32a326cf4290c9ab09e49d3c902e914c53dbef10..5d982414824a47940f9378d294bec25069579032 100644 (file)
@@ -1,6 +1,6 @@
 #source: pr19636-2.s
 #as: --64 -mrelax-relocations=no
-#ld: -shared -m elf_x86_64 --no-dynamic-linker
+#ld: -shared -m elf_x86_64 --no-dynamic-linker -z nomark-plt
 #readelf : -r --wide --dyn-syms
 
 Relocation section '\.rela\.dyn' at offset [0x0-9a-f]+ contains 2 entries:
index 528bce1bded5f4360e3d3302c5223c0fdd79085b..a3fe23df64327c092921dd361262844b60a33b44 100644 (file)
@@ -1,6 +1,6 @@
 #source: pr19636-2.s
 #as: --64 -mrelax-relocations=no
-#ld: -shared -Bsymbolic -m elf_x86_64 --no-dynamic-linker
+#ld: -shared -Bsymbolic -m elf_x86_64 --no-dynamic-linker -z nomark-plt
 #readelf : -r --wide --dyn-syms
 
 Relocation section '\.rela\.dyn' at offset [0x0-9a-f]+ contains 2 entries:
index 8c23c0b741172c4e3c286f13b88adb358d13c053..3cb00d7aac1493a7fe94a169c0a91ee284d96bfc 100644 (file)
@@ -1,6 +1,6 @@
 #source: pr19636-2.s
 #as: --64 -mrelax-relocations=no
-#ld: -pie -m elf_x86_64 --no-dynamic-linker --hash-style=sysv -z dynamic-undefined-weak -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
+#ld: -pie -m elf_x86_64 --no-dynamic-linker --hash-style=sysv -z dynamic-undefined-weak -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS -z nomark-plt
 #objdump: -dw
 #warning: -z dynamic-undefined-weak ignored
 
index ebb3d8820674bb1b385c8f8e93c2d68d23998b40..0af9f047600a518a3d4ec216a9d5b883eb87e8f1 100644 (file)
@@ -49,6 +49,7 @@ set x86_64tests {
      "--64" {tlslib.s} {} "libtlslib.so"}
     {"TLS -fpic and -fno-pic exec transitions"
      "-melf_x86_64 tmpdir/libtlslib.so --no-ld-generated-unwind-info \
+      -z nomark-plt \
       -z noseparate-code -z max-page-size=0x200000 --hash-style=sysv" ""
      "--64" {tlsbinpic.s tlsbin.s}
      {{readelf -WSsrl tlsbin.rd} {objdump -drj.text tlsbin.dd}
@@ -70,6 +71,7 @@ set x86_64tests {
       "tlsbindesc"}
     {"TLS with global dynamic and descriptors"
      "-shared -melf_x86_64 --no-ld-generated-unwind-info \
+      -z nomark-plt \
       -z noseparate-code -z max-page-size=0x200000 --hash-style=sysv" ""
      "--64" {tlsgdesc.s}
      {{readelf -WSsrl tlsgdesc.rd} {objdump -drj.text\ -Mintel64 tlsgdesc.dd}}
@@ -222,6 +224,7 @@ run_ld_link_tests [list \
     [list \
        "TLS -fpic -shared transitions" \
        "-shared -melf_x86_64 --no-ld-generated-unwind-info \
+        -z nomark-plt \
         -z noseparate-code -z max-page-size=0x200000 --hash-style=sysv \
         $NO_DT_RELR_LDFLAGS" \
        "" "--64" \
@@ -235,6 +238,7 @@ run_ld_link_tests [list \
     [list \
        "TLS -fpic -shared transitions with r15 as GOT base" \
        "-shared -melf_x86_64 --no-ld-generated-unwind-info \
+        -z nomark-plt \
         -z noseparate-code -z max-page-size=0x200000 --hash-style=sysv \
         $NO_DT_RELR_LDFLAGS" \
         "" "--64 -mrelax-relocations=yes" \
@@ -248,6 +252,7 @@ run_ld_link_tests [list \
     [list \
        "TLS descriptor -fpic -shared transitions" \
        "-shared -melf_x86_64 --no-ld-generated-unwind-info \
+        -z nomark-plt \
         -z noseparate-code -z max-page-size=0x200000 --hash-style=sysv \
         $NO_DT_RELR_LDFLAGS" \
        "" "--64" \
@@ -2096,6 +2101,7 @@ run_ld_link_tests [list \
     [list \
        "basic PLT generation (-z now)" \
        "-z now -melf_x86_64 --hash-style=sysv tmpdir/libpltlib.so \
+        -z nomark-plt \
         -z noseparate-code -z max-page-size=0x200000" \
        "" \
        "--64" \