summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2011-05-26 18:59:54 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2011-05-26 18:59:54 +0000
commita97b238024292b245963410a9a25bda4cd6b25fd (patch)
tree37449ddaa44d3ea331662a385785d98a725efd50 /llvm/lib/Bitcode
parentaa560006eda6a077944c89d01db332c092513b76 (diff)
downloadbcm5719-llvm-a97b238024292b245963410a9a25bda4cd6b25fd.tar.gz
bcm5719-llvm-a97b238024292b245963410a9a25bda4cd6b25fd.zip
Fix LTO builds with xcode 4.
llvm-svn: 132132
Diffstat (limited to 'llvm/lib/Bitcode')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 19f57cf6907..c4ef57cb724 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -1588,8 +1588,18 @@ bool BitcodeReader::ParseBitcodeInto(Module *M) {
while (!Stream.AtEndOfStream()) {
unsigned Code = Stream.ReadCode();
- if (Code != bitc::ENTER_SUBBLOCK)
+ if (Code != bitc::ENTER_SUBBLOCK) {
+
+ // The ranlib in xcode 4 will align archive members by appending newlines to the
+ // end of them. If this file size is a multiple of 4 but not 8, we have to read and
+ // ignore these final 4 bytes :-(
+ if (Stream.GetAbbrevIDWidth() == 2 && Code == 2 &&
+ Stream.Read(6) == 2 && Stream.Read(24) == 0xa0a0a &&
+ Stream.AtEndOfStream())
+ return false;
+
return Error("Invalid record at top-level");
+ }
unsigned BlockID = Stream.ReadSubBlockID();
OpenPOWER on IntegriCloud