diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp --- a/llvm/lib/Object/MachOObjectFile.cpp +++ b/llvm/lib/Object/MachOObjectFile.cpp @@ -1836,6 +1836,8 @@ 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;