[AArch64] Relax long branch veneer insertion for non STT_FUNC symbol
authorJiong Wang <jiong.wang@arm.com>
Wed, 20 Jan 2016 16:57:59 +0000 (16:57 +0000)
committerJiong Wang <jiong.wang@arm.com>
Thu, 21 Jan 2016 09:57:09 +0000 (09:57 +0000)
commit2f340668a9a7c00f8813b097b157b07fba8cfa82
treee5cf0bc883324833481f0352a698c54bf21d9096
parentaeb7056972f1b383578204b9151b0ae6d8c1df81
[AArch64] Relax long branch veneer insertion for non STT_FUNC symbol

  As defined at AArch64 ELF Specification (4.6.7 Call and Jump
  relocations), symbol with type of non STT_FUNC but in different input
  section with relocation place should insert long branch veneer also.

  Meanwhile the current long branch veneer infrastructure havn't considered
  the situation where the branch destination is "sym_value + rela->addend".

  This was OK because we only insert veneer for long call destination is
  STT_FUNC symbol for which the addend is always zero. But as we relax the
  support to other situations by this patch, we need to handle addend be
  non-zero value. For example, for static function, relocation against
  "local symbol" are turned into relocation against "section symbol + offset"
  where there is a valid addend.

  bfd/
* elfnn-aarch64.c (aarch64_type_of_stub): Allow insert long branch
veneer for sym_sec != input_sec.
(elfNN_aarch64_size_stub): Support STT_SECTION symbol.
(elfNN_aarch64_final_link_relocate): Take rela addend into account when
calculation destination.

  ld/
* testsuite/ld-aarch64/farcall-section.d: Delete.
* testsuite/ld-aarch64/farcall-section.s: Delete.
* testsuite/ld-aarch64/farcall-b-section.d: New expectation file.
* testsuite/ld-aarch64/farcall-bl-section.d: Likewise.
* testsuite/ld-aarch64/farcall-b-section.s: New testcase.
* testsuite/ld-aarch64/farcall-bl-section.s: Likewise.
* testsuite/ld-aarch64/aarch64-elf.exp: Likewise.
12 files changed:
bfd/ChangeLog
bfd/elfnn-aarch64.c
ld/ChangeLog
ld/testsuite/ld-aarch64/aarch64-elf.exp
ld/testsuite/ld-aarch64/farcall-b-none-function.d
ld/testsuite/ld-aarch64/farcall-b-section.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/farcall-b-section.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/farcall-bl-none-function.d
ld/testsuite/ld-aarch64/farcall-bl-section.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/farcall-bl-section.s [new file with mode: 0644]
ld/testsuite/ld-aarch64/farcall-section.d [deleted file]
ld/testsuite/ld-aarch64/farcall-section.s [deleted file]