Index: ELF/InputSection.cpp =================================================================== --- ELF/InputSection.cpp +++ ELF/InputSection.cpp @@ -279,14 +279,15 @@ std::string Filename = File ? File->getName() : "(internal)"; std::string Archive; - if (!File->ArchiveName.empty()) + if (File && !File->ArchiveName.empty()) Archive = (" in archive " + File->ArchiveName).str(); // Find a symbol that encloses a given location. - for (SymbolBody *B : getFile()->getSymbols()) - if (auto *D = dyn_cast(B)) - if (D->Section == this && D->Value <= Off && Off < D->Value + D->Size) - return Filename + ":(" + toString(*D) + ")" + Archive; + if (File) + for (SymbolBody *B : File->getSymbols()) + if (auto *D = dyn_cast(B)) + if (D->Section == this && D->Value <= Off && Off < D->Value + D->Size) + return Filename + ":(" + toString(*D) + ")" + Archive; // If there's no symbol, print out the offset in the section. return (Filename + ":(" + Name + "+0x" + utohexstr(Off) + ")" + Archive)