diff options
-rw-r--r-- | lld/ELF/Target.cpp | 16 | ||||
-rw-r--r-- | lld/ELF/Writer.cpp | 2 | ||||
-rw-r--r-- | lld/test/ELF/x86-64-reloc-32S-error.s | 7 | ||||
-rw-r--r-- | lld/test/ELF/x86-64-reloc-error.s (renamed from lld/test/ELF/x86-64-reloc-32-error.s) | 4 |
4 files changed, 15 insertions, 14 deletions
diff --git a/lld/ELF/Target.cpp b/lld/ELF/Target.cpp index d248459db1f..6d185eb7722 100644 --- a/lld/ELF/Target.cpp +++ b/lld/ELF/Target.cpp @@ -46,28 +46,28 @@ template <unsigned N> static void checkInt(int64_t V, uint32_t Type) { if (isInt<N>(V)) return; StringRef S = getELFRelocationTypeName(Config->EMachine, Type); - fatal("Relocation " + S + " out of range"); + error("Relocation " + S + " out of range"); } template <unsigned N> static void checkUInt(uint64_t V, uint32_t Type) { if (isUInt<N>(V)) return; StringRef S = getELFRelocationTypeName(Config->EMachine, Type); - fatal("Relocation " + S + " out of range"); + error("Relocation " + S + " out of range"); } template <unsigned N> static void checkIntUInt(uint64_t V, uint32_t Type) { if (isInt<N>(V) || isUInt<N>(V)) return; StringRef S = getELFRelocationTypeName(Config->EMachine, Type); - fatal("Relocation " + S + " out of range"); + error("Relocation " + S + " out of range"); } template <unsigned N> 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 <class ELFT> bool isGnuIFunc(const SymbolBody &S) { @@ -1156,8 +1156,10 @@ unsigned AArch64TargetInfo::getDynRel(unsigned Type) const { 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 { @@ -1397,8 +1399,10 @@ unsigned MipsTargetInfo<ELFT>::getDynRel(unsigned Type) const { 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 <class ELFT> diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index f8f6215003b..c67567c7b26 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -163,6 +163,8 @@ template <class ELFT> void Writer<ELFT>::run() { openFile(Config->OutputFile); writeHeader(); writeSections(); + if (HasError) + return; fatal(Buffer->commit()); } diff --git a/lld/test/ELF/x86-64-reloc-32S-error.s b/lld/test/ELF/x86-64-reloc-32S-error.s deleted file mode 100644 index aa19c2c32e9..00000000000 --- a/lld/test/ELF/x86-64-reloc-32S-error.s +++ /dev/null @@ -1,7 +0,0 @@ -// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t -// RUN: not ld.lld -shared %t -o %t2 2>&1 | FileCheck %s -// REQUIRES: x86 - - movq _start - 0x1000000000000, %rdx - -#CHECK: R_X86_64_32S out of range diff --git a/lld/test/ELF/x86-64-reloc-32-error.s b/lld/test/ELF/x86-64-reloc-error.s index b5d476bcf08..bc91b967241 100644 --- a/lld/test/ELF/x86-64-reloc-32-error.s +++ b/lld/test/ELF/x86-64-reloc-error.s @@ -4,5 +4,7 @@ // REQUIRES: x86 movl $big, %edx + movq _start - 0x1000000000000, %rdx -#CHECK: R_X86_64_32 out of range +# CHECK: R_X86_64_32 out of range +# CHECK: R_X86_64_32S out of range |