This is the mail archive of the binutils@sourceware.org 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]

Re: [PATCH] fix PR gold/13320, inline thumb stubs in PLT entries


Thanks,  I can test your patch for you.

-Doug

On Fri, Mar 30, 2012 at 12:42 PM, Nathan Froyd <froydnj@mozilla.com> wrote:
> For calls to functions that require PLT entries, GNU ld recognizes that such calls from Thumb code do not need a large, out-of-line stub that transitions to ARM mode before jumping to the PLT entry. ?Instead, a small instruction sequence:
>
> ?bx pc
> ?nop
>
> is inserted at the beginning of the PLT entry and calls through that PLT entry are adjusted appropriately. ?This is a code-size win and improves the performance of code layout optimizations, as there are fewer stubs to consider (and the linker may not really account for the presence of the stubs when laying out code anyway).
>
> The patch below brings the same optimization to gold.
>
> I have not run the testsuite, as I do not have the test infrastructure to run gold's testsuite. ?However, we have successfully compiled (for Thumb, both ARMv7-A and ARMv5t), linked and run Firefox for Android when using the patch below.
>
> OK?
>
> -Nathan
>
> ? ? ? ?PR gold/13320
> ? ? ? ?* arm.cc (Output_data_plt_arm): Move backwards in the file.
> ? ? ? ?(Output_data_plt_arm::calculate_offsets): New function.
> ? ? ? ?(Output_data_plt_arm::thumb_plt_entry_stub): New member.
> ? ? ? ?(Output_data_plt_arm::thumb_stub_size): New function.
> ? ? ? ?(Output_data_plt_arm::plt_reference): New struct.
> ? ? ? ?(Output_data_plt_arm::stub_map_): New member.
> ? ? ? ?(Output_data_plt_arm::stub_list_): New member.
> ? ? ? ?(Output_data_plt_arm::entry_count): Query this->stub_list_.
> ? ? ? ?(Output_data_plt_arm::count_): Delete.
> ? ? ? ?(Output_data_plt_arm::Output_data_plt_arm): Don't initialize count_.
> ? ? ? ?(Output_data_plt_arm::add_entry): Add boolean parameters indicating
> ? ? ? ?the source of the jump. ?Record the target for later use.
> ? ? ? ?(Output_data_plt_arm::do_write): Iterate over this->stub_list_ for
> ? ? ? ?writing.
> ? ? ? ?(Reloc_stub::stub_type_for_reloc): Adjust the branch target if
> ? ? ? ?necessary. ?Add gsym argument.
> ? ? ? ?(Arm_relocate_functions::arm_branch_common): Update call to it.
> ? ? ? ?(Target_arm::scan_reloc_for_stub): Likewise.
> ? ? ? ?(Arm_relocate_functions::thumb_branch_common): Likewise.
> ? ? ? ?Adjust the branch target if we are using an inline thumb stub.
> ? ? ? ?(Target_arm::make_plt_entry): Add boolean parameters indicating the
> ? ? ? ?source of the jump. ?Pass them to add_entry.
> ? ? ? ?(Target_arm::Scan::global): Adjust calls to make_plt_entry.
> ? ? ? ?(Target_arm::do_finalize_sections): Call calculate_offsets if
> ? ? ? ?necessary.


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