Index: ELF/Target.cpp =================================================================== --- ELF/Target.cpp +++ ELF/Target.cpp @@ -46,28 +46,28 @@ if (isInt(V)) return; StringRef S = getELFRelocationTypeName(Config->EMachine, Type); - fatal("Relocation " + S + " out of range"); + error("Relocation " + S + " out of range"); } template static void checkUInt(uint64_t V, uint32_t Type) { if (isUInt(V)) return; StringRef S = getELFRelocationTypeName(Config->EMachine, Type); - fatal("Relocation " + S + " out of range"); + error("Relocation " + S + " out of range"); } template static void checkIntUInt(uint64_t V, uint32_t Type) { if (isInt(V) || isUInt(V)) return; StringRef S = getELFRelocationTypeName(Config->EMachine, Type); - fatal("Relocation " + S + " out of range"); + error("Relocation " + S + " out of range"); } template static void checkAlignment(uint64_t V, uint32_t Type) { if ((V & (N - 1)) == 0) return; StringRef S = getELFRelocationTypeName(Config->EMachine, Type); - fatal("Improper alignment for relocation " + S); + error("Improper alignment for relocation " + S); } template bool isGnuIFunc(const SymbolBody &S) { @@ -444,7 +444,7 @@ write32le(Loc, Out::TlsPhdr->p_memsz - SA); break; default: - fatal("unrecognized reloc " + Twine(Type)); + error("unrecognized reloc " + Twine(Type)); } } @@ -903,7 +903,7 @@ write32le(Loc, SA - P); break; default: - fatal("unrecognized reloc " + Twine(Type)); + error("unrecognized reloc " + Twine(Type)); } } @@ -933,7 +933,7 @@ write16be(Loc, applyPPCLo(SA)); break; default: - fatal("unrecognized reloc " + Twine(Type)); + error("unrecognized reloc " + Twine(Type)); } } @@ -1141,7 +1141,7 @@ write64be(Loc, SA); break; default: - fatal("unrecognized reloc " + Twine(Type)); + error("unrecognized reloc " + Twine(Type)); } } @@ -1160,8 +1160,10 @@ if (Type == R_AARCH64_ABS32 || Type == R_AARCH64_ABS64) return Type; StringRef S = getELFRelocationTypeName(EM_AARCH64, Type); - fatal("Relocation " + S + " cannot be used when making a shared object; " + error("Relocation " + S + " cannot be used when making a shared object; " "recompile with -fPIC."); + // Keep it going with a dummy value so that we can find more reloc errors. + return R_AARCH64_ABS32; } void AArch64TargetInfo::writeGotPlt(uint8_t *Buf, uint64_t Plt) const { @@ -1376,7 +1378,7 @@ break; } default: - fatal("unrecognized reloc " + Twine(Type)); + error("unrecognized reloc " + Twine(Type)); } } @@ -1401,8 +1403,10 @@ if (Type == R_MIPS_32 || Type == R_MIPS_64) return R_MIPS_REL32; StringRef S = getELFRelocationTypeName(EM_MIPS, Type); - fatal("Relocation " + S + " cannot be used when making a shared object; " + error("Relocation " + S + " cannot be used when making a shared object; " "recompile with -fPIC."); + // Keep it going with a dummy value so that we can find more reloc errors. + return R_MIPS_32; } template @@ -1516,7 +1520,7 @@ break; } default: - fatal("unrecognized reloc " + Twine(Type)); + error("unrecognized reloc " + Twine(Type)); } } Index: ELF/Writer.cpp =================================================================== --- ELF/Writer.cpp +++ ELF/Writer.cpp @@ -163,6 +163,8 @@ openFile(Config->OutputFile); writeHeader(); writeSections(); + if (HasError) + return; fatal(Buffer->commit()); }