[llvm-dev] [RFC][LLVM] New Constant type for representing function PLT entries

Hal Finkel via llvm-dev llvm-dev at lists.llvm.org
Thu Aug 20 13:03:18 PDT 2020

On 8/20/20 2:45 PM, Leonard Chan wrote:
>     Hi, Leonard,
>     What are the motivating use cases?
>      -Hal
> The immediate use case for us specifically would be a way to 
> explicitly request static PLT relocations. We rolled out a new 
> relocation for AArch64 (R_AARCH64_PLT32 
> <https://reviews.llvm.org/D81184>) which takes the offset between the 
> PLT entry for a function and some other symbol. In IR, we can then 
> explicitly request this relocation with `pltentry(@function) - 
> @global` and distinguish it from `@function - @global` which may or 
> may not lower to R_AARCH64_PREL32 if both symbols are dso_local. This 
> is especially useful for the relative vtables ABI 
> <https://reviews.llvm.org/D72959> where we can benefit in size by not 
> having to emit dso_local stubs for some functions.

Okay. So the idea is that Clang and other frontends will emit them 
directly as parts of certain constant expressions inside of certain data 
structures (e.g., vtables). That makes sense.


> In the general case, this just adds a way for semantically 
> representing PLT entries for functions and would ideally add more 
> "correctness". From an IR perspective, users won't need to 
> second-guess "what will this function be lowered to".

Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200820/24161a44/attachment.html>

More information about the llvm-dev mailing list