binutils-gdb/ld/testsuite
Simon Atanasyan 3be08ea472 BFD: Prevent writing the MIPS _gp_disp symbol into symbol tables
The _gp_disp is a magic symbol, always implicitly defined by the linker.
It does not make a sense to write it into symbol tables for output files.
Moreover, now if the linker gets a version script, the _gp_disp symbol
gets zero version definition index.  The zero index means[1]:

"The symbol is local, not available outside the object."

But the _gp_disp symbol has GLOBAL binding.  That confuses some tools
like for example the LLD linker when they get such files as inputs.

This patch fixes the problem - it prevents writing the _gp_disp symbol
in regular and dynamic symbol tables.

This was tested by running LD test suite on a mipsel-linux board.

References:

[1] "Linux Standard Base Specification", Section "10.7.2 Symbol
    Version Table", p. 32

2018-05-03  Simon Atanasyan  <simon@atanasyan.com>

bfd/

	* elf32-mips.c: (elf32_mips_fixup_symbol): New function.
	(elf_backend_fixup_symbol): New macro.
	* elfxx-mips.c: (mips_elf_output_extsym): Discard _gp_disp
	handling.
	(_bfd_mips_elf_finish_dynamic_symbol): Likewise.

ld/

	* testsuite/ld-mips-elf/gp-disp-sym.d: New test.
	* testsuite/ld-mips-elf/gp-disp-sym.s: New test source.
	* testsuite/ld-mips-elf/mips-elf.exp: Run the new test.
	* testsuite/ld-mips-elf/mips16-pic-2.ad: Update for _gp_disp
	symbol removal.
	* testsuite/ld-mips-elf/mips16-pic-2.nd: Likewise.
	* testsuite/ld-mips-elf/pic-and-nonpic-3a.dd: Likewise.
	* testsuite/ld-mips-elf/tlslib-o32-hidden.got: Likewise.
	* testsuite/ld-mips-elf/tlslib-o32-ver.got: Likewise.
	* testsuite/ld-mips-elf/tlslib-o32.got: Likewise.
2018-05-03 17:17:46 +01:00
..
config
ld-aarch64 [2/2][LD][AARCH64]Add BFD_RELOC_AARCH64_TLSLE_LDST8/16/32/64_TPREL_LO12 support in LD. 2018-03-28 18:08:51 +01:00
ld-alpha
ld-arc
ld-arm [ARM] FDPIC: Update testsuite so that many tests pass with arm*-uclinuxfdpiceabi. 2018-04-25 21:13:14 +00:00
ld-auto-import
ld-avr
ld-bootstrap
ld-cdtest
ld-checks
ld-cris
ld-crx
ld-cygwin
ld-d10v
ld-discard [ARM] FDPIC: Update testsuite so that many tests pass with arm*-uclinuxfdpiceabi. 2018-04-25 21:13:14 +00:00
ld-elf [ld/testsuite] Fix pr2404 output. 2018-04-26 13:44:33 +00:00
ld-elfcomm Remove sh5 and sh64 support 2018-04-16 15:29:39 +09:30
ld-elfvers various i386-aout and i386-coff target removal 2018-04-18 09:34:19 +09:30
ld-elfvsb various i386-aout and i386-coff target removal 2018-04-18 09:34:19 +09:30
ld-elfweak various i386-aout and i386-coff target removal 2018-04-18 09:34:19 +09:30
ld-fastcall
ld-frv
ld-gc [ARM] FDPIC: Update testsuite so that many tests pass with arm*-uclinuxfdpiceabi. 2018-04-25 21:13:14 +00:00
ld-h8300 Remove h8300-coff support 2018-04-16 15:17:57 +09:30
ld-i386 various i386-aout and i386-coff target removal 2018-04-18 09:34:19 +09:30
ld-ia64
ld-ifunc various i386-aout and i386-coff target removal 2018-04-18 09:34:19 +09:30
ld-libs
ld-linkonce various i386-aout and i386-coff target removal 2018-04-18 09:34:19 +09:30
ld-m68hc11
ld-m68k
ld-mep
ld-metag
ld-mips-elf BFD: Prevent writing the MIPS _gp_disp symbol into symbol tables 2018-05-03 17:17:46 +01:00
ld-misc
ld-mmix
ld-mn10300
ld-msp430-elf
ld-nds32
ld-nios2
ld-pe
ld-pie
ld-plugin various i386-aout and i386-coff target removal 2018-04-18 09:34:19 +09:30
ld-powerpc Remove netware support 2018-04-16 15:11:22 +09:30
ld-pru
ld-riscv-elf
ld-s390
ld-scripts [ARM] FDPIC: Update testsuite so that many tests pass with arm*-uclinuxfdpiceabi. 2018-04-25 21:13:14 +00:00
ld-selective Remove sh5 and sh64 support 2018-04-16 15:29:39 +09:30
ld-sh Remove sh5 and sh64 support 2018-04-16 15:29:39 +09:30
ld-shared various i386-aout and i386-coff target removal 2018-04-18 09:34:19 +09:30
ld-size various i386-aout and i386-coff target removal 2018-04-18 09:34:19 +09:30
ld-sparc various i386-aout and i386-coff target removal 2018-04-18 09:34:19 +09:30
ld-spu
ld-srec Remove sh5 and sh64 support 2018-04-16 15:29:39 +09:30
ld-tic6x
ld-tilegx
ld-tilepro
ld-undefined [ARM] FDPIC: Update testsuite so that many tests pass with arm*-uclinuxfdpiceabi. 2018-04-25 21:13:14 +00:00
ld-unique RISC-V: Disallow output format changes. 2018-03-06 12:01:50 -08:00
ld-v850
ld-vax-elf
ld-visium
ld-vxworks
ld-x86-64 x86-64: Add ENDBR64 to the TLSDESC PLT entry 2018-03-25 05:02:32 -07:00
ld-xc16x
ld-xstormy16
ld-xtensa
ld-z8k
lib testsuite: Support filtering targets by TCL procedure in `run_dump_test' 2018-04-27 15:25:20 +01:00
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