[PATCH] D61610: [PPC64] implement Thunk Section Spacing

Sean Fertile via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 8 08:11:48 PDT 2019


sfertile added a comment.

In D61610#1494577 <https://reviews.llvm.org/D61610#1494577>, @peter.smith wrote:

>   If PPC is anything like Arm, I would be very surprised to see a lot of inter-section conditional branches, 


Yeah, in my experience theses are rare compared to the normal unconditional branch.

In D61610#1494589 <https://reviews.llvm.org/D61610#1494589>, @MaskRay wrote:

>   uint32_t PPC64::getThunkSectionSpacing() const {
>     return 0x2000000; // good choice, but it should be decreased a bit
>   }
>


Since thunks sections will still get added closer if the pre-allocated ones can't satisfy a branch, and the number of pre-allocated sections drastically affects our link time maybe go with this (or maybe even slightly larger?).

In D61610#1494525 <https://reviews.llvm.org/D61610#1494525>, @MaskRay wrote:

> We have a large program whose text segment is of 1.3GiB. Its OutputSection `.text` consists of 1948775 InputSections. It takes 20 seconds to link but with this patch it doesn't stop in 10 minutes.


I think you are in a unique situation where you have some *really good* test input for investigating how pre-allocating the thunks affects link time, do any of these larger programs have open-source equivalents? Most of the stuff I used for testing the thunk creation was either shared libraries   or executable based on llvm/clang (for long-branch thunks).  I would expect the shared libraries to use most of the thunk sections we create, but would love to be able to look at some larger executables to see how often the sections are used there. We might be better off not setting this value on PPC like Peter suggests.



================
Comment at: lld/test/ELF/ppc64-branch-thunkspacing.s:18
+        mr 31,1
+	bl  too_far1
+
----------------
MaskRay wrote:
> MaskRay wrote:
> > mixed tab and spaces? Probably move the bl instruction to another `.init` section:
> > 
> > ```
> > .section .init,"ax", at progbits,unique,2
> > .align 2
> >   bl too_far1
> > ```
> > 
> > to mimic the crti.o crtn.o `.init`
> This comment is not done.
> 
> You should create several `.init` sections to emulate `.init` used on FreeBSD: it is built from bits spread across several object files.
> 
Should we have a simple test simply checking the thunk section spacing for this patch and then have a follow on patch where we fix the thunk insertion to not insert into the middle of `.init` and `.fini` sections and test the multiple .init sections there? 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61610/new/

https://reviews.llvm.org/D61610





More information about the llvm-commits mailing list