aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-i386
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2022-01-05 16:01:08 -0800
committerH.J. Lu <hjl.tools@gmail.com>2022-01-12 06:04:52 -0800
commit4d9e2e53b9f93b0ae33ba948ae3d2825b3424441 (patch)
treec54f87d1e130339406ccfa3036412b82c963e3d6 /ld/testsuite/ld-i386
parent5af6f000d88622107e7382d337af2884fd211da2 (diff)
downloadgdb-4d9e2e53b9f93b0ae33ba948ae3d2825b3424441.zip
gdb-4d9e2e53b9f93b0ae33ba948ae3d2825b3424441.tar.gz
gdb-4d9e2e53b9f93b0ae33ba948ae3d2825b3424441.tar.bz2
ld: Add simple DT_RELR tests
* testsuite/ld-elf/dt-relr-1.s: New file. * testsuite/ld-elf/dt-relr-1a.d: Likewise. * testsuite/ld-elf/dt-relr-1b.d: Likewise. * testsuite/ld-elf/dt-relr-1c.d: Likewise. * testsuite/ld-elf/dt-relr-2.s: Likewise. * testsuite/ld-elf/dt-relr-2a.d: Likewise. * testsuite/ld-elf/dt-relr-2b.d: Likewise. * testsuite/ld-elf/dt-relr-2c.d: Likewise. * testsuite/ld-elf/dt-relr-2d.d: Likewise. * testsuite/ld-elf/dt-relr-2e.d: Likewise. * testsuite/ld-elf/dt-relr-2f.d: Likewise. * testsuite/ld-elf/dt-relr-2g.d: Likewise. * testsuite/ld-elf/dt-relr-2h.d: Likewise. * testsuite/ld-elf/dt-relr-3.s: Likewise. * testsuite/ld-elf/dt-relr-3a.d: Likewise. * testsuite/ld-elf/dt-relr-3b.d: Likewise. * testsuite/ld-i386/dt-relr-1.s: Likewise. * testsuite/ld-i386/dt-relr-1a.d: Likewise. * testsuite/ld-i386/dt-relr-1b.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/dt-relr-1.s: Likewise. * testsuite/ld-i386/i386.exp: Run dt-relr-1a and dt-relr-1b. * testsuite/ld-x86-64/x86-64.exp: Run dt-relr-1a, dt-relr-1a-x32 dt-relr-1b and dt-relr-1b-x32.
Diffstat (limited to 'ld/testsuite/ld-i386')
-rw-r--r--ld/testsuite/ld-i386/dt-relr-1.s14
-rw-r--r--ld/testsuite/ld-i386/dt-relr-1a.d27
-rw-r--r--ld/testsuite/ld-i386/dt-relr-1b.d30
-rw-r--r--ld/testsuite/ld-i386/i386.exp2
4 files changed, 73 insertions, 0 deletions
diff --git a/ld/testsuite/ld-i386/dt-relr-1.s b/ld/testsuite/ld-i386/dt-relr-1.s
new file mode 100644
index 0000000..0349392
--- /dev/null
+++ b/ld/testsuite/ld-i386/dt-relr-1.s
@@ -0,0 +1,14 @@
+ .text
+foo:
+ call func1@PLT
+ pushl __ehdr_start@GOT(%ebx)
+
+ .section .bar,"aw",@progbits
+ .p2align 2
+ .dc.a data1
+ .dc.a __ehdr_start
+
+ .section .foo,"aw",@progbits
+ .p2align 2
+ .dc.a data1
+ .dc.a __ehdr_start
diff --git a/ld/testsuite/ld-i386/dt-relr-1a.d b/ld/testsuite/ld-i386/dt-relr-1a.d
new file mode 100644
index 0000000..cbb8ab6
--- /dev/null
+++ b/ld/testsuite/ld-i386/dt-relr-1a.d
@@ -0,0 +1,27 @@
+#source: dt-relr-1.s
+#as: --32
+#ld: -shared -melf_i386 $DT_RELR_LDFLAGS
+#readelf: -r -s --wide
+#target: x86_64-*-linux* i?86-*-linux-gnu i?86-*-gnu*
+
+Relocation section '\.rel\.dyn' at offset [0x0-9a-f]+ contains 2 entries:
+ +Offset +Info +Type +Sym. Value +Symbol's Name
+[0-9a-f]+ +[0-9a-f]+ +R_386_32 +0+ +data1
+[0-9a-f]+ +[0-9a-f]+ +R_386_32 +0+ +data1
+
+Relocation section '\.rel\.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_JUMP_SLOT +0+ +func1
+
+Relocation section '.relr.dyn' at offset 0x[a-f0-9]+ contains 2 entries:
+ +3 offsets
+[a-f0-9]+
+[a-f0-9]+
+[a-f0-9]+
+
+#...
+Symbol table '.symtab' contains [0-9]+ entries:
+ Num: Value Size Type Bind Vis Ndx Name
+#...
+ +[a-f0-9]+: 00000000 0 NOTYPE LOCAL DEFAULT 1 __ehdr_start
+#pass
diff --git a/ld/testsuite/ld-i386/dt-relr-1b.d b/ld/testsuite/ld-i386/dt-relr-1b.d
new file mode 100644
index 0000000..3dd9881
--- /dev/null
+++ b/ld/testsuite/ld-i386/dt-relr-1b.d
@@ -0,0 +1,30 @@
+#source: dt-relr-1.s
+#as: --32
+#ld: -shared -melf_i386 $DT_RELR_LDFLAGS -z nocombreloc
+#readelf: -r -s --wide
+#target: x86_64-*-linux* i?86-*-linux-gnu i?86-*-gnu*
+
+Relocation section '\.rel\.bar' at offset [0x0-9a-f]+ contains 1 entry:
+ +Offset +Info +Type +Sym. Value +Symbol's Name
+[0-9a-f]+ +[0-9a-f]+ +R_386_32 +0+ +data1
+
+Relocation section '\.rel\.foo' at offset [0x0-9a-f]+ contains 1 entry:
+ +Offset +Info +Type +Sym. Value +Symbol's Name
+[0-9a-f]+ +[0-9a-f]+ +R_386_32 +0+ +data1
+
+Relocation section '\.rel\.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_JUMP_SLOT +0+ +func1
+
+Relocation section '.relr.dyn' at offset 0x[a-f0-9]+ contains 2 entries:
+ +3 offsets
+[a-f0-9]+
+[a-f0-9]+
+[a-f0-9]+
+
+#...
+Symbol table '.symtab' contains [0-9]+ entries:
+ Num: Value Size Type Bind Vis Ndx Name
+#...
+ +[a-f0-9]+: 00000000 0 NOTYPE LOCAL DEFAULT 1 __ehdr_start
+#pass
diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp
index c2d8d82..fe36b0f 100644
--- a/ld/testsuite/ld-i386/i386.exp
+++ b/ld/testsuite/ld-i386/i386.exp
@@ -507,6 +507,8 @@ run_dump_test "pr27491-1c"
run_dump_test "pr27491-2"
run_dump_test "pr27491-3"
run_dump_test "pr27491-4"
+run_dump_test "dt-relr-1a"
+run_dump_test "dt-relr-1b"
if { !([istarget "i?86-*-linux*"]
|| [istarget "i?86-*-gnu*"]