Fix the implementation of MachOObjectFile::isSectionZeroInit so it follows the MachO spec.
llvm-svn: 155976
diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp
index 3bcda17..5de9453 100644
--- a/llvm/lib/Object/MachOObjectFile.cpp
+++ b/llvm/lib/Object/MachOObjectFile.cpp
@@ -598,13 +598,15 @@
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;