[PATCH] D61610: [PPC64] implement Thunk Section Spacing
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 9 02:09:00 PDT 2019
MaskRay added a comment.
@adalava We care about the link time. I need to do some testing to ensure this doesn't cause regression. I've created https://reviews.llvm.org/D61720, fixed the tests and added `ppc64-long-branch-init.s` that I think captures the idea of the fix. Hope you don't mind my commandeering the change :)
================
Comment at: lld/test/ELF/ppc64-branch-thunkspacing.s:18
+ mr 31,1
+ bl too_far1
+
----------------
adalava wrote:
> sfertile wrote:
> > 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?
> Sure. I'm not sure on how to check that spacing was applied. I know empirically the offsets are different, so I did this test.
> Any guidance on how to improve this test is welcome.
I think you can extract the `.init` section of crti.o crtbegin.o crtend.o crtn.o, and so something like:
```
.section .init,"ax", at progbits,unique,1
...
.section .init,"ax", at progbits,unique,2
...
.section .init,"ax", at progbits,unique,3
...
.section .init,"ax", at progbits,unique,4
...
```
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