[PATCH] x86: Adjust linker tests for --disable-separate-code

H.J. Lu hjl.tools@gmail.com
Mon Dec 13 20:13:01 GMT 2021


Adjust linker tests for linker configured with --disable-separate-code:

1. Update expected outputs.
2. Pass -z max-page-size=0x1000 -z separate-code" to linker.

	* testsuite/ld-i386/report-reloc-1.l: Updated.
	* testsuite/ld-x86-64/report-reloc-1.l: Likewise.
	* testsuite/ld-x86-64/pe-x86-64.exp: Pass
	"-z max-page-size=0x1000 -z separate-code" to linker.
	* testsuite/ld-x86-64/pr19609-4e.d: Likewise.
	* testsuite/ld-x86-64/pr19609-6a.d: Likewise.
	* testsuite/ld-x86-64/pr19609-6b.d: Likewise.
	* testsuite/ld-x86-64/pr19609-7b.d: Likewise.
	* testsuite/ld-x86-64/pr19609-7d.d: Likewise.
---
 ld/testsuite/ld-i386/report-reloc-1.l   |  4 ++--
 ld/testsuite/ld-x86-64/pe-x86-64.exp    | 12 ++++++------
 ld/testsuite/ld-x86-64/pr19609-4e.d     |  2 +-
 ld/testsuite/ld-x86-64/pr19609-6a.d     |  2 +-
 ld/testsuite/ld-x86-64/pr19609-6b.d     |  2 +-
 ld/testsuite/ld-x86-64/pr19609-7b.d     |  2 +-
 ld/testsuite/ld-x86-64/pr19609-7d.d     |  2 +-
 ld/testsuite/ld-x86-64/report-reloc-1.l |  4 ++--
 8 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/ld/testsuite/ld-i386/report-reloc-1.l b/ld/testsuite/ld-i386/report-reloc-1.l
index a0293bc4f96..d141e06e08d 100644
--- a/ld/testsuite/ld-i386/report-reloc-1.l
+++ b/ld/testsuite/ld-i386/report-reloc-1.l
@@ -1,2 +1,2 @@
-tmpdir/dump: R_386_IRELATIVE \(offset: 0x0+2000, info: 0x0+2a\) against 'ifunc' for section '.data.rel.ro.local' in tmpdir/report-reloc-1.o
-tmpdir/dump: R_386_RELATIVE \(offset: 0x0+2004, info: 0x0+8\) against '_start' for section '.data.rel.ro.local' in tmpdir/report-reloc-1.o
+tmpdir/dump: R_386_IRELATIVE \(offset: 0x[0-9a-f]+, info: 0x0+2a\) against 'ifunc' for section '.data.rel.ro.local' in tmpdir/report-reloc-1.o
+tmpdir/dump: R_386_RELATIVE \(offset: 0x[0-9a-f]+, info: 0x0+8\) against '_start' for section '.data.rel.ro.local' in tmpdir/report-reloc-1.o
diff --git a/ld/testsuite/ld-x86-64/pe-x86-64.exp b/ld/testsuite/ld-x86-64/pe-x86-64.exp
index f5d2c84f283..47340566002 100644
--- a/ld/testsuite/ld-x86-64/pe-x86-64.exp
+++ b/ld/testsuite/ld-x86-64/pe-x86-64.exp
@@ -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" \
+	"-m elf_x86_64 --entry=begin -z max-page-size=0x1000 -z separate-code" \
 	"" \
 	"" \
 	{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" \
