This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [AArch64] PR18668, Generate long branch veneer if call to plt stub is out of range
- From: Jiong Wang <jiong dot wang at arm dot com>
- To: "binutils\ at sourceware dot org" <binutils at sourceware dot org>
- Date: Thu, 06 Aug 2015 11:38:52 +0100
- Subject: Re: [AArch64] PR18668, Generate long branch veneer if call to plt stub is out of range
- Authentication-results: sourceware.org; auth=none
- References: <n99pp3sgori dot fsf at arm dot com> <n99oajcgon5 dot fsf at arm dot com>
Jiong Wang writes:
> (add the patch)
>
> 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 <jiong.wang@arm.com>
> bfd/
> 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/testsuite/
> * 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?
Ping~
I understand this patch modify some sensitive part of relocation
handling.
But the only functional changes of this patch are
* in aarch64_type_of_stub, if the branch relocation is plt stub
related, then we should calculate the distance by
distance = branch location - PLT stub location
instead of
distance = branch location - symbol value.
* "if (h && h->type == STT_FUNC)" in CALL/JMP26 relocation handling
removed, because it's unncessary.
if there is no branch stub, then it's not registered in the hash
table, then the later get_sub_entry will return NULL. we should not
differenciate local, global and symbol type here, as that should be
done in stub type check and stub registration.
--
Regards,
Jiong