[llvm-dev] PIC and mcmodel=large on x86 doesn't use any relocations
Joerg Sonnenberger via llvm-dev
llvm-dev at lists.llvm.org
Mon Oct 31 11:43:44 PDT 2016
On Mon, Oct 31, 2016 at 02:30:43PM -0400, John Reagan via llvm-dev wrote:
> The idea to make this all work on x86-64 is to use the address of
> a routine's PLT as its "address" in all cases. By putting the PLT
> in 32-bit address space, some ancient BASIC or Fortran program can
> continue to use an INTEGER*4 to hold a routine's "address" and pass
> it around. Of course, our PLTs won't be actual dynamic loading
> code but just trampolines to the 64-bit code. The PLTs provide
> a consistent "address of routine" for pointer comparisons, etc just
> like the "primary function descriptor" on Itanium.
That's effectively how the main binary works for dynamically linked
non-PIE x86_64 code in the default code model. It creates some problems
for protected symbols and involves the nasty copy relocations, but
nothing so far seems to require the large code model, at least in the
sense of "GOT and PLT are not addressable with 32bit signed offset"?
Joerg
More information about the llvm-dev
mailing list