diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2017-09-22 18:36:00 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2017-09-22 18:36:00 +0000 |
commit | 0bd982b79f9620379719834ba6008c0a487b0645 (patch) | |
tree | 4d58b8ebd1b75300be13d095d02e39b9b3a18017 /llvm/lib/Object/ArchiveWriter.cpp | |
parent | 25eb54f789bfb5ddc53d45438ee013168f34c7cf (diff) | |
download | bcm5719-llvm-0bd982b79f9620379719834ba6008c0a487b0645.tar.gz bcm5719-llvm-0bd982b79f9620379719834ba6008c0a487b0645.zip |
llvm-ar: align the first archive member consistently.
Before we were aligning the member after the symbol table to 4 but
other members to 8.
llvm-svn: 314010
Diffstat (limited to 'llvm/lib/Object/ArchiveWriter.cpp')
-rw-r--r-- | llvm/lib/Object/ArchiveWriter.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/Object/ArchiveWriter.cpp b/llvm/lib/Object/ArchiveWriter.cpp index ce83cb1245f..4586d4427fe 100644 --- a/llvm/lib/Object/ArchiveWriter.cpp +++ b/llvm/lib/Object/ArchiveWriter.cpp @@ -349,9 +349,11 @@ writeSymbolTable(raw_fd_ostream &Out, object::Archive::Kind Kind, if (StringTable.size() == 0) print32(Out, Kind, 0); - // ld64 requires the next member header to start at an offset that is - // 4 bytes aligned. - unsigned Alignment = isBSDLike(Kind) ? 4 : 2; + // ld64 expects the members to be 8-byte aligned for 64-bit content and at + // least 4-byte aligned for 32-bit content. Opt for the larger encoding + // uniformly. + // We do this for all bsd formats because it simplifies aligning members. + unsigned Alignment = isBSDLike(Kind) ? 8 : 2; unsigned Pad = OffsetToAlignment(Out.tell(), Alignment); while (Pad--) Out.write(uint8_t(0)); |