[llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp
Chris Lattner
lattner at cs.uiuc.edu
Mon Sep 27 09:59:19 PDT 2004
Changes in directory llvm/lib/Bytecode/Reader:
Reader.cpp updated: 1.130 -> 1.131
---
Log message:
The system ranlib on darwin occasionally adds two extra newlines to the
end of files, breaking the CFE build. As a gross hack around this,
ignore any trailing garbage on bytecode files. Thanks to Brian for digging
in and identifying the problem.
---
Diffs of the changes: (+8 -2)
Index: llvm/lib/Bytecode/Reader/Reader.cpp
diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.130 llvm/lib/Bytecode/Reader/Reader.cpp:1.131
--- llvm/lib/Bytecode/Reader/Reader.cpp:1.130 Wed Sep 15 12:06:41 2004
+++ llvm/lib/Bytecode/Reader/Reader.cpp Mon Sep 27 11:59:06 2004
@@ -2139,10 +2139,16 @@
error("Expected Module Block! Type:" + utostr(Type) + ", Size:"
+ utostr(Size));
}
- if (At + Size != MemEnd) {
+
+ // It looks like the darwin ranlib program is broken, and adds trailing
+ // garbage to the end of some bytecode files. This hack allows the bc
+ // reader to ignore trailing garbage on bytecode files.
+ if (At + Size < MemEnd)
+ MemEnd = BlockEnd = At+Size;
+
+ if (At + Size != MemEnd)
error("Invalid Top Level Block Length! Type:" + utostr(Type)
+ ", Size:" + utostr(Size));
- }
// Parse the module contents
this->ParseModule();
More information about the llvm-commits
mailing list