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

Sriraman Tallam via llvm-commits llvm-commits at lists.llvm.org
Mon May 9 20:13:27 PDT 2016


On Mon, May 9, 2016 at 4:42 PM, Reid Kleckner via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> 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.

Sorry, how is this any different from what exists right now with
non-PIE and what will happen with PIE and this patch?

>
> 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. :)
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list