+	"-m elf_x86_64 --entry=begin -z max-page-size=0x1000 -z separate-code" \
 	"" \
 	"" \
 	{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" \
+	"-m elf_x86_64 --entry=begin -z max-page-size=0x1000 -z separate-code" \
 	"" \
 	"" \
 	{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" \
+	"-m elf_x86_64 --entry=begin -z max-page-size=0x1000 -z separate-code" \
 	"" \
 	"" \
 	{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" \
+	"-m elf_x86_64 --entry=begin -z max-page-size=0x1000 -z separate-code" \
 	"" \
 	"" \
 	{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" \
+	"-m elf_x86_64 --entry=main -z max-page-size=0x1000 -z separate-code" \
 	"" \
 	"" \
 	{pe-x86-64-6.obj.bz2 } \
diff --git a/ld/testsuite/ld-x86-64/pr19609-4e.d b/ld/testsuite/ld-x86-64/pr19609-4e.d
index 48adc947e75..ed6e6e0bcca 100644
--- a/ld/testsuite/ld-x86-64/pr19609-4e.d
+++ b/ld/testsuite/ld-x86-64/pr19609-4e.d
@@ -1,6 +1,6 @@
 #source: pr19609-4.s
 #as: --64 -mrelax-relocations=yes
-#ld: -melf_x86_64 -Ttext=0x70000000 -Tdata=0xa0000000 --no-relax
+#ld: -melf_x86_64 -Ttext=0x70000000 -Tdata=0xa0000000 --no-relax -z max-page-size=0x1000 -z separate-code
 #objdump: -dw
 
 .*: +file format .*
diff --git a/ld/testsuite/ld-x86-64/pr19609-6a.d b/ld/testsuite/ld-x86-64/pr19609-6a.d
index 265825d4c6c..3bad8b55fd6 100644
--- a/ld/testsuite/ld-x86-64/pr19609-6a.d
+++ b/ld/testsuite/ld-x86-64/pr19609-6a.d
@@ -1,6 +1,6 @@
 #source: pr19609-6.s
 #as: --64 -mrelax-relocations=yes
-#ld: -melf_x86_64 --defsym foobar=0x80000000
+#ld: -melf_x86_64 --defsym foobar=0x80000000 -z max-page-size=0x1000 -z separate-code
 #objdump: -dw
 
 .*: +file format .*
diff --git a/ld/testsuite/ld-x86-64/pr19609-6b.d b/ld/testsuite/ld-x86-64/pr19609-6b.d
index 1f769eff4d3..2723fb1b980 100644
--- a/ld/testsuite/ld-x86-64/pr19609-6b.d
+++ b/ld/testsuite/ld-x86-64/pr19609-6b.d
@@ -1,6 +1,6 @@
 #source: pr19609-6.s
 #as: --64 -mrelax-relocations=yes
-#ld: -melf_x86_64 --defsym foobar=0x80000000 --no-relax
+#ld: -melf_x86_64 --defsym foobar=0x80000000 --no-relax -z max-page-size=0x1000 -z separate-code
 #objdump: -dw
 
 .*: +file format .*
diff --git a/ld/testsuite/ld-x86-64/pr19609-7b.d b/ld/testsuite/ld-x86-64/pr19609-7b.d
index d85e5e9425d..48d0b01616d 100644
--- a/ld/testsuite/ld-x86-64/pr19609-7b.d
+++ b/ld/testsuite/ld-x86-64/pr19609-7b.d
@@ -1,6 +1,6 @@
 #source: pr19609-7.s
 #as: --64 -mrelax-relocations=yes
-#ld: -melf_x86_64 -Ttext=0x80000000 --no-relax
+#ld: -melf_x86_64 -Ttext=0x80000000 --no-relax -z max-page-size=0x1000 -z separate-code
 #objdump: -dw
 
 .*: +file format .*
diff --git a/ld/testsuite/ld-x86-64/pr19609-7d.d b/ld/testsuite/ld-x86-64/pr19609-7d.d
index 6eb511080dd..6e2882af3c9 100644
--- a/ld/testsuite/ld-x86-64/pr19609-7d.d
+++ b/ld/testsuite/ld-x86-64/pr19609-7d.d
@@ -1,6 +1,6 @@
 #source: pr19609-7.s
 #as: --x32 -mrelax-relocations=yes
-#ld: -melf32_x86_64 -Ttext=0x80000000 --no-relax
+#ld: -melf32_x86_64 -Ttext=0x80000000 --no-relax -z max-page-size=0x1000 -z separate-code
 #objdump: -dw
 
 .*: +file format .*
diff --git a/ld/testsuite/ld-x86-64/report-reloc-1.l b/ld/testsuite/ld-x86-64/report-reloc-1.l
index 669dff43bd7..21e9b1ee870 100644
--- a/ld/testsuite/ld-x86-64/report-reloc-1.l
+++ b/ld/testsuite/ld-x86-64/report-reloc-1.l
@@ -1,2 +1,2 @@
-tmpdir/dump: R_X86_64_IRELATIVE \(offset: 0x0+2000, info: 0x0+25, addend: 0x0+1007\) against 'ifunc' for section '.data.rel.ro.local' in tmpdir/report-reloc-1.o
-tmpdir/dump: R_X86_64_RELATIVE \(offset: 0x0+2008, info: 0x0+8, addend: 0x0+1000\) against '_start' for section '.data.rel.ro.local' in tmpdir/report-reloc-1.o
+tmpdir/dump: R_X86_64_IRELATIVE \(offset: 0x[0-9a-f]+, info: 0x0+25, addend: 0x[0-9a-f]+\) against 'ifunc' for section '.data.rel.ro.local' in tmpdir/report-reloc-1.o
+tmpdir/dump: R_X86_64_RELATIVE \(offset: 0x[0-9a-f]+, info: 0x0+8, addend: 0x[0-9a-f]+\) against '_start' for section '.data.rel.ro.local' in tmpdir/report-reloc-1.o
-- 
2.33.1



More information about the Binutils mailing list