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()) {
InMemoryStruct<macho::Section64> Sect;
getSection64(DRI, Sect);
Result = (Sect->Flags & MachO::SectionTypeZeroFill ||
Sect->Flags & MachO::SectionTypeZeroFillLarge);
unsigned SectionType = Sect->Flags & MachO::SectionFlagMaskSectionType;
Result = (SectionType == MachO::SectionTypeZeroFill ||
SectionType == MachO::SectionTypeZeroFillLarge);
} else {
InMemoryStruct<macho::Section> Sect;
getSection(DRI, Sect);
Result = (Sect->Flags & MachO::SectionTypeZeroFill ||
Sect->Flags & MachO::SectionTypeZeroFillLarge);
unsigned SectionType = Sect->Flags & MachO::SectionFlagMaskSectionType;
Result = (SectionType == MachO::SectionTypeZeroFill ||
SectionType == MachO::SectionTypeZeroFillLarge);
}
return object_error::success;