[PATCH] D91426: [PowerPC] Fix issue where binary uses a .got but is missing a .TOC.
Stefan Pintilie via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 31 11:23:20 PDT 2021
stefanp added inline comments.
================
Comment at: lld/test/ELF/ppc64-check-missing-tocbase.s:36
+.Lpcrel0:
+ .reloc .Lpcrel0-8,R_PPC64_PCREL_OPT,.-(.Lpcrel0-8)
+ lwa 3, 0(3)
----------------
MaskRay wrote:
> I know there is prior art but why can't this be written as t`.reloc ., R_PPC64_PCREL_OPT, 0` before `pld`?
The ABI does require that the `.reloc` come after the `glob_int at got@pcrel` relocation because the `R_PPC64_PCREL_OPT` relocation is an optimization opportunity related to that previous relocation. Therefore, I don't want to swap the order of the two.
It would be in section `3.5.4. Relocation Descriptions`. It is a new relocation so I don't know if you have the text. So, here it is:
```
This relocation specifies that the instruction at r_offset and the instruction at r_offset + r_addend
may be optimized by the linker; the compiler must guarantee that register lifetimes are such that
the optimization is safe. In code sequences where this relocation is valid, the first instruction also
has another relocation at r_offset. The R_PPC64_PCREL_OPT entry occurs immediately after
that relocation in the table of relocations. See Section 3.6.3.3, “Displacement Optimization for PC-Relative Accesses” [95] for more details.
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D91426/new/
https://reviews.llvm.org/D91426
More information about the llvm-commits
mailing list