What to do about alignment of ELF objects
Michael Spencer
bigcheesegs at gmail.com
Thu Apr 23 11:27:29 PDT 2015
On Wed, Apr 22, 2015 at 12:06 PM, Rafael EspĂndola
<rafael.espindola at gmail.com> wrote:
> Currently the lower level APIs keep track of the alignment of elf
> objects in memory.
>
> At some point along the layers we switch to just using 2 byte
> alignment because of archives.
>
> One option is to just use 2 everywhere.
>
> Another is to copy the data to make it aligned. These patches do just that.
>
> I tested them by linking an X86_64 clang in an ppc64le machine. Having
> aligned access seems to help on ppc64le:
As long as there's no performance reggression on x86-64 from doing
that I'm fine with it.
- Michael Spencer
>
> trunk:
>
> 2.165775601 seconds time elapsed
> ( +- 2.67% )
>
> patch:
>
> 1.979675092 seconds time elapsed
> ( +- 2.96% )
>
> The main missing issue is the memory leak. The reason we can't have
> Archive just own the buffer for the unaligned members is that in lld
> we have
>
> ----------------------------------------
> FileVector loadFile(LinkingContext &ctx, StringRef path, bool wholeArchive) {
> ErrorOr<std::unique_ptr<MemoryBuffer>> mb
> = MemoryBuffer::getFileOrSTDIN(path);
> if (std::error_code ec = mb.getError())
> return makeErrorFile(path, ec);
> std::vector<std::unique_ptr<File>> files;
> if (std::error_code ec = ctx.registry().loadFile(std::move(mb.get()), files))
> return makeErrorFile(path, ec);
> if (wholeArchive)
> return parseMemberFiles(files);
> return files;
> }
> --------------------------------------
>
> So if --whole-archive is used, the Archive itself is freed and we then
> try to use the members.
>
> Should the registry have a place for putting Archives?
>
> Cheers,
> Rafael
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
More information about the llvm-commits
mailing list