diff options
Diffstat (limited to 'lib/Object/MachOObjectFile.cpp')
-rw-r--r-- | lib/Object/MachOObjectFile.cpp | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/lib/Object/MachOObjectFile.cpp b/lib/Object/MachOObjectFile.cpp index da7615714e..40f5390a96 100644 --- a/lib/Object/MachOObjectFile.cpp +++ b/lib/Object/MachOObjectFile.cpp @@ -447,9 +447,7 @@ error_code MachOObjectFile::getSectionNext(DataRefImpl DRI, void MachOObjectFile::getSection(DataRefImpl DRI, InMemoryStruct<macho::Section> &Res) const { - InMemoryStruct<macho::SegmentLoadCommand> SLC; LoadCommandInfo LCI = MachOObj->getLoadCommandInfo(DRI.d.a); - MachOObj->ReadSegmentLoadCommand(LCI, SLC); MachOObj->ReadSection(LCI, DRI.d.b, Res); } @@ -463,9 +461,7 @@ std::size_t MachOObjectFile::getSectionIndex(DataRefImpl Sec) const { void MachOObjectFile::getSection64(DataRefImpl DRI, InMemoryStruct<macho::Section64> &Res) const { - InMemoryStruct<macho::Segment64LoadCommand> SLC; LoadCommandInfo LCI = MachOObj->getLoadCommandInfo(DRI.d.a); - MachOObj->ReadSegment64LoadCommand(LCI, SLC); MachOObj->ReadSection64(LCI, DRI.d.b, Res); } @@ -482,9 +478,7 @@ error_code MachOObjectFile::getSectionName(DataRefImpl DRI, // FIXME: thread safety. static char result[34]; if (is64BitLoadCommand(MachOObj.get(), DRI)) { - InMemoryStruct<macho::Segment64LoadCommand> SLC; LoadCommandInfo LCI = MachOObj->getLoadCommandInfo(DRI.d.a); - MachOObj->ReadSegment64LoadCommand(LCI, SLC); InMemoryStruct<macho::Section64> Sect; MachOObj->ReadSection64(LCI, DRI.d.b, Sect); @@ -492,9 +486,7 @@ error_code MachOObjectFile::getSectionName(DataRefImpl DRI, strcat(result, ","); strcat(result, Sect->Name); } else { - InMemoryStruct<macho::SegmentLoadCommand> SLC; LoadCommandInfo LCI = MachOObj->getLoadCommandInfo(DRI.d.a); - MachOObj->ReadSegmentLoadCommand(LCI, SLC); InMemoryStruct<macho::Section> Sect; MachOObj->ReadSection(LCI, DRI.d.b, Sect); @@ -567,11 +559,11 @@ error_code MachOObjectFile::isSectionText(DataRefImpl DRI, if (is64BitLoadCommand(MachOObj.get(), DRI)) { InMemoryStruct<macho::Section64> Sect; getSection64(DRI, Sect); - Result = !strcmp(Sect->Name, "__text"); + Result = Sect->Flags & macho::SF_PureInstructions; } else { InMemoryStruct<macho::Section> Sect; getSection(DRI, Sect); - Result = !strcmp(Sect->Name, "__text"); + Result = Sect->Flags & macho::SF_PureInstructions; } return object_error::success; } |