[llvm-dev] llvm-dev Digest, Vol 148, Issue 131

John Reagan via llvm-dev llvm-dev at lists.llvm.org
Tue Nov 1 06:59:48 PDT 2016


> From: Joerg Sonnenberger via llvm-dev <llvm-dev at lists.llvm.org>
> To: llvm-dev at lists.llvm.org
> Subject: Re: [llvm-dev] PIC and mcmodel=large on x86 doesn't use any
> 	relocations

> 
> 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
> 

Looking at what I have today on OpenVMS Itanium, I can have code at address
(I'll add a 'dot' in the middle for readability)

0x00000001.00000000

and our short section with static data/FDs is at

0x00000000.00020000

How does the code find the GOT/PLT with only 32-bit %rip addressing?




More information about the llvm-dev mailing list