binutils-gdb/ld/testsuite
Maciej W. Rozycki 789ff5b6c2 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.
2018-06-20 00:37:51 +01:00
..
config
ld-aarch64 ELF dynsyms 2018-06-14 11:32:01 +09:30
ld-alpha Define various symbols conditionally in shared libraries 2018-06-08 20:17:34 +09:30
ld-arc
ld-arm ELF dynsyms 2018-06-14 11:32:01 +09:30
ld-auto-import
ld-avr
ld-bootstrap
ld-cdtest
ld-checks
ld-cris ELF dynsyms 2018-06-14 11:32:01 +09:30
ld-crx
ld-cygwin
ld-d10v
ld-discard
ld-elf MIPS/LD/testsuite: XFAIL DT_TEXTREL map file warning test 2018-06-20 00:37:51 +01:00
ld-elfcomm
ld-elfvers
ld-elfvsb
ld-elfweak
ld-fastcall
ld-frv Define various symbols conditionally in shared libraries 2018-06-08 20:17:34 +09:30
ld-gc
ld-h8300
ld-i386 Define various symbols conditionally in shared libraries 2018-06-08 20:17:34 +09:30
ld-ia64 Define various symbols conditionally in shared libraries 2018-06-08 20:17:34 +09:30
ld-ifunc Build ifunc tests when non-native 2018-06-18 22:00:32 +09:30
ld-libs
ld-linkonce
ld-m68hc11
ld-m68k Define various symbols conditionally in shared libraries 2018-06-08 20:17:34 +09:30
ld-mep
ld-metag Define various symbols conditionally in shared libraries 2018-06-08 20:17:34 +09:30
ld-mips-elf PR ld/22966: Fix n64 MIPS `.got.plt' range checks 2018-06-20 00:37:51 +01:00
ld-misc
ld-mmix
ld-mn10300
ld-msp430-elf
ld-nds32
ld-nios2
ld-pe
ld-pie
ld-plugin Fix the PR22983 test so that it will work regardless of the order of the symbols in the dynamic symbol table. 2018-06-12 13:22:24 +01:00
ld-powerpc Define various symbols conditionally in shared libraries 2018-06-08 20:17:34 +09:30
ld-pru
ld-riscv-elf RISC-V: Handle out-of-range calls to undefined weak. 2018-06-03 15:42:29 -07:00
ld-s12z
ld-s390 Define various symbols conditionally in shared libraries 2018-06-08 20:17:34 +09:30
ld-scripts
ld-selective
ld-sh Define various symbols conditionally in shared libraries 2018-06-08 20:17:34 +09:30
ld-shared
ld-size
ld-sparc Define various symbols conditionally in shared libraries 2018-06-08 20:17:34 +09:30
ld-spu
ld-srec
ld-tic6x ld: Adjust tic6x tests 2018-05-21 20:41:24 -07:00
ld-tilegx
ld-tilepro
ld-undefined
ld-unique
ld-v850
ld-vax-elf
ld-visium
ld-vxworks
ld-x86-64 Define various symbols conditionally in shared libraries 2018-06-08 20:17:34 +09:30
ld-xc16x
ld-xstormy16
ld-xtensa
ld-z8k
lib Build ifunc tests when non-native 2018-06-18 22:00:32 +09:30
ChangeLog-2004
ChangeLog-2005
ChangeLog-2006
ChangeLog-2007
ChangeLog-2008
ChangeLog-2009
ChangeLog-2010
ChangeLog-2011
ChangeLog-2012
ChangeLog-2013
ChangeLog-2014
ChangeLog-2015
ChangeLog-9303