binutils-gdb/ld/testsuite
Tamar Christina 9fca35fc34 AArch64: Fix regression in Cortex A53 erratum when PIE. (PR ld/23904)
The fix for PR ld/22263 causes TLS relocations using ADRP to be relaxed
into MOVZ, however this causes issues for the erratum code.

The erratum code scans the input sections looking for ADRP instructions
and notes their location in the stream.

It then later tries to find them again in order to generate the linker
stubs.  Due to the relaxation it instead finds a MOVZ and hard aborts.

Since this relaxation is a valid one, and in which case the erratum no
longer applies, it shouldn't abort but instead just continue.

This changes the TLS relaxation code such that when it finds an ADRP and
it relaxes it, it removes the erratum entry from the work list by changing
the stub type into none so the stub is ignored.

The entry is not actually removed as removal is a more expensive operation
and we have already allocated the memory anyway.

The clearing is done for IE->LE and GD->LE relaxations, and a testcase is
added for the IE case. The GD case I believe to be impossible to get together
with the erratum sequence due to the required BL which would break the sequence.
However to cover all basis I have added the guard there as well.

build on native hardware and regtested on
  aarch64-none-elf, aarch64-none-elf (32 bit host),
  aarch64-none-linux-gnu, aarch64-none-linux-gnu (32 bit host)

Cross-compiled and regtested on
  aarch64-none-linux-gnu, aarch64_be-none-linux-gnu

Testcase in PR23940 tested and works as expected now and benchmarks ran on A53
showing no regressions and no issues.

bfd/ChangeLog:

	PR ld/23904
	* elfnn-aarch64.c (_bfd_aarch64_adrp_p): Use existing constants.
	(_bfd_aarch64_erratum_843419_branch_to_stub): Use _bfd_aarch64_adrp_p.
	(struct erratum_835769_branch_to_stub_clear_data): New.
	(_bfd_aarch64_erratum_843419_clear_stub): New.
	(clear_erratum_843419_entry): New.
	(elfNN_aarch64_tls_relax): Use it.
	(elfNN_aarch64_relocate_section): Pass input_section.
	(aarch64_map_one_stub): Handle branch type none as valid.

ld/ChangeLog:

	PR ld/23904
	* testsuite/ld-aarch64/aarch64-elf.exp: Add erratum843419_tls_ie.
	* testsuite/ld-aarch64/erratum843419_tls_ie.d: New test.
	* testsuite/ld-aarch64/erratum843419_tls_ie.s: New test.
2018-11-27 12:42:22 +00:00
..
config elfedit: Add --enable-x86-feature/--disable-x86-feature 2018-11-06 09:38:51 -08:00
ld-aarch64 AArch64: Fix regression in Cortex A53 erratum when PIE. (PR ld/23904) 2018-11-27 12:42:22 +00:00
ld-alpha
ld-arc [ARC] Update ld tests. 2018-11-09 13:24:29 +02:00
ld-arm
ld-auto-import
ld-avr Fix more fallout from 17f6ade235 2018-09-21 09:55:38 +09:30
ld-bootstrap Prune BFD warnings for unknown GNU properties 2018-08-23 06:12:50 -07:00
ld-cdtest
ld-checks ld: Add the entry symbol, _main, for LynxOS targets 2018-09-20 12:31:20 -07:00
ld-cris
ld-crx
ld-csky Add support for the C_SKY series of processors. 2018-07-30 12:24:14 +01:00
ld-cygwin
ld-d10v Consolidate run_dump_test 2018-09-15 16:56:55 +09:30
ld-discard xgate testsuite fixes 2018-07-10 23:59:59 +09:30
ld-elf elfedit: Add --enable-x86-feature/--disable-x86-feature 2018-11-06 09:38:51 -08:00
ld-elfcomm Andes Technology has good news for you, we plan to update the nds32 port of binutils on upstream! 2018-09-20 13:32:58 +01:00
ld-elfvers
ld-elfvsb
ld-elfweak
ld-fastcall
ld-frv
ld-gc Consolidate run_dump_test 2018-09-15 16:56:55 +09:30
ld-h8300
ld-i386 i386: Accept both .plt.got and .plt.sec sections 2018-11-12 09:29:49 -08:00
ld-ia64
ld-ifunc ld: Append -mx86-used-note=no to ASFLAGS 2018-08-31 04:48:05 -07:00
ld-libs
ld-linkonce x86: Add a GNU_PROPERTY_X86_ISA_1_USED note if needed 2018-07-20 09:19:00 -07:00
ld-m68hc11
ld-m68k
ld-mep
ld-metag
ld-mips-elf PR ld/21375: MIPS: Add test cases for undefined weaks resolving to zero 2018-09-14 20:22:57 +01:00
ld-misc ld testsuite use of notarget 2018-07-10 23:58:29 +09:30
ld-mmix
ld-mn10300
ld-msp430-elf
ld-nds32 Andes Technology has good news for you, we plan to update the nds32 port of binutils on upstream! 2018-09-20 13:32:58 +01:00
ld-nios2
ld-or1k or1k: Add the l.adrp insn and supporting relocations 2018-10-05 11:41:41 +09:00
ld-pe ld testsuite use of notarget 2018-07-10 23:58:29 +09:30
ld-pie
ld-plugin ELF: Hide symbols defined in discarded input sections 2018-10-24 18:08:24 -07:00
ld-powerpc Separate header PT_LOAD for -z separate-code 2018-10-08 20:26:08 +10:30
ld-pru
ld-riscv-elf RISC-V: Adjust __global_pointer$ value to reduce code size. 2018-10-15 16:00:28 -07:00
ld-s12z S12Z Add tests for relocs. 2018-09-16 17:50:09 +02:00
ld-s390 S/390: Prevent GOT access rewrite for certain symbols 2018-09-17 11:01:24 +02:00
ld-scripts A few hppa testcase tidies 2018-09-17 23:17:14 +09:30
ld-selective
ld-sh
ld-shared
ld-size Ensure that binutils test names are unique. 2018-09-17 10:10:47 +01:00
ld-sparc
ld-spu Separate header PT_LOAD for -z separate-code 2018-10-08 20:26:08 +10:30
ld-srec ld: Append -Wa,-mx86-used-note=no for S-records tests 2018-08-31 04:44:59 -07:00
ld-tic6x Separate header PT_LOAD for -z separate-code 2018-10-08 20:26:08 +10:30
ld-tilegx
ld-tilepro
ld-undefined
ld-unique Ensure that binutils test names are unique. 2018-09-17 10:10:47 +01:00
ld-v850
ld-vax-elf
ld-visium
ld-vxworks
ld-x86-64 x86: Disable GOT relaxation with data prefix 2018-11-05 09:01:43 -08:00
ld-xc16x
ld-xstormy16
ld-xtensa xtensa: ld: convert tests to run_dump_test 2018-07-23 12:06:40 -07:00
ld-z8k
lib Fix ld action in run_dump_test 2018-11-01 17:19:17 +00: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