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

Xinliang David Li via llvm-commits llvm-commits at lists.llvm.org
Sat May 7 10:58:51 PDT 2016


To be clear, assuming copyrelocs (support in linker) allows compiler to
generate efficient code (speculatively) to access external globals which
compiler has no idea where they are going to be defined. For most of the
cases, the most of globals end up in the main program, so copyrelocs is
only a fallback mechanism in case that is not the case.

Yes, copy relocs exposes the data layout of shared lib globals -- but this
is usually not an issue for programs that are frequently built/released (on
the other hand, shared libraries are less likely to change).

Also note this is not something new introduced by this patch. Non-pie case
already does it.

David

On Fri, May 6, 2016 at 11:31 AM, John McCall <rjmccall at gmail.com> wrote:

> rjmccall added a comment.
>
> The semantic argument against using copy relocations by default is that
> they hard-code the size of the variable at link time.  What's the story
> here for that?
>
>
> http://reviews.llvm.org/D19995
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160507/01364276/attachment.html>


More information about the llvm-commits mailing list