Index: lib/ReaderWriter/ELF/ARM/ARMRelocationHandler.cpp =================================================================== --- lib/ReaderWriter/ELF/ARM/ARMRelocationHandler.cpp +++ lib/ReaderWriter/ELF/ARM/ARMRelocationHandler.cpp @@ -514,7 +514,7 @@ // Flags that the relocation addresses Thumb instruction bool thumb = false; - if (const auto *definedAtom = dyn_cast(ref.target())) { + if (const auto *definedAtom = dyn_cast_or_null(ref.target())) { thumb = isThumbCode(definedAtom); } @@ -596,6 +596,9 @@ case R_ARM_IRELATIVE: // Runtime only relocations. Ignore here. break; + case R_ARM_V4BX: + // TODO implement + break; default: return make_unhandled_reloc_error(); } Index: lib/ReaderWriter/ELF/ELFFile.cpp =================================================================== --- lib/ReaderWriter/ELF/ELFFile.cpp +++ lib/ReaderWriter/ELF/ELFFile.cpp @@ -38,7 +38,7 @@ const Elf_Sym *targetSym) { // Return the atom for targetSym if we can do so. Atom *target = _symbolToAtomMapping.lookup(targetSym); - if (target->definition() != Atom::definitionRegular) + if (!target || target->definition() != Atom::definitionRegular) return target; Atom::Scope scope = llvm::cast(target)->scope(); if (scope == DefinedAtom::scopeTranslationUnit) Index: lib/ReaderWriter/ELF/SectionChunks.h =================================================================== --- lib/ReaderWriter/ELF/SectionChunks.h +++ lib/ReaderWriter/ELF/SectionChunks.h @@ -286,11 +286,14 @@ kindValStr = "unknown"; } + StringRef targetName = "undefined"; + if (ref.target()) + targetName = ref.target()->name(); std::string errStr = (Twine(errorStr) + " in file " + atom._atom->file().path() + ": reference from " + atom._atom->name() + "+" + Twine(ref.offsetInAtom()) + - " to " + ref.target()->name() + + " to " + targetName + "+" + Twine(ref.addend()) + " of type " + Twine(ref.kindValue()) + " (" + kindValStr + ")\n").str();