aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-mips-elf/n64-plt-1.dd
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@mips.com>2018-06-20 00:37:51 +0100
committerMaciej W. Rozycki <macro@mips.com>2018-06-20 00:37:51 +0100
commit789ff5b6c26ce7e4ebfcfa5a9a695407c17fa4ea (patch)
treece7958d48139f89d91d1137fdeebe4df2c040c27 /ld/testsuite/ld-mips-elf/n64-plt-1.dd
parent6a382bceadc7228d20746079570a15f115e55d0c (diff)
downloadgdb-789ff5b6c26ce7e4ebfcfa5a9a695407c17fa4ea.zip
gdb-789ff5b6c26ce7e4ebfcfa5a9a695407c17fa4ea.tar.gz
gdb-789ff5b6c26ce7e4ebfcfa5a9a695407c17fa4ea.tar.bz2
PR ld/22966: Fix n64 MIPS `.got.plt' range checks
The addressable signed 32-bit range for n64 MIPS `.got.plt' references is from 0xffffffff7fff8000 to 0x7fff7fff, due to how the composition of an LUI and an LD instruction works for address calculation in the 64-bit addressing mode, such as when CP0.Status.UX=1. We currently have a range check in `mips_finish_exec_plt', however it is not correct as it verifies that the `.got.plt' start address referred is between 0xffffffff80000000 and 0x7fffffff. It is also implemented as an assertion rather than a proper error message despite that the situation can be triggered by user input. Additionally there is no check made for individual `.got.plt' entries referred even though they can be out of range while the `.got.plt' start address is not. Fix all these problems and use the correct range for the check, limiting it to n64 output files, and then issue a proper error message both in `mips_finish_exec_plt' and in `_bfd_mips_elf_finish_dynamic_symbol', suggesting the use of the `-Ttext-segment=...' option that will often work and with the default linker scripts in particular. Add suitable tests covering boundary cases. bfd/ PR ld/22966 * elfxx-mips.c (_bfd_mips_elf_finish_dynamic_symbol): Verify the `.got.plt' entry referred is in range. (mips_finish_exec_plt): Correct the range check for `.got.plt' start. Replace the assertion used for that with a proper error message. ld/ PR ld/22966 * testsuite/ld-mips-elf/n64-plt-1.dd: New test. * testsuite/ld-mips-elf/n64-plt-1.gd: New test. * testsuite/ld-mips-elf/n64-plt-2.ed: New test. * testsuite/ld-mips-elf/n64-plt-3.ed: New test. * testsuite/ld-mips-elf/n64-plt-4.dd: New test. * testsuite/ld-mips-elf/n64-plt-4.gd: New test. * testsuite/ld-mips-elf/n64-plt-1.ld: New test linker script. * testsuite/ld-mips-elf/n64-plt-2.ld: New test linker script. * testsuite/ld-mips-elf/n64-plt-3.ld: New test linker script. * testsuite/ld-mips-elf/n64-plt-4.ld: New test linker script. * testsuite/ld-mips-elf/n64-plt.s: New test source. * testsuite/ld-mips-elf/n64-plt-lib.s: New test source. * testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
Diffstat (limited to 'ld/testsuite/ld-mips-elf/n64-plt-1.dd')
-rw-r--r--ld/testsuite/ld-mips-elf/n64-plt-1.dd26
1 files changed, 26 insertions, 0 deletions
diff --git a/ld/testsuite/ld-mips-elf/n64-plt-1.dd b/ld/testsuite/ld-mips-elf/n64-plt-1.dd
new file mode 100644
index 0000000..4c24a9a
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/n64-plt-1.dd
@@ -0,0 +1,26 @@
+.*: +file format .*mips.*
+
+Disassembly of section \.plt:
+
+0000000010000280 <_PROCEDURE_LINKAGE_TABLE_>:
+ 10000280: 3c0e7fff lui t2,0x7fff
+ 10000284: ddd97fe8 ld t9,32744\(t2\)
+ 10000288: 25ce7fe8 addiu t2,t2,32744
+ 1000028c: 030ec023 subu t8,t8,t2
+ 10000290: 03e07825 move t3,ra
+ 10000294: 0018c0c2 srl t8,t8,0x3
+ 10000298: 0320f809 jalr t9
+ 1000029c: 2718fffe addiu t8,t8,-2
+
+00000000100002a0 <bar@plt>:
+ 100002a0: 3c0f7fff lui t3,0x7fff
+ 100002a4: ddf97ff8 ld t9,32760\(t3\)
+ 100002a8: 03200008 jr t9
+ 100002ac: 25f87ff8 addiu t8,t3,32760
+
+Disassembly of section \.text:
+
+00000000100002b0 <foo>:
+ 100002b0: 080000a8 j 100002a0 <bar@plt>
+ 100002b4: 00000000 nop
+ \.\.\.