[PATCH] D19995: Optimize access to global variable references in PIE mode when linker supports copy relocations for PIE

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Mon May 9 16:42:48 PDT 2016


On Mon, May 9, 2016 at 3:49 PM, Rafael EspĂ­ndola
<llvm-commits at lists.llvm.org> wrote:
> > Both preemtable and extern_local sound like great ideas, but how should we tell the compiler to generate copy relocations for a declaration of a GV?
>
> That is extern_local. That tells llc to assume the symbol is local.
> Not from the example that it produces "leaq a(%rip), %rax", which will
> create a copy relocation is the assumption in wrong.

OK, so your proposal is essentially to create a linkage that tells the
compiler that it doesn't need to do GOT loads (or @PLT references) for
a symbol. The user is in some sense promising that the symbol
definition will be part of the current TU's DSO. If the user fails to
deliver on that promise, then it is a policy decision for the linker
to either smooth things over with a copy relocation or emit an error.

I guess I was assuming that extern_local would somehow emit code that
forced the linker to error out if the definition was missing.

> I will try coding the interposable/extern_local patch tomorrow.
> Hopefully it should clarify this discussion a bit.

Sounds good, sorry I got the wires twisted. :)


More information about the llvm-commits mailing list