[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 11:53:20 PDT 2020
What are the motivating use cases?
On 8/20/20 1:29 PM, Leonard Chan via llvm-dev wrote:
> Hi all,
> We would like to propose a new Constant type in LLVM for representing
> entries in the Procedure Linkage Table (PLT).
> The PLT is a data structure used for dispatching position-independent
> function calls to appropriate functions where the address of the
> function is not known statically. Right now, if a call is made to a
> function, it may be lowered to a direct call to the function itself or
> the PLT entry for that function. LLVM has checks that dictate if the
> function call should be a direct reference or PLT entry, but we don’t
> have a way in IR to semantically represent that the PLT entry should
> be used.
> The proposed constant would be analogous to BlockAddress, but instead
> represent the PLT entry for functions. The usage could look something
> and would always have the same type as the function. A pltentrywould
> operate exactly like a function, but the main difference is that it’s
> lowered to the PLT entry (function at plt) on targets that support PLT
> relocations. The linker can then decide if it should be relaxed into a
> direct reference or remain a PLT entry.
> I have a very rough WIP implementation at
> https://reviews.llvm.org/D77248 <https://reviews.llvm.org/D77248>.
> Thoughts and opinions?
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev