aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/ArchiveWriter.cpp
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2017-02-09 04:26:21 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2017-02-09 04:26:21 +0000
commitb4a162be21cfc20cebe4de7a388cb6c3edac53da (patch)
treeb65b32f6aeaaa56d5cab3a5fb76e034bd38acf46 /llvm/lib/Object/ArchiveWriter.cpp
parent50b1a33211c4a6a3ae2974f0718eca2b1b93e86b (diff)
downloadllvm-b4a162be21cfc20cebe4de7a388cb6c3edac53da.zip
llvm-b4a162be21cfc20cebe4de7a388cb6c3edac53da.tar.gz
llvm-b4a162be21cfc20cebe4de7a388cb6c3edac53da.tar.bz2
Object: pad BSD ar string table to 4-bytes
cctools would pad the string table to a sizeof(int32_t) (explicitly printed out by cctools rather than 4). This adjusts the string table to make it more compatible with cctools, but is insufficient to make ld64 happy. llvm-svn: 294557
Diffstat (limited to 'llvm/lib/Object/ArchiveWriter.cpp')
-rw-r--r--llvm/lib/Object/ArchiveWriter.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Object/ArchiveWriter.cpp b/llvm/lib/Object/ArchiveWriter.cpp
index f8e3c5a..ed4ef6a 100644
--- a/llvm/lib/Object/ArchiveWriter.cpp
+++ b/llvm/lib/Object/ArchiveWriter.cpp
@@ -316,6 +316,10 @@ writeSymbolTable(raw_fd_ostream &Out, object::Archive::Kind Kind,
if (HeaderStartOffset == 0)
return 0;
+ if (Kind == object::Archive::K_BSD)
+ for (unsigned P = OffsetToAlignment(NameOS.tell(), sizeof(int32_t)); P--;)
+ NameOS << '\0';
+
StringRef StringTable = NameOS.str();
if (Kind == object::Archive::K_BSD)
print32(Out, Kind, StringTable.size()); // byte count of the string table