[PATCH] D70570: [PowerPC] Only use PLT annotations if using PIC relocation model
Sean Fertile via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 10 09:32:34 PST 2019
sfertile added a comment.
Hi Justin,
I'd like to help reviewing this patch. I know how calls work in the 2 64-bit ELF abis pretty well but am not familiar with 32-bit PowerPC at all so I have a handful of questions to start:
1. I've been using this ABI DOC <http://refspecs.linux-foundation.org/elf/elfspec_ppc.pdf>. Is this the 32-bit ABI supported in LLVM? Are there other 32-bit ELF PowerPC Abis I need to be aware of?
2. What `secure-plt` reference or references should I read to get up to speed?
Finally I'd like to just verify my base understanding of the difference between `bl sym` and `bl sym at PLT`.
`bl sym` will produce a call instruction with an `R_PPC_REL24` relocation, which will tell the linker to fill in the instruction with the offset from the program counter at the call instruction to `sym`.
`bl sym at PLT` will produce a call instruction with an `R_PPC_PLTREL24` which will instruct the linker to create a PLT, allocate a PLT entry for `sym`, and fill in the instruction with the offset from the program counter to the PLT entry for 'sym'.
I'm used to having 1 relocation type for both calls, and the linker can determine based on the properties of 'sym' and whether its linking a shared object or not whether the call needs to indirect through the PLT.
- If you emit a call instruction with the PLTREL relocation but the symbol ends up module local, does the linker convert the call to a local one?
- Is it an error to not use a PLTREL relocation for a call that needs to be indirected through the PLT or is the linker smart enough to add a PLT entry for the symbol and branch to there instead?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D70570/new/
https://reviews.llvm.org/D70570
More information about the llvm-commits
mailing list