Fix the implementation of MachOObjectFile::isSectionZeroInit so it follows the MachO spec.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155976 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eli Friedman 2012-05-02 02:31:28 +00:00
parent 39cc513870
commit 41827f9ba2

View File

@ -598,13 +598,15 @@ error_code MachOObjectFile::isSectionZeroInit(DataRefImpl DRI,
if (MachOObj->is64Bit()) { if (MachOObj->is64Bit()) {
InMemoryStruct<macho::Section64> Sect; InMemoryStruct<macho::Section64> Sect;
getSection64(DRI, Sect); getSection64(DRI, Sect);
Result = (Sect->Flags & MachO::SectionTypeZeroFill || unsigned SectionType = Sect->Flags & MachO::SectionFlagMaskSectionType;
Sect->Flags & MachO::SectionTypeZeroFillLarge); Result = (SectionType == MachO::SectionTypeZeroFill ||
SectionType == MachO::SectionTypeZeroFillLarge);
} else { } else {
InMemoryStruct<macho::Section> Sect; InMemoryStruct<macho::Section> Sect;
getSection(DRI, Sect); getSection(DRI, Sect);
Result = (Sect->Flags & MachO::SectionTypeZeroFill || unsigned SectionType = Sect->Flags & MachO::SectionFlagMaskSectionType;
Sect->Flags & MachO::SectionTypeZeroFillLarge); Result = (SectionType == MachO::SectionTypeZeroFill ||
SectionType == MachO::SectionTypeZeroFillLarge);
} }
return object_error::success; return object_error::success;