Teach llvm-size to know about Mach-O universal files (aka fat files) and

fat files containing archives.

Also fix a bug in MachOUniversalBinary::ObjectForArch::ObjectForArch()
where it needed a >= when comparing the Index with the number of
objects in a fat file.  As the index starts at 0.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211230 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Kevin Enderby
2014-06-18 22:04:40 +00:00
parent ce09bda96e
commit fb2b9fb894
3 changed files with 65 additions and 1 deletions

View File

@@ -53,7 +53,7 @@ static T getUniversalBinaryStruct(const char *Ptr) {
MachOUniversalBinary::ObjectForArch::ObjectForArch(
const MachOUniversalBinary *Parent, uint32_t Index)
: Parent(Parent), Index(Index) {
if (!Parent || Index > Parent->getNumberOfObjects()) {
if (!Parent || Index >= Parent->getNumberOfObjects()) {
clear();
} else {
// Parse object header.