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

Joerg Sonnenberger via llvm-commits llvm-commits at lists.llvm.org
Mon May 9 14:33:43 PDT 2016


On Mon, May 09, 2016 at 02:20:13PM -0700, Sriraman Tallam wrote:
> On Mon, May 9, 2016 at 2:07 PM, Joerg Sonnenberger via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
> > On Thu, May 05, 2016 at 09:19:46PM +0000, Sriraman Tallam via llvm-commits wrote:
> >> For X86, in PIE mode,  when accessing extern global variables, an extra
> >> load from the GOT can be avoided if the linker allows copy relocations
> >> for PIE.  This patch makes it possible.  This is already available in
> >> the GCC compiler.
> >
> > OK, let's go back to original goal and look at better ways to achieve
> > this. Can we agree on the problem first:
> >
> > (1) The main program consists of one or more compile units. It declares
> > non-static file-scope variables.
> 
> Just to be clear, How is this different from global variables?

Depending on terminology, static file-scope variables are still global
and function-scope static variables behave like file-scope static.

Joerg


More information about the llvm-commits mailing list