diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2021-07-29 20:15:26 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2021-07-29 20:15:26 +0000 |
commit | 344a3780b2e33f6ca763666c380202b18aab72a3 (patch) | |
tree | f0b203ee6eb71d7fdd792373e3c81eb18d6934dd /llvm/lib/Object/MachOObjectFile.cpp | |
parent | b60736ec1405bb0a8dd40989f67ef4c93da068ab (diff) |
vendor/llvm-project/llvmorg-13-init-16847-g88e66fa60ae5vendor/llvm-project/llvmorg-12.0.1-rc2-0-ge7dac564cd0evendor/llvm-project/llvmorg-12.0.1-0-gfed41342a82f
Diffstat (limited to 'llvm/lib/Object/MachOObjectFile.cpp')
-rw-r--r-- | llvm/lib/Object/MachOObjectFile.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp index 302255926289..177314a9a790 100644 --- a/llvm/lib/Object/MachOObjectFile.cpp +++ b/llvm/lib/Object/MachOObjectFile.cpp @@ -42,7 +42,6 @@ #include <limits> #include <list> #include <memory> -#include <string> #include <system_error> using namespace llvm; @@ -1836,6 +1835,8 @@ MachOObjectFile::getSymbolType(DataRefImpl Symb) const { if (!SecOrError) return SecOrError.takeError(); section_iterator Sec = *SecOrError; + if (Sec == section_end()) + return SymbolRef::ST_Other; if (Sec->isData() || Sec->isBSS()) return SymbolRef::ST_Data; return SymbolRef::ST_Function; @@ -2033,7 +2034,14 @@ bool MachOObjectFile::isSectionBSS(DataRefImpl Sec) const { SectionType == MachO::S_GB_ZEROFILL); } -bool MachOObjectFile::isDebugSection(StringRef SectionName) const { +bool MachOObjectFile::isDebugSection(DataRefImpl Sec) const { + Expected<StringRef> SectionNameOrErr = getSectionName(Sec); + if (!SectionNameOrErr) { + // TODO: Report the error message properly. + consumeError(SectionNameOrErr.takeError()); + return false; + } + StringRef SectionName = SectionNameOrErr.get(); return SectionName.startswith("__debug") || SectionName.startswith("__zdebug") || SectionName.startswith("__apple") || SectionName == "__gdb_index" || |