This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[AArch64 ] Generate long branch veneer if call to plt stub is out of range

If text section size is really big, when the linker redirect function
call to plt stub, the branch offset may be out of range.

Currently, AArch64 BFD has long branch veneer infrastructure ready, but
it's not enabled for call to plt stub. Only absolute call long branch
implemented while for PIC/.so, call to PLT stub is the common case and
we need to support this.

This patch copied some code from ARM32, and cleaned up code logic in
final_link code where BFD_RELOC_AARCH64_JUMP26/CALL26 handled.

The code logic for handling CALL26/JUMP26 is simplied into:

  * if it call via plt stub, then update relocation value to plt stub address.
  * use the updated relocation value to check whether it's fit into range.
    And if the offset don't fit into the range then check whether any
    long branch veneer register for it.
  * if long branch veneer register, then udpate final relocation value
    to the address of veneer, otherwise don't touch relocation value.

test done
  native ld check OK.
  linking the huge OpenLoop reported on PR 18668 successfully which
  failed on the old bfd linker.

OK for trunk?

2015-07-15  Jiong Wang  <>
  PR ld/18668
  * elfnn-aarch64.c (aarch64_type_of_stub): Update destination for
  calls go through plt stub.
  (elfNN_aarch64_final_link_relocate): Adjust code logic for CALL26,
  JUMP26 relocation to support inserting veneer for call to plt stub.

  * ld-aarch64/farcall-b-gsym.s: New test.
  * ld-aarch64/farcall-b-plt.s: Ditto.
  * ld-aarch64/farcall-bl-plt.s: Ditto.
  * ld-aarch64/farcall-b-gsym.d: New expect file.
  * ld-aarch64/farcall-b-plt.d: Ditto.
  * ld-aarch64/farcall-bl-plt.d: Ditto.

OK for trunk?

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]