summaryrefslogtreecommitdiff
path: root/lib/Object/MachOObjectFile.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2012-05-02 02:31:28 +0000
committerEli Friedman <eli.friedman@gmail.com>2012-05-02 02:31:28 +0000
commit41827f9ba2745cfe16d94775f6fd0803b0efef23 (patch)
tree71c7b0e6d032244454cb3a318b88b32a6d1a147c /lib/Object/MachOObjectFile.cpp
parent39cc5138707eee563db7a487cd720b232b4b58fd (diff)
downloadllvm-41827f9ba2745cfe16d94775f6fd0803b0efef23.tar.gz
llvm-41827f9ba2745cfe16d94775f6fd0803b0efef23.tar.bz2
llvm-41827f9ba2745cfe16d94775f6fd0803b0efef23.tar.xz
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
Diffstat (limited to 'lib/Object/MachOObjectFile.cpp')
-rw-r--r--lib/Object/MachOObjectFile.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/Object/MachOObjectFile.cpp b/lib/Object/MachOObjectFile.cpp
index 3bcda1700b..5de945300c 100644
--- a/lib/Object/MachOObjectFile.cpp
+++ b/lib/Object/MachOObjectFile.cpp
@@ -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;