diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2011-05-26 18:59:54 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2011-05-26 18:59:54 +0000 |
commit | c9687b32fab6d6ec53ac95dccf61d598be26d5dc (patch) | |
tree | 08cb1ea6008de3081040e21808035a2e039347de /lib/Bitcode | |
parent | cf0cd8005c81853ddea3ce26b71491c48dc4984e (diff) | |
download | external_llvm-c9687b32fab6d6ec53ac95dccf61d598be26d5dc.zip external_llvm-c9687b32fab6d6ec53ac95dccf61d598be26d5dc.tar.gz external_llvm-c9687b32fab6d6ec53ac95dccf61d598be26d5dc.tar.bz2 |
Fix LTO builds with xcode 4.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132132 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bitcode')
-rw-r--r-- | lib/Bitcode/Reader/BitcodeReader.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index 19f57cf..c4ef57c 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/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(); |