What to do about alignment of ELF objects

Sean Silva chisophugis at gmail.com
Thu Apr 23 14:22:29 PDT 2015

On Thu, Apr 23, 2015 at 12:12 PM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

> On 23 April 2015 at 14:17, Rui Ueyama <ruiu at google.com> wrote:
> > I think the patch for LLVM looks okay, but not sure for the other one.
> >
> > Your patch makes the linker to not be able to handle archive files
> > containing unaligned objects, or just makes it slower? If you cross-link
> an
> > executable for machines generous for unaligned accesses, say x86, on
> > not-so-generous machines, PowerPC for example, does it link fine?
> Not difference on X86 (we avoid the copy).

This has the potential to radically change LLD's physical/virtual memory
usage characteristics depending on LLVM_IS_UNALIGNED_ACCESS_FAST (LIUAF)
along with total memory traffic profile and disk access patterns. For
example, this patch causes the entire file to be faulted in and read up
front on !LIUAF whereas the file might be faulted and touched on disk
sparsely and/or in a random order when LIUAF. Realistically most
benchmarking and optimization work is going to happen on x86 and so
performance on !LIUAF is likely to "bit rot" (we currently don't have any
type of performance CI to avoid this; this is on my TODO list).

Have you tried copying the buffers on x86? Also, if you make sure that the
incoming archives are aligned so you can avoid the copy on ppc, how much
faster does it get? I.e. does (time saved from your patch on ppc)  == (time
copying buffers with your patch on ppc) + (time saved if we use aligned
archives and avoid the copy with your patch (for testing purposes))?

Can you dig in a bit deeper and figure out where this speedup is coming
from? As it stands right now, this patch seems like a very opportunistic
"seems to work on my machine" speedup.

-- Sean Silva

> It makes the linker
> *faster* on powerpc:
> trunk:  2.165775601 seconds time elapsed ( +-  2.67% )
> patch: 1.979675092 seconds time elapsed  ( +-  2.96% )
> The issue is that right now it leaks. Who should own the Archive in
> lld when using --whole-archive?
> Cheers,
> Rafael
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150423/6944b81d/attachment.html>

More information about the llvm-commits mailing list