[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
Sun May 8 12:17:15 PDT 2016


On Sun, May 08, 2016 at 11:07:51AM -0700, H.J. Lu wrote:
> On Sun, May 8, 2016 at 9:41 AM, Joerg Sonnenberger via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
> > On Sun, May 08, 2016 at 09:08:48AM -0700, H.J. Lu wrote:
> >> Some Linux distros have disabled lazy binding.  I didn't notice any
> >> significant startup time impact.  In fact, I only
> >> discovered that lazy binding was disabled by accident on my desktop
> >> machine.
> >
> > The impact is easily measurable, consider a simple shell loop like:
> >   for x in $(seq 1 1000); do /bin/echo -n; done
> >
> > On my build server, that takes 0.53s. Setting LD_BIND_NOW, it takes
> > 0.70s. There are work loads for which this easily translates into a
> > significant chunk of the total run time.
> 
> By the same reason of performance improvement, I guess
> you won't object copy relocation in PIE :-(.

Disabling lazy linking has an easily measurable and easy to understand
performance effect. Copy relocations is much harder to measure
precisely, especially given that the link editor already *does* optimize
for it. The other major difference is that all the benefits of copy
relocations can be obtained differently as I have said more than once.
They are not necessarily for getting the performance advantage, they are
just the solution for the lazy programmer.

Joerg


More information about the llvm-commits mailing list