summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object/ArchiveWriter.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-07-09 19:48:06 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-07-09 19:48:06 +0000
commit594e676cbe475dc879980e919731c3614aa083eb (patch)
tree8a0481d1897f997251ac8c782c125b9f13941856 /llvm/lib/Object/ArchiveWriter.cpp
parent5a88e1a8c649ecb5567b8263f4426d781f1c3b72 (diff)
downloadbcm5719-llvm-594e676cbe475dc879980e919731c3614aa083eb.tar.gz
bcm5719-llvm-594e676cbe475dc879980e919731c3614aa083eb.zip
llvm-ar: Pad the symbol table to 4 bytes.
It looks like ld64 requires it. With this we seem to be able to bootstrap using llvm-ar+/usr/bin/true instead of ar+ranlib (currently on stage2). llvm-svn: 241842
Diffstat (limited to 'llvm/lib/Object/ArchiveWriter.cpp')
-rw-r--r--llvm/lib/Object/ArchiveWriter.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Object/ArchiveWriter.cpp b/llvm/lib/Object/ArchiveWriter.cpp
index c485b34a081..1148c847549 100644
--- a/llvm/lib/Object/ArchiveWriter.cpp
+++ b/llvm/lib/Object/ArchiveWriter.cpp
@@ -237,8 +237,11 @@ writeSymbolTable(raw_fd_ostream &Out, object::Archive::Kind Kind,
print32(Out, Kind, StringTable.size()); // byte count of the string table
Out << StringTable;
- if (Out.tell() % 2)
- Out << '\0';
+ // ld64 requires the next member header to start at an offset that is
+ // 4 bytes aligned.
+ unsigned Pad = OffsetToAlignment(Out.tell(), 4);
+ while (Pad--)
+ Out.write(uint8_t(0));
// Patch up the size of the symbol table now that we know how big it is.
unsigned Pos = Out.tell();
OpenPOWER on IntegriCloud