aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@imgtec.com>2016-07-26 17:45:00 +0100
committerMaciej W. Rozycki <macro@imgtec.com>2016-07-26 20:00:48 +0100
commit54806ffa85643c3a1ee721d5c3f5586d32f86ee1 (patch)
treef23e2aec8ed954c4650d21b5b46638c8c9523ec2 /ld/testsuite
parent40c31709c6a51926fcb409611caa52b2da6515c0 (diff)
downloadgdb-54806ffa85643c3a1ee721d5c3f5586d32f86ee1.zip
gdb-54806ffa85643c3a1ee721d5c3f5586d32f86ee1.tar.gz
gdb-54806ffa85643c3a1ee721d5c3f5586d32f86ee1.tar.bz2
MIPS/BFD: Handle branches in PLT compression selection
Complement: commit 1bbce132647e6d72aaa065cce5c1d5dd6585c2b2 Author: Maciej W. Rozycki <macro@linux-mips.org> Date: Mon Jun 24 23:55:46 2013 +0000 <https://sourceware.org/ml/binutils/2013-06/msg00077.html>, ("MIPS: Compressed PLT/stubs support"), and also choose between regular and compressed PLT entries as appropriate for any branches referring. bfd/ * elfxx-mips.c (mips_elf_calculate_relocation): Handle branches in PLT compression selection. (_bfd_mips_elf_check_relocs): Likewise. ld/ * testsuite/ld-mips-elf/compressed-plt-1.s: Add branch support. * testsuite/ld-mips-elf/compressed-plt-1a.s: Likewise. * testsuite/ld-mips-elf/compressed-plt-1b.s: Likewise. * testsuite/ld-mips-elf/compressed-plt-1-o32-branch.od: New test. * testsuite/ld-mips-elf/compressed-plt-1-o32-branch.rd: New test. * testsuite/ld-mips-elf/compressed-plt-1-o32-mips16-bronly.od: New test. * testsuite/ld-mips-elf/compressed-plt-1-o32-mips16-bronly.rd: New test. * testsuite/ld-mips-elf/compressed-plt-1-o32-mips16-branch.od: New test. * testsuite/ld-mips-elf/compressed-plt-1-o32-mips16-branch.rd: New test. * testsuite/ld-mips-elf/compressed-plt-1-o32-umips-bronly.od: New test. * testsuite/ld-mips-elf/compressed-plt-1-o32-umips-bronly.rd: New test. * testsuite/ld-mips-elf/compressed-plt-1-o32-umips-branch.od: New test. * testsuite/ld-mips-elf/compressed-plt-1-o32-umips-branch.rd: New test. * testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ld-mips-elf/compressed-plt-1-o32-branch.od30
-rw-r--r--ld/testsuite/ld-mips-elf/compressed-plt-1-o32-branch.rd44
-rw-r--r--ld/testsuite/ld-mips-elf/compressed-plt-1-o32-mips16-branch.od69
-rw-r--r--ld/testsuite/ld-mips-elf/compressed-plt-1-o32-mips16-branch.rd49
-rw-r--r--ld/testsuite/ld-mips-elf/compressed-plt-1-o32-mips16-bronly.od32
-rw-r--r--ld/testsuite/ld-mips-elf/compressed-plt-1-o32-mips16-bronly.rd43
-rw-r--r--ld/testsuite/ld-mips-elf/compressed-plt-1-o32-umips-branch.od69
-rw-r--r--ld/testsuite/ld-mips-elf/compressed-plt-1-o32-umips-branch.rd49
-rw-r--r--ld/testsuite/ld-mips-elf/compressed-plt-1-o32-umips-bronly.od33
-rw-r--r--ld/testsuite/ld-mips-elf/compressed-plt-1-o32-umips-bronly.rd43
-rw-r--r--ld/testsuite/ld-mips-elf/compressed-plt-1.s28
-rw-r--r--ld/testsuite/ld-mips-elf/compressed-plt-1a.s12
-rw-r--r--ld/testsuite/ld-mips-elf/compressed-plt-1b.s8
-rw-r--r--ld/testsuite/ld-mips-elf/mips-elf.exp35
14 files changed, 520 insertions, 24 deletions
diff --git a/ld/testsuite/ld-mips-elf/compressed-plt-1-o32-branch.od b/ld/testsuite/ld-mips-elf/compressed-plt-1-o32-branch.od
new file mode 100644
index 0000000..d88dbcc
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/compressed-plt-1-o32-branch.od
@@ -0,0 +1,30 @@
+
+.* file format .*
+
+
+Disassembly of section \.plt:
+
+10100000 <_PROCEDURE_LINKAGE_TABLE_>:
+.*: 3c1c1020 lui \$28,0x1020
+.*: 8f990000 lw \$25,0\(\$28\)
+.*: 279c0000 addiu \$28,\$28,0
+.*: 031cc023 subu \$24,\$24,\$28
+.*: 03e07825 move \$15,\$31
+.*: 0018c082 srl \$24,\$24,0x2
+.*: 0320f809 jalr \$25
+.*: 2718fffe addiu \$24,\$24,-2
+
+10100020 <f_bu@plt>:
+.*: 3c0f1020 lui \$15,0x1020
+.*: 8df90008 lw \$25,8\(\$15\)
+.*: 03200008 jr \$25
+.*: 25f80008 addiu \$24,\$15,8
+
+Disassembly of section \.text\.b:
+
+10101000 <testu>:
+.*: 0411fc07 bal 10100020 <f_bu@plt>
+.*: 00000000 nop
+.*: 1000fc05 b 10100020 <f_bu@plt>
+.*: 00000000 nop
+.*: 03e00008 jr \$31
diff --git a/ld/testsuite/ld-mips-elf/compressed-plt-1-o32-branch.rd b/ld/testsuite/ld-mips-elf/compressed-plt-1-o32-branch.rd
new file mode 100644
index 0000000..372db52
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/compressed-plt-1-o32-branch.rd
@@ -0,0 +1,44 @@
+
+Dynamic section .*
+#...
+ 0x00000003 \(PLTGOT\) 0x10201000
+#...
+ 0x70000013 \(MIPS_GOTSYM\) 0x4
+ 0x00000014 \(PLTREL\) REL
+ 0x00000017 \(JMPREL\) 0x10004000
+ 0x00000002 \(PLTRELSZ\) 8 \(bytes\)
+ 0x70000032 \(MIPS_PLTGOT\) 0x10200000
+#...
+Relocation section '\.rel\.plt' .*
+ Offset Info Type Sym\.Value Sym\. Name
+10200008 [^ ]+ R_MIPS_JUMP_SLOT 00000000 f_bu
+
+Symbol table '\.dynsym' .*
+ Num: Value Size Type Bind Vis Ndx Name
+ 0: 00000000 0 NOTYPE LOCAL DEFAULT UND
+#...
+ .*: 00000000 0 FUNC GLOBAL DEFAULT UND f_bu
+
+Symbol table '\.symtab' .*
+#...
+Primary GOT:
+ Canonical gp value: 10208ff0
+
+ Reserved entries:
+ Address Access Initial Purpose
+ 10201000 -32752\(gp\) 00000000 Lazy resolver
+ 10201004 -32748\(gp\) 80000000 Module pointer \(GNU extension\)
+
+
+PLT GOT:
+
+ Reserved entries:
+ Address Initial Purpose
+ 10200000 00000000 PLT lazy resolver
+ 10200004 00000000 Module pointer
+
+ Entries:
+ Address Initial Sym\.Val\. Type Ndx Name
+ 10200008 10100000 00000000 FUNC UND f_bu
+
+
diff --git a/ld/testsuite/ld-mips-elf/compressed-plt-1-o32-mips16-branch.od b/ld/testsuite/ld-mips-elf/compressed-plt-1-o32-mips16-branch.od
new file mode 100644
index 0000000..f195b93
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/compressed-plt-1-o32-mips16-branch.od
@@ -0,0 +1,69 @@
+
+.* file format .*
+
+
+Disassembly of section \.plt:
+
+# Only _bc (branch from compressed code) functions should have a
+# MIPS16 PLT.
+10100000 <_PROCEDURE_LINKAGE_TABLE_>:
+.*: 3c1c1020 lui \$28,0x1020
+.*: 8f990000 lw \$25,0\(\$28\)
+.*: 279c0000 addiu \$28,\$28,0
+.*: 031cc023 subu \$24,\$24,\$28
+.*: 03e07825 move \$15,\$31
+.*: 0018c082 srl \$24,\$24,0x2
+.*: 0320f809 jalr \$25
+.*: 2718fffe addiu \$24,\$24,-2
+
+10100020 <f_bu_bc@plt>:
+.*: 3c0f1020 lui \$15,0x1020
+.*: 8df90008 lw \$25,8\(\$15\)
+.*: 03200008 jr \$25
+.*: 25f80008 addiu \$24,\$15,8
+
+10100030 <f_bu@plt>:
+.*: 3c0f1020 lui \$15,0x1020
+.*: 8df9000c lw \$25,12\(\$15\)
+.*: 03200008 jr \$25
+.*: 25f8000c addiu \$24,\$15,12
+
+10100040 <f_bu_bc@mips16plt>:
+.*: b203 lw \$2,1010004c <f_bu_bc@mips16plt\+0xc>
+.*: 9a60 lw \$3,0\(\$2\)
+.*: 651a move \$24,\$2
+.*: eb00 jr \$3
+.*: 653b move \$25,\$3
+.*: 6500 nop
+.*: .... .... \.word 0x10200008
+
+10100050 <f_bc@mips16plt>:
+.*: b203 lw \$2,1010005c <f_bc@mips16plt\+0xc>
+.*: 9a60 lw \$3,0\(\$2\)
+.*: 651a move \$24,\$2
+.*: eb00 jr \$3
+.*: 653b move \$25,\$3
+.*: 6500 nop
+.*: .... .... \.word 0x10200010
+
+Disassembly of section \.text\.a:
+
+10101000 <testc>:
+.*: f03f 1006 b 10100050 <f_bc@mips16plt>
+.*: 6500 nop
+.*: f01f 101b b 10100040 <f_bu_bc@mips16plt>
+.*: 6500 nop
+.*: e820 jr \$31
+
+Disassembly of section \.text\.b:
+
+10102000 <testu>:
+.*: 0411f80b bal 10100030 <f_bu@plt>
+.*: 00000000 nop
+.*: 1000f809 b 10100030 <f_bu@plt>
+.*: 00000000 nop
+.*: 0411f803 bal 10100020 <f_bu_bc@plt>
+.*: 00000000 nop
+.*: 1000f801 b 10100020 <f_bu_bc@plt>
+.*: 00000000 nop
+.*: 03e00008 jr \$31
diff --git a/ld/testsuite/ld-mips-elf/compressed-plt-1-o32-mips16-branch.rd b/ld/testsuite/ld-mips-elf/compressed-plt-1-o32-mips16-branch.rd
new file mode 100644
index 0000000..86cc3c8
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/compressed-plt-1-o32-mips16-branch.rd
@@ -0,0 +1,49 @@
+
+Dynamic section .*
+#...
+ 0x00000003 \(PLTGOT\) 0x10201000
+#...
+ 0x70000013 \(MIPS_GOTSYM\) 0x6
+ 0x00000014 \(PLTREL\) REL
+ 0x00000017 \(JMPREL\) 0x10004000
+ 0x00000002 \(PLTRELSZ\) 24 \(bytes\)
+ 0x70000032 \(MIPS_PLTGOT\) 0x10200000
+#...
+Relocation section '\.rel\.plt' .*
+ Offset Info Type Sym\.Value Sym\. Name
+10200008 [^ ]+ R_MIPS_JUMP_SLOT 00000000 f_bu_bc
+1020000c [^ ]+ R_MIPS_JUMP_SLOT 00000000 f_bu
+10200010 [^ ]+ R_MIPS_JUMP_SLOT 00000000 f_bc
+
+Symbol table '\.dynsym' .*
+ Num: Value Size Type Bind Vis Ndx Name
+ 0: 00000000 0 NOTYPE LOCAL DEFAULT UND
+#...
+ .*: 00000000 0 FUNC GLOBAL DEFAULT UND f_bu_bc
+ .*: 00000000 0 FUNC GLOBAL DEFAULT UND f_bu
+ .*: 00000000 0 FUNC GLOBAL DEFAULT UND f_bc
+
+Symbol table '\.symtab' .*
+#...
+Primary GOT:
+ Canonical gp value: 10208ff0
+
+ Reserved entries:
+ Address Access Initial Purpose
+ 10201000 -32752\(gp\) 00000000 Lazy resolver
+ 10201004 -32748\(gp\) 80000000 Module pointer \(GNU extension\)
+
+
+PLT GOT:
+
+ Reserved entries:
+ Address Initial Purpose
+ 10200000 00000000 PLT lazy resolver
+ 10200004 00000000 Module pointer
+
+ Entries:
+ Address Initial Sym\.Val\. Type Ndx Name
+ 10200008 10100000 00000000 FUNC UND f_bu_bc
+ 1020000c 10100000 00000000 FUNC UND f_bu
+ 10200010 10100000 00000000 FUNC UND f_bc
+
diff --git a/ld/testsuite/ld-mips-elf/compressed-plt-1-o32-mips16-bronly.od b/ld/testsuite/ld-mips-elf/compressed-plt-1-o32-mips16-bronly.od
new file mode 100644
index 0000000..4022a19
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/compressed-plt-1-o32-mips16-bronly.od
@@ -0,0 +1,32 @@
+
+.* file format .*
+
+
+Disassembly of section \.plt:
+
+# Direct branches must have a MIPS16 PLT.
+10100000 <_PROCEDURE_LINKAGE_TABLE_>:
+.*: 3c1c1020 lui \$28,0x1020
+.*: 8f990000 lw \$25,0\(\$28\)
+.*: 279c0000 addiu \$28,\$28,0
+.*: 031cc023 subu \$24,\$24,\$28
+.*: 03e07825 move \$15,\$31
+.*: 0018c082 srl \$24,\$24,0x2
+.*: 0320f809 jalr \$25
+.*: 2718fffe addiu \$24,\$24,-2
+
+10100020 <f_bc@mips16plt>:
+.*: b203 lw \$2,1010002c <f_bc@mips16plt\+0xc>
+.*: 9a60 lw \$3,0\(\$2\)
+.*: 651a move \$24,\$2
+.*: eb00 jr \$3
+.*: 653b move \$25,\$3
+.*: 6500 nop
+.*: .... .... \.word 0x10200008
+
+Disassembly of section \.text\.a:
+
+10101000 <testc>:
+.*: f01f 100e b 10100020 <f_bc@mips16plt>
+.*: 6500 nop
+.*: e820 jr \$31
diff --git a/ld/testsuite/ld-mips-elf/compressed-plt-1-o32-mips16-bronly.rd b/ld/testsuite/ld-mips-elf/compressed-plt-1-o32-mips16-bronly.rd
new file mode 100644
index 0000000..648159e
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/compressed-plt-1-o32-mips16-bronly.rd
@@ -0,0 +1,43 @@
+
+Dynamic section .*
+#...
+ 0x00000003 \(PLTGOT\) 0x10201000
+#...
+ 0x70000013 \(MIPS_GOTSYM\) 0x4
+ 0x00000014 \(PLTREL\) REL
+ 0x00000017 \(JMPREL\) 0x10004000
+ 0x00000002 \(PLTRELSZ\) 8 \(bytes\)
+ 0x70000032 \(MIPS_PLTGOT\) 0x10200000
+#...
+Relocation section '\.rel\.plt' .*
+ Offset Info Type Sym\.Value Sym\. Name
+10200008 [^ ]+ R_MIPS_JUMP_SLOT 00000000 f_bc
+
+Symbol table '\.dynsym' .*
+ Num: Value Size Type Bind Vis Ndx Name
+ 0: 00000000 0 NOTYPE LOCAL DEFAULT UND
+#...
+ .*: 00000000 0 FUNC GLOBAL DEFAULT UND f_bc
+
+Symbol table '\.symtab' contains 34 entries:
+#...
+Primary GOT:
+ Canonical gp value: 10208ff0
+
+ Reserved entries:
+ Address Access Initial Purpose
+ 10201000 -32752\(gp\) 00000000 Lazy resolver
+ 10201004 -32748\(gp\) 80000000 Module pointer \(GNU extension\)
+
+
+PLT GOT:
+
+ Reserved entries:
+ Address Initial Purpose
+ 10200000 00000000 PLT lazy resolver
+ 10200004 00000000 Module pointer
+
+ Entries:
+ Address Initial Sym\.Val\. Type Ndx Name
+ 10200008 10100000 00000000 FUNC UND f_bc
+
diff --git a/ld/testsuite/ld-mips-elf/compressed-plt-1-o32-umips-branch.od b/ld/testsuite/ld-mips-elf/compressed-plt-1-o32-umips-branch.od
new file mode 100644
index 0000000..5fa5e7d
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/compressed-plt-1-o32-umips-branch.od
@@ -0,0 +1,69 @@
+
+.* file format .*
+
+
+Disassembly of section \.plt:
+
+# Only _bc (branch from compressed code) functions should have a
+# microMIPS PLT.
+10100000 <_PROCEDURE_LINKAGE_TABLE_>:
+.*: 3c1c1020 lui \$28,0x1020
+.*: 8f990000 lw \$25,0\(\$28\)
+.*: 279c0000 addiu \$28,\$28,0
+.*: 031cc023 subu \$24,\$24,\$28
+.*: 03e07825 move \$15,\$31
+.*: 0018c082 srl \$24,\$24,0x2
+.*: 0320f809 jalr \$25
+.*: 2718fffe addiu \$24,\$24,-2
+
+10100020 <f_bu_bc@plt>:
+.*: 3c0f1020 lui \$15,0x1020
+.*: 8df90008 lw \$25,8\(\$15\)
+.*: 03200008 jr \$25
+.*: 25f80008 addiu \$24,\$15,8
+
+10100030 <f_bu@plt>:
+.*: 3c0f1020 lui \$15,0x1020
+.*: 8df9000c lw \$25,12\(\$15\)
+.*: 03200008 jr \$25
+.*: 25f8000c addiu \$24,\$15,12
+
+10100040 <f_bu_bc@micromipsplt>:
+.*: 7903 fff2 addiu \$2,\$pc,1048520
+# ^ 0x10200008
+.*: ff22 0000 lw \$25,0\(\$2\)
+.*: 4599 jr \$25
+.*: 0f02 move \$24,\$2
+
+1010004c <f_bc@micromipsplt>:
+.*: 7903 fff1 addiu \$2,\$pc,1048516
+# ^ 0x10200010
+.*: ff22 0000 lw \$25,0\(\$2\)
+.*: 4599 jr \$25
+.*: 0f02 move \$24,\$2
+
+Disassembly of section \.text\.a:
+
+10101000 <testc>:
+.*: 4060 f824 bal 1010004c <f_bc@micromipsplt>
+.*: 0000 0000 nop
+.*: 9400 f820 b 1010004c <f_bc@micromipsplt>
+.*: 0c00 nop
+.*: 4060 f817 bal 10100040 <f_bu_bc@micromipsplt>
+.*: 0000 0000 nop
+.*: 9400 f813 b 10100040 <f_bu_bc@micromipsplt>
+.*: 0c00 nop
+.*: 459f jr \$31
+
+Disassembly of section \.text\.b:
+
+10102000 <testu>:
+.*: 0411f80b bal 10100030 <f_bu@plt>
+.*: 00000000 nop
+.*: 1000f809 b 10100030 <f_bu@plt>
+.*: 00000000 nop
+.*: 0411f803 bal 10100020 <f_bu_bc@plt>
+.*: 00000000 nop
+.*: 1000f801 b 10100020 <f_bu_bc@plt>
+.*: 00000000 nop
+.*: 03e00008 jr \$31
diff --git a/ld/testsuite/ld-mips-elf/compressed-plt-1-o32-umips-branch.rd b/ld/testsuite/ld-mips-elf/compressed-plt-1-o32-umips-branch.rd
new file mode 100644
index 0000000..86cc3c8
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/compressed-plt-1-o32-umips-branch.rd
@@ -0,0 +1,49 @@
+
+Dynamic section .*
+#...
+ 0x00000003 \(PLTGOT\) 0x10201000
+#...
+ 0x70000013 \(MIPS_GOTSYM\) 0x6
+ 0x00000014 \(PLTREL\) REL
+ 0x00000017 \(JMPREL\) 0x10004000
+ 0x00000002 \(PLTRELSZ\) 24 \(bytes\)
+ 0x70000032 \(MIPS_PLTGOT\) 0x10200000
+#...
+Relocation section '\.rel\.plt' .*
+ Offset Info Type Sym\.Value Sym\. Name
+10200008 [^ ]+ R_MIPS_JUMP_SLOT 00000000 f_bu_bc
+1020000c [^ ]+ R_MIPS_JUMP_SLOT 00000000 f_bu
+10200010 [^ ]+ R_MIPS_JUMP_SLOT 00000000 f_bc
+
+Symbol table '\.dynsym' .*
+ Num: Value Size Type Bind Vis Ndx Name
+ 0: 00000000 0 NOTYPE LOCAL DEFAULT UND
+#...
+ .*: 00000000 0 FUNC GLOBAL DEFAULT UND f_bu_bc
+ .*: 00000000 0 FUNC GLOBAL DEFAULT UND f_bu
+ .*: 00000000 0 FUNC GLOBAL DEFAULT UND f_bc
+
+Symbol table '\.symtab' .*
+#...
+Primary GOT:
+ Canonical gp value: 10208ff0
+
+ Reserved entries:
+ Address Access Initial Purpose
+ 10201000 -32752\(gp\) 00000000 Lazy resolver
+ 10201004 -32748\(gp\) 80000000 Module pointer \(GNU extension\)
+
+
+PLT GOT:
+
+ Reserved entries:
+ Address Initial Purpose
+ 10200000 00000000 PLT lazy resolver
+ 10200004 00000000 Module pointer
+
+ Entries:
+ Address Initial Sym\.Val\. Type Ndx Name
+ 10200008 10100000 00000000 FUNC UND f_bu_bc
+ 1020000c 10100000 00000000 FUNC UND f_bu
+ 10200010 10100000 00000000 FUNC UND f_bc
+
diff --git a/ld/testsuite/ld-mips-elf/compressed-plt-1-o32-umips-bronly.od b/ld/testsuite/ld-mips-elf/compressed-plt-1-o32-umips-bronly.od
new file mode 100644
index 0000000..2290852
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/compressed-plt-1-o32-umips-bronly.od
@@ -0,0 +1,33 @@
+
+.* file format .*
+
+
+Disassembly of section \.plt:
+
+# All entries must be microMIPS.
+10100000 <_PROCEDURE_LINKAGE_TABLE_>:
+.*: 7984 0000 addiu \$3,\$pc,1048576
+.*: ff23 0000 lw \$25,0\(\$3\)
+.*: 0535 subu \$2,\$2,\$3
+.*: 2525 srl \$2,\$2,2
+.*: 3302 fffe addiu \$24,\$2,-2
+.*: 0dff move \$15,\$31
+.*: 45f9 jalrs \$25
+.*: 0f83 move \$28,\$3
+.*: 0c00 nop
+
+10100018 <f_bc@micromipsplt>:
+.*: 7903 fffc addiu \$2,\$pc,1048560
+# ^ 0x10200008
+.*: ff22 0000 lw \$25,0\(\$2\)
+.*: 4599 jr \$25
+.*: 0f02 move \$24,\$2
+
+Disassembly of section \.text\.a:
+
+10101000 <testc>:
+.*: 4060 f80a bal 10100018 <f_bc@micromipsplt>
+.*: 0000 0000 nop
+.*: 9400 f806 b 10100018 <f_bc@micromipsplt>
+.*: 0c00 nop
+.*: 459f jr \$31
diff --git a/ld/testsuite/ld-mips-elf/compressed-plt-1-o32-umips-bronly.rd b/ld/testsuite/ld-mips-elf/compressed-plt-1-o32-umips-bronly.rd
new file mode 100644
index 0000000..9b02330
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/compressed-plt-1-o32-umips-bronly.rd
@@ -0,0 +1,43 @@
+
+Dynamic section .*
+#...
+ 0x00000003 \(PLTGOT\) 0x10201000
+#...
+ 0x70000013 \(MIPS_GOTSYM\) 0x4
+ 0x00000014 \(PLTREL\) REL
+ 0x00000017 \(JMPREL\) 0x10004000
+ 0x00000002 \(PLTRELSZ\) 8 \(bytes\)
+ 0x70000032 \(MIPS_PLTGOT\) 0x10200000
+#...
+Relocation section '\.rel\.plt' .*
+ Offset Info Type Sym\.Value Sym\. Name
+10200008 [^ ]+ R_MIPS_JUMP_SLOT 00000000 f_bc
+
+Symbol table '\.dynsym' .*
+ Num: Value Size Type Bind Vis Ndx Name
+ 0: 00000000 0 NOTYPE LOCAL DEFAULT UND
+#...
+ .*: 00000000 0 FUNC GLOBAL DEFAULT UND f_bc
+
+Symbol table '\.symtab' .*
+#...
+Primary GOT:
+ Canonical gp value: 10208ff0
+
+ Reserved entries:
+ Address Access Initial Purpose
+ 10201000 -32752\(gp\) 00000000 Lazy resolver
+ 10201004 -32748\(gp\) 80000000 Module pointer \(GNU extension\)
+
+
+PLT GOT:
+
+ Reserved entries:
+ Address Initial Purpose
+ 10200000 00000000 PLT lazy resolver
+ 10200004 00000000 Module pointer
+
+ Entries:
+ Address Initial Sym\.Val\. Type Ndx Name
+ 10200008 10100001 00000000 FUNC UND f_bc
+
diff --git a/ld/testsuite/ld-mips-elf/compressed-plt-1.s b/ld/testsuite/ld-mips-elf/compressed-plt-1.s
index aa0b497..7e7bdaa 100644
--- a/ld/testsuite/ld-mips-elf/compressed-plt-1.s
+++ b/ld/testsuite/ld-mips-elf/compressed-plt-1.s
@@ -13,10 +13,12 @@ __call_stub_\name:
# Flags to specify how a particular function is referenced
.equ DC, 1 # Direct call from "compressed" code
- .equ IC, 2 # Indirect call from "compressed" code
- .equ DU, 4 # Direct call from "uncompressed" code
- .equ IU, 8 # Indirect call from "uncompressed" code
- .equ LO, 16 # Direct address reference (%lo)
+ .equ BC, 2 # Branch from "compressed" code
+ .equ IC, 4 # Indirect call from "compressed" code
+ .equ DU, 8 # Direct call from "uncompressed" code
+ .equ BU, 16 # Branch from "uncompressed" code
+ .equ IU, 32 # Indirect call from "uncompressed" code
+ .equ LO, 64 # Direct address reference (%lo)
# A wrapper around a macro called test_one, which is defined by
# the file that includes this one. NAME is the name of a function
@@ -35,9 +37,14 @@ __call_stub_\name:
test_filter \name\()_dc, (\flags | DC)
.endm
- .macro test_all_ic, name, flags
+ .macro test_all_bc, name, flags
test_all_dc \name, \flags
- test_all_dc \name\()_ic, (\flags | IC)
+ test_all_dc \name\()_bc, (\flags | BC)
+ .endm
+
+ .macro test_all_ic, name, flags
+ test_all_bc \name, \flags
+ test_all_bc \name\()_ic, (\flags | IC)
.endm
.macro test_all_du, name, flags
@@ -45,9 +52,14 @@ __call_stub_\name:
test_all_ic \name\()_du, (\flags | DU)
.endm
- .macro test_all_iu, name, flags
+ .macro test_all_bu, name, flags
test_all_du \name, \flags
- test_all_du \name\()_iu, (\flags | IU)
+ test_all_du \name\()_bu, (\flags | BU)
+ .endm
+
+ .macro test_all_iu, name, flags
+ test_all_bu \name, \flags
+ test_all_bu \name\()_iu, (\flags | IU)
.endm
.macro test_all_lo, name, flags
diff --git a/ld/testsuite/ld-mips-elf/compressed-plt-1a.s b/ld/testsuite/ld-mips-elf/compressed-plt-1a.s
index d5c6b4f..ad2ae79 100644
--- a/ld/testsuite/ld-mips-elf/compressed-plt-1a.s
+++ b/ld/testsuite/ld-mips-elf/compressed-plt-1a.s
@@ -1,4 +1,4 @@
-# Define a function with all "compressed" (dc and ic) references.
+# Define a function with all "compressed" (dc, bc and ic) references.
.abicalls
.option pic0
@@ -16,6 +16,16 @@
.endif
.endif
.endif
+ .if (\types) & BC
+ .if micromips
+ bal \name
+ nop
+ .endif
+ .ifdef o32
+ b \name
+ nop
+ .endif
+ .endif
.if (\types) & IC
lw $2, %call16(\name)($3)
.endif
diff --git a/ld/testsuite/ld-mips-elf/compressed-plt-1b.s b/ld/testsuite/ld-mips-elf/compressed-plt-1b.s
index 33deccb..5a3f454 100644
--- a/ld/testsuite/ld-mips-elf/compressed-plt-1b.s
+++ b/ld/testsuite/ld-mips-elf/compressed-plt-1b.s
@@ -1,4 +1,4 @@
-# Define a function with all "uncompressed" (du and iu) references.
+# Define a function with all "uncompressed" (du, bu and iu) references.
.abicalls
.option pic0
@@ -12,6 +12,12 @@
j \name
nop
.endif
+ .if (\types) & BU
+ bal \name
+ nop
+ b \name
+ nop
+ .endif
.if (\types) & IU
lw $2, %call16(\name)($3)
.endif
diff --git a/ld/testsuite/ld-mips-elf/mips-elf.exp b/ld/testsuite/ld-mips-elf/mips-elf.exp
index 10a4339..731f419 100644
--- a/ld/testsuite/ld-mips-elf/mips-elf.exp
+++ b/ld/testsuite/ld-mips-elf/mips-elf.exp
@@ -974,13 +974,13 @@ proc run_mips_plt_test { name abi filter micromips suffix {extra {}} } {
set ld_flags "$abi_ldflags($abi) -T compressed-plt-1.ld"
set dynobj "tmpdir/compressed-plt-1-${abi}-dyn.so"
set files [list]
- if { $filter & 3 } {
+ if { $filter & 7 } {
lappend files compressed-plt-1a.s
}
- if { $filter & 12 } {
+ if { $filter & 56 } {
lappend files compressed-plt-1b.s
}
- if { $filter & 16 } {
+ if { $filter & 64 } {
lappend files compressed-plt-1c.s
}
eval [list lappend files] $extra
@@ -1000,28 +1000,35 @@ proc run_mips_plt_test { name abi filter micromips suffix {extra {}} } {
if { $linux_gnu } {
build_mips_plt_lib o32
- run_mips_plt_test "o32 PLTs for standard encoding" o32 28 0 se
- run_mips_plt_test "o32 PLTs for MIPS16 encoding" o32 19 0 mips16-only
- run_mips_plt_test "o32 PLTs for microMIPS encoding" o32 19 1 umips-only
+ run_mips_plt_test "o32 PLTs for standard encoding" o32 104 0 se
+ run_mips_plt_test "o32 PLTs for standard branches" o32 16 0 branch
+ run_mips_plt_test "o32 PLTs for MIPS16 encoding" o32 69 0 mips16-only
+ run_mips_plt_test "o32 PLTs for MIPS16 branches" o32 2 0 mips16-bronly
+ run_mips_plt_test "o32 PLTs for microMIPS encoding" o32 69 1 umips-only
+ run_mips_plt_test "o32 PLTs for microMIPS branches" o32 2 1 umips-bronly
run_mips_plt_test "o32 PLTs for mixed MIPS and MIPS16" \
- o32 -1 0 mips16
+ o32 109 0 mips16
+ run_mips_plt_test "o32 PLTs for mixed MIPS and MIPS16 branches" \
+ o32 18 0 mips16-branch
run_mips_plt_test "o32 PLTs for mixed MIPS and MIPS16 with %got" \
- o32 -1 0 mips16-got compressed-plt-1d.s
+ o32 109 0 mips16-got compressed-plt-1d.s
run_mips_plt_test "o32 PLTs for mixed MIPS and MIPS16 with .word" \
- o32 -1 0 mips16-word compressed-plt-1e.s
+ o32 109 0 mips16-word compressed-plt-1e.s
run_mips_plt_test "o32 PLTs for mixed MIPS and microMIPS" \
- o32 -1 1 umips
+ o32 109 1 umips
+ run_mips_plt_test "o32 PLTs for mixed MIPS and microMIPS branches" \
+ o32 18 1 umips-branch
run_mips_plt_test "o32 PLTs for mixed MIPS and microMIPS with %got" \
- o32 -1 1 umips-got compressed-plt-1d.s
+ o32 109 1 umips-got compressed-plt-1d.s
run_mips_plt_test "o32 PLTs for mixed MIPS and microMIPS with .word" \
- o32 -1 1 umips-word compressed-plt-1e.s
+ o32 109 1 umips-word compressed-plt-1e.s
if $has_newabi {
build_mips_plt_lib n32
run_mips_plt_test "n32 PLTs for mixed MIPS and MIPS16" \
- n32 -1 0 mips16
+ n32 109 0 mips16
run_mips_plt_test "n32 PLTs for mixed MIPS and microMIPS" \
- n32 -1 1 umips
+ n32 109 1 umips
}
}