diff options
author | Rui Ueyama <ruiu@google.com> | 2017-10-12 03:14:06 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2017-10-12 03:14:06 +0000 |
commit | be85529d2b9d16a4acb21f17f0bdce7a0495b179 (patch) | |
tree | 1d1a503bd9546b1457755bc46c27da65aa18155b | |
parent | d36f2030e245da16893e0ef577c9a57deb6642af (diff) | |
download | bcm5719-llvm-be85529d2b9d16a4acb21f17f0bdce7a0495b179.tar.gz bcm5719-llvm-be85529d2b9d16a4acb21f17f0bdce7a0495b179.zip |
Remove one parameter from Target::getRelExpr.
A section was passed to getRelExpr just to create an error message.
But if there's an invalid relocation, we would eventually report it
in relocateOne. So we don't have to pass a section to getRelExpr.
llvm-svn: 315552
-rw-r--r-- | lld/ELF/Arch/AArch64.cpp | 8 | ||||
-rw-r--r-- | lld/ELF/Arch/AMDGPU.cpp | 7 | ||||
-rw-r--r-- | lld/ELF/Arch/ARM.cpp | 8 | ||||
-rw-r--r-- | lld/ELF/Arch/AVR.cpp | 12 | ||||
-rw-r--r-- | lld/ELF/Arch/Mips.cpp | 26 | ||||
-rw-r--r-- | lld/ELF/Arch/PPC.cpp | 24 | ||||
-rw-r--r-- | lld/ELF/Arch/PPC64.cpp | 8 | ||||
-rw-r--r-- | lld/ELF/Arch/SPARCV9.cpp | 7 | ||||
-rw-r--r-- | lld/ELF/Arch/X86.cpp | 41 | ||||
-rw-r--r-- | lld/ELF/Arch/X86_64.cpp | 8 | ||||
-rw-r--r-- | lld/ELF/InputSection.cpp | 4 | ||||
-rw-r--r-- | lld/ELF/Relocations.cpp | 4 | ||||
-rw-r--r-- | lld/ELF/Relocations.h | 1 | ||||
-rw-r--r-- | lld/ELF/Target.h | 1 | ||||
-rw-r--r-- | lld/test/ELF/got32-i386.s | 2 | ||||
-rw-r--r-- | lld/test/ELF/got32x-i386.s | 4 | ||||
-rw-r--r-- | lld/test/ELF/invalid/invalid-debug-relocations.test | 2 | ||||
-rw-r--r-- | lld/test/ELF/invalid/invalid-relocation-x64.test | 4 |
18 files changed, 89 insertions, 82 deletions
diff --git a/lld/ELF/Arch/AArch64.cpp b/lld/ELF/Arch/AArch64.cpp index 5c90ebce672..49312c57c81 100644 --- a/lld/ELF/Arch/AArch64.cpp +++ b/lld/ELF/Arch/AArch64.cpp @@ -32,7 +32,7 @@ namespace { class AArch64 final : public TargetInfo { public: AArch64(); - RelExpr getRelExpr(RelType Type, const SymbolBody &S, const InputFile &File, + RelExpr getRelExpr(RelType Type, const SymbolBody &S, const uint8_t *Loc) const override; bool isPicRel(RelType Type) const override; void writeGotPlt(uint8_t *Buf, const SymbolBody &S) const override; @@ -69,10 +69,8 @@ AArch64::AArch64() { } RelExpr AArch64::getRelExpr(RelType Type, const SymbolBody &S, - const InputFile &File, const uint8_t *Loc) const { + const uint8_t *Loc) const { switch (Type) { - default: - return R_ABS; case R_AARCH64_TLSDESC_ADR_PAGE21: return R_TLSDESC_PAGE; case R_AARCH64_TLSDESC_LD64_LO12: @@ -104,6 +102,8 @@ RelExpr AArch64::getRelExpr(RelType Type, const SymbolBody &S, return R_GOT_PAGE_PC; case R_AARCH64_NONE: return R_NONE; + default: + return R_ABS; } } diff --git a/lld/ELF/Arch/AMDGPU.cpp b/lld/ELF/Arch/AMDGPU.cpp index 7364542e7be..1c82ff26bf9 100644 --- a/lld/ELF/Arch/AMDGPU.cpp +++ b/lld/ELF/Arch/AMDGPU.cpp @@ -26,7 +26,7 @@ class AMDGPU final : public TargetInfo { public: AMDGPU(); void relocateOne(uint8_t *Loc, RelType Type, uint64_t Val) const override; - RelExpr getRelExpr(RelType Type, const SymbolBody &S, const InputFile &File, + RelExpr getRelExpr(RelType Type, const SymbolBody &S, const uint8_t *Loc) const override; }; } // namespace @@ -59,7 +59,7 @@ void AMDGPU::relocateOne(uint8_t *Loc, RelType Type, uint64_t Val) const { } RelExpr AMDGPU::getRelExpr(RelType Type, const SymbolBody &S, - const InputFile &File, const uint8_t *Loc) const { + const uint8_t *Loc) const { switch (Type) { case R_AMDGPU_ABS32: case R_AMDGPU_ABS64: @@ -73,8 +73,7 @@ RelExpr AMDGPU::getRelExpr(RelType Type, const SymbolBody &S, case R_AMDGPU_GOTPCREL32_HI: return R_GOT_PC; default: - error(toString(&File) + ": unknown relocation type: " + toString(Type)); - return R_HINT; + return R_INVALID; } } diff --git a/lld/ELF/Arch/ARM.cpp b/lld/ELF/Arch/ARM.cpp index 5999cf13ec6..3fca467a1ca 100644 --- a/lld/ELF/Arch/ARM.cpp +++ b/lld/ELF/Arch/ARM.cpp @@ -26,7 +26,7 @@ namespace { class ARM final : public TargetInfo { public: ARM(); - RelExpr getRelExpr(RelType Type, const SymbolBody &S, const InputFile &File, + RelExpr getRelExpr(RelType Type, const SymbolBody &S, const uint8_t *Loc) const override; bool isPicRel(RelType Type) const override; RelType getDynRel(RelType Type) const override; @@ -65,10 +65,8 @@ ARM::ARM() { } RelExpr ARM::getRelExpr(RelType Type, const SymbolBody &S, - const InputFile &File, const uint8_t *Loc) const { + const uint8_t *Loc) const { switch (Type) { - default: - return R_ABS; case R_ARM_THM_JUMP11: return R_PC; case R_ARM_CALL: @@ -119,6 +117,8 @@ RelExpr ARM::getRelExpr(RelType Type, const SymbolBody &S, return R_NONE; case R_ARM_TLS_LE32: return R_TLS; + default: + return R_ABS; } } diff --git a/lld/ELF/Arch/AVR.cpp b/lld/ELF/Arch/AVR.cpp index 3dd33190663..a85e4783dda 100644 --- a/lld/ELF/Arch/AVR.cpp +++ b/lld/ELF/Arch/AVR.cpp @@ -43,21 +43,15 @@ using namespace lld::elf; namespace { class AVR final : public TargetInfo { public: - RelExpr getRelExpr(RelType Type, const SymbolBody &S, const InputFile &File, + RelExpr getRelExpr(RelType Type, const SymbolBody &S, const uint8_t *Loc) const override; void relocateOne(uint8_t *Loc, RelType Type, uint64_t Val) const override; }; } // namespace RelExpr AVR::getRelExpr(RelType Type, const SymbolBody &S, - const InputFile &File, const uint8_t *Loc) const { - switch (Type) { - case R_AVR_CALL: - return R_ABS; - default: - error(toString(&File) + ": unknown relocation type: " + toString(Type)); - return R_HINT; - } + const uint8_t *Loc) const { + return R_ABS; } void AVR::relocateOne(uint8_t *Loc, RelType Type, uint64_t Val) const { diff --git a/lld/ELF/Arch/Mips.cpp b/lld/ELF/Arch/Mips.cpp index 1d9431e4cb0..5f232dcfff8 100644 --- a/lld/ELF/Arch/Mips.cpp +++ b/lld/ELF/Arch/Mips.cpp @@ -28,7 +28,7 @@ namespace { template <class ELFT> class MIPS final : public TargetInfo { public: MIPS(); - RelExpr getRelExpr(RelType Type, const SymbolBody &S, const InputFile &File, + RelExpr getRelExpr(RelType Type, const SymbolBody &S, const uint8_t *Loc) const override; int64_t getImplicitAddend(const uint8_t *Buf, RelType Type) const override; bool isPicRel(RelType Type) const override; @@ -71,11 +71,11 @@ template <class ELFT> MIPS<ELFT>::MIPS() { template <class ELFT> RelExpr MIPS<ELFT>::getRelExpr(RelType Type, const SymbolBody &S, - const InputFile &File, const uint8_t *Loc) const { // See comment in the calculateMipsRelChain. if (ELFT::Is64Bits || Config->MipsN32Abi) Type &= 0xff; + switch (Type) { case R_MIPS_JALR: case R_MICROMIPS_JALR: @@ -174,9 +174,7 @@ RelExpr MIPS<ELFT>::getRelExpr(RelType Type, const SymbolBody &S, case R_MIPS_NONE: return R_NONE; default: - error("do not know how to handle relocation '" + toString(Type) + "' (" + - Twine(Type) + ")"); - return R_HINT; + return R_INVALID; } } @@ -353,8 +351,6 @@ template <class ELFT> int64_t MIPS<ELFT>::getImplicitAddend(const uint8_t *Buf, RelType Type) const { const endianness E = ELFT::TargetEndianness; switch (Type) { - default: - return 0; case R_MIPS_32: case R_MIPS_GPREL32: case R_MIPS_TLS_DTPREL32: @@ -417,6 +413,8 @@ int64_t MIPS<ELFT>::getImplicitAddend(const uint8_t *Buf, RelType Type) const { return SignExtend64<25>(readShuffle<E>(Buf) << 2); case R_MICROMIPS_PC26_S1: return SignExtend64<27>(readShuffle<E>(Buf) << 1); + default: + return 0; } } @@ -453,20 +451,24 @@ calculateMipsRelChain(uint8_t *Loc, RelType Type, uint64_t Val) { template <class ELFT> void MIPS<ELFT>::relocateOne(uint8_t *Loc, RelType Type, uint64_t Val) const { const endianness E = ELFT::TargetEndianness; + // Thread pointer and DRP offsets from the start of TLS data area. // https://www.linux-mips.org/wiki/NPTL if (Type == R_MIPS_TLS_DTPREL_HI16 || Type == R_MIPS_TLS_DTPREL_LO16 || Type == R_MIPS_TLS_DTPREL32 || Type == R_MIPS_TLS_DTPREL64 || Type == R_MICROMIPS_TLS_DTPREL_HI16 || - Type == R_MICROMIPS_TLS_DTPREL_LO16) + Type == R_MICROMIPS_TLS_DTPREL_LO16) { Val -= 0x8000; - else if (Type == R_MIPS_TLS_TPREL_HI16 || Type == R_MIPS_TLS_TPREL_LO16 || - Type == R_MIPS_TLS_TPREL32 || Type == R_MIPS_TLS_TPREL64 || - Type == R_MICROMIPS_TLS_TPREL_HI16 || - Type == R_MICROMIPS_TLS_TPREL_LO16) + } else if (Type == R_MIPS_TLS_TPREL_HI16 || Type == R_MIPS_TLS_TPREL_LO16 || + Type == R_MIPS_TLS_TPREL32 || Type == R_MIPS_TLS_TPREL64 || + Type == R_MICROMIPS_TLS_TPREL_HI16 || + Type == R_MICROMIPS_TLS_TPREL_LO16) { Val -= 0x7000; + } + if (ELFT::Is64Bits || Config->MipsN32Abi) std::tie(Type, Val) = calculateMipsRelChain(Loc, Type, Val); + switch (Type) { case R_MIPS_32: case R_MIPS_GPREL32: diff --git a/lld/ELF/Arch/PPC.cpp b/lld/ELF/Arch/PPC.cpp index 8514b6599ad..cf170fcb8c2 100644 --- a/lld/ELF/Arch/PPC.cpp +++ b/lld/ELF/Arch/PPC.cpp @@ -23,11 +23,22 @@ class PPC final : public TargetInfo { public: PPC() { GotBaseSymOff = 0x8000; } void relocateOne(uint8_t *Loc, RelType Type, uint64_t Val) const override; - RelExpr getRelExpr(RelType Type, const SymbolBody &S, const InputFile &File, + RelExpr getRelExpr(RelType Type, const SymbolBody &S, const uint8_t *Loc) const override; }; } // namespace +RelExpr PPC::getRelExpr(RelType Type, const SymbolBody &S, + const uint8_t *Loc) const { + switch (Type) { + case R_PPC_REL24: + case R_PPC_REL32: + return R_PC; + default: + return R_ABS; + } +} + void PPC::relocateOne(uint8_t *Loc, RelType Type, uint64_t Val) const { switch (Type) { case R_PPC_ADDR16_HA: @@ -48,17 +59,6 @@ void PPC::relocateOne(uint8_t *Loc, RelType Type, uint64_t Val) const { } } -RelExpr PPC::getRelExpr(RelType Type, const SymbolBody &S, - const InputFile &File, const uint8_t *Loc) const { - switch (Type) { - case R_PPC_REL24: - case R_PPC_REL32: - return R_PC; - default: - return R_ABS; - } -} - TargetInfo *elf::getPPCTargetInfo() { static PPC Target; return &Target; diff --git a/lld/ELF/Arch/PPC64.cpp b/lld/ELF/Arch/PPC64.cpp index c1203fa12e6..e82e08636c1 100644 --- a/lld/ELF/Arch/PPC64.cpp +++ b/lld/ELF/Arch/PPC64.cpp @@ -39,7 +39,7 @@ namespace { class PPC64 final : public TargetInfo { public: PPC64(); - RelExpr getRelExpr(RelType Type, const SymbolBody &S, const InputFile &File, + RelExpr getRelExpr(RelType Type, const SymbolBody &S, const uint8_t *Loc) const override; void writePlt(uint8_t *Buf, uint64_t GotPltEntryAddr, uint64_t PltEntryAddr, int32_t Index, unsigned RelOff) const override; @@ -83,10 +83,8 @@ PPC64::PPC64() { } RelExpr PPC64::getRelExpr(RelType Type, const SymbolBody &S, - const InputFile &File, const uint8_t *Loc) const { + const uint8_t *Loc) const { switch (Type) { - default: - return R_ABS; case R_PPC64_TOC16: case R_PPC64_TOC16_DS: case R_PPC64_TOC16_HA: @@ -98,6 +96,8 @@ RelExpr PPC64::getRelExpr(RelType Type, const SymbolBody &S, return R_PPC_TOC; case R_PPC64_REL24: return R_PPC_PLT_OPD; + default: + return R_ABS; } } diff --git a/lld/ELF/Arch/SPARCV9.cpp b/lld/ELF/Arch/SPARCV9.cpp index 0ced97de981..175579e11de 100644 --- a/lld/ELF/Arch/SPARCV9.cpp +++ b/lld/ELF/Arch/SPARCV9.cpp @@ -24,7 +24,7 @@ namespace { class SPARCV9 final : public TargetInfo { public: SPARCV9(); - RelExpr getRelExpr(RelType Type, const SymbolBody &S, const InputFile &File, + RelExpr getRelExpr(RelType Type, const SymbolBody &S, const uint8_t *Loc) const override; void writePlt(uint8_t *Buf, uint64_t GotEntryAddr, uint64_t PltEntryAddr, int32_t Index, unsigned RelOff) const override; @@ -47,7 +47,7 @@ SPARCV9::SPARCV9() { } RelExpr SPARCV9::getRelExpr(RelType Type, const SymbolBody &S, - const InputFile &File, const uint8_t *Loc) const { + const uint8_t *Loc) const { switch (Type) { case R_SPARC_32: case R_SPARC_UA32: @@ -68,8 +68,7 @@ RelExpr SPARCV9::getRelExpr(RelType Type, const SymbolBody &S, case R_SPARC_NONE: return R_NONE; default: - error(toString(&File) + ": unknown relocation type: " + toString(Type)); - return R_HINT; + return R_INVALID; } } diff --git a/lld/ELF/Arch/X86.cpp b/lld/ELF/Arch/X86.cpp index 42246f94791..40a8995bb4f 100644 --- a/lld/ELF/Arch/X86.cpp +++ b/lld/ELF/Arch/X86.cpp @@ -24,7 +24,7 @@ namespace { class X86 final : public TargetInfo { public: X86(); - RelExpr getRelExpr(RelType Type, const SymbolBody &S, const InputFile &File, + RelExpr getRelExpr(RelType Type, const SymbolBody &S, const uint8_t *Loc) const override; int64_t getImplicitAddend(const uint8_t *Buf, RelType Type) const override; void writeGotPltHeader(uint8_t *Buf) const override; @@ -63,8 +63,10 @@ X86::X86() { TrapInstr = 0xcccccccc; // 0xcc = INT3 } +static bool hasBaseReg(uint8_t ModRM) { return (ModRM & 0xc7) != 0x5; } + RelExpr X86::getRelExpr(RelType Type, const SymbolBody &S, - const InputFile &File, const uint8_t *Loc) const { + const uint8_t *Loc) const { switch (Type) { case R_386_8: case R_386_16: @@ -122,13 +124,7 @@ RelExpr X86::getRelExpr(RelType Type, const SymbolBody &S, // instruction. That means a ModRM byte is at Loc[-1]. By taking a look at // the byte, we can determine whether the instruction is register-relative // (i.e. it was generated for foo@GOT(%reg)) or absolute (i.e. foo@GOT). - if ((Loc[-1] & 0xc7) != 0x5) - return R_GOT_FROM_END; - if (Config->Pic) - error(toString(&File) + ": relocation " + toString(Type) + " against '" + - S.getName() + - "' without base register can not be used when PIC enabled"); - return R_GOT; + return hasBaseReg(Loc[-1]) ? R_GOT_FROM_END : R_GOT; case R_386_TLS_GOTIE: return R_GOT_FROM_END; case R_386_GOTOFF: @@ -140,8 +136,7 @@ RelExpr X86::getRelExpr(RelType Type, const SymbolBody &S, case R_386_NONE: return R_NONE; default: - error(toString(&File) + ": unknown relocation type: " + toString(Type)); - return R_HINT; + return R_INVALID; } } @@ -234,8 +229,6 @@ void X86::writePlt(uint8_t *Buf, uint64_t GotPltEntryAddr, int64_t X86::getImplicitAddend(const uint8_t *Buf, RelType Type) const { switch (Type) { - default: - return 0; case R_386_8: case R_386_PC8: return SignExtend64<8>(*Buf); @@ -252,6 +245,8 @@ int64_t X86::getImplicitAddend(const uint8_t *Buf, RelType Type) const { case R_386_TLS_LDO_32: case R_386_TLS_LE: return SignExtend64<32>(read32le(Buf)); + default: + return 0; } } @@ -286,9 +281,27 @@ void X86::relocateOne(uint8_t *Loc, RelType Type, uint64_t Val) const { checkInt<17>(Loc, Val, Type); write16le(Loc, Val); break; - default: + case R_386_32: + case R_386_GLOB_DAT: + case R_386_GOT32: + case R_386_GOT32X: + case R_386_GOTOFF: + case R_386_GOTPC: + case R_386_PC32: + case R_386_PLT32: + case R_386_RELATIVE: + case R_386_TLS_GD: + case R_386_TLS_GOTIE: + case R_386_TLS_IE: + case R_386_TLS_LDM: + case R_386_TLS_LDO_32: + case R_386_TLS_LE: + case R_386_TLS_LE_32: checkInt<32>(Loc, Val, Type); write32le(Loc, Val); + break; + default: + error(getErrorLocation(Loc) + "unrecognized reloc " + Twine(Type)); } } diff --git a/lld/ELF/Arch/X86_64.cpp b/lld/ELF/Arch/X86_64.cpp index e3d725f50a2..c244d7545b8 100644 --- a/lld/ELF/Arch/X86_64.cpp +++ b/lld/ELF/Arch/X86_64.cpp @@ -26,7 +26,7 @@ namespace { template <class ELFT> class X86_64 final : public TargetInfo { public: X86_64(); - RelExpr getRelExpr(RelType Type, const SymbolBody &S, const InputFile &File, + RelExpr getRelExpr(RelType Type, const SymbolBody &S, const uint8_t *Loc) const override; bool isPicRel(RelType Type) const override; void writeGotPltHeader(uint8_t *Buf) const override; @@ -74,7 +74,6 @@ template <class ELFT> X86_64<ELFT>::X86_64() { template <class ELFT> RelExpr X86_64<ELFT>::getRelExpr(RelType Type, const SymbolBody &S, - const InputFile &File, const uint8_t *Loc) const { switch (Type) { case R_X86_64_8: @@ -110,8 +109,7 @@ RelExpr X86_64<ELFT>::getRelExpr(RelType Type, const SymbolBody &S, case R_X86_64_NONE: return R_NONE; default: - error(toString(&File) + ": unknown relocation type: " + toString(Type)); - return R_HINT; + return R_INVALID; } } @@ -323,7 +321,7 @@ void X86_64<ELFT>::relocateOne(uint8_t *Loc, RelType Type, uint64_t Val) const { write64le(Loc, Val); break; default: - llvm_unreachable("unexpected relocation"); + error(getErrorLocation(Loc) + "unrecognized reloc " + Twine(Type)); } } diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index 0f69730cef8..a7bf005d0cf 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -488,6 +488,8 @@ static uint64_t getARMStaticBase(const SymbolBody &Body) { static uint64_t getRelocTargetVA(RelType Type, int64_t A, uint64_t P, const SymbolBody &Body, RelExpr Expr) { switch (Expr) { + case R_INVALID: + return 0; case R_ABS: case R_RELAX_GOT_PC_NOPIC: return Body.getVA(A); @@ -661,7 +663,7 @@ void InputSection::relocateNonAlloc(uint8_t *Buf, ArrayRef<RelTy> Rels) { Addend += Target->getImplicitAddend(BufLoc, Type); SymbolBody &Sym = this->getFile<ELFT>()->getRelocTargetSym(Rel); - RelExpr Expr = Target->getRelExpr(Type, Sym, *File, BufLoc); + RelExpr Expr = Target->getRelExpr(Type, Sym, BufLoc); if (Expr == R_NONE) continue; if (Expr != R_ABS) { diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp index 795dfeefdc9..908f5b0427a 100644 --- a/lld/ELF/Relocations.cpp +++ b/lld/ELF/Relocations.cpp @@ -864,8 +864,8 @@ static void scanRelocs(InputSectionBase &Sec, ArrayRef<RelTy> Rels) { continue; } - RelExpr Expr = Target->getRelExpr(Type, Body, *Sec.File, - Sec.Data.begin() + Rel.r_offset); + RelExpr Expr = + Target->getRelExpr(Type, Body, Sec.Data.begin() + Rel.r_offset); // Ignore "hint" relocations because they are only markers for relaxation. if (isRelExprOneOf<R_HINT, R_NONE>(Expr)) diff --git a/lld/ELF/Relocations.h b/lld/ELF/Relocations.h index 60dbebe4b2f..5548a5583b1 100644 --- a/lld/ELF/Relocations.h +++ b/lld/ELF/Relocations.h @@ -30,6 +30,7 @@ typedef uint32_t RelType; // from files are converted to these types so that the main code // doesn't have to know about architecture-specific details. enum RelExpr { + R_INVALID, R_ABS, R_ARM_SBREL, R_GOT, diff --git a/lld/ELF/Target.h b/lld/ELF/Target.h index 43ff8c30bbc..957af6ae4aa 100644 --- a/lld/ELF/Target.h +++ b/lld/ELF/Target.h @@ -57,7 +57,6 @@ public: virtual bool inBranchRange(RelType Type, uint64_t Src, uint64_t Dst) const; virtual RelExpr getRelExpr(RelType Type, const SymbolBody &S, - const InputFile &File, const uint8_t *Loc) const = 0; virtual void relocateOne(uint8_t *Loc, RelType Type, uint64_t Val) const = 0; diff --git a/lld/test/ELF/got32-i386.s b/lld/test/ELF/got32-i386.s index 468aaf1f0d5..00c7c0d6d55 100644 --- a/lld/test/ELF/got32-i386.s +++ b/lld/test/ELF/got32-i386.s @@ -20,4 +20,4 @@ _start: # CHECK: .got 00000004 0000000000012000 # RUN: not ld.lld %t.o -o %t -pie 2>&1 | FileCheck %s --check-prefix=ERR -# ERR: relocation R_386_GOT32 against 'foo' without base register can not be used when PIC enabled +# ERR: error: can't create dynamic relocation R_386_GOT32 against symbol: foo in readonly segment; recompile object files with -fPIC diff --git a/lld/test/ELF/got32x-i386.s b/lld/test/ELF/got32x-i386.s index 9a67d1997f2..1311472cc06 100644 --- a/lld/test/ELF/got32x-i386.s +++ b/lld/test/ELF/got32x-i386.s @@ -43,5 +43,5 @@ # RUN: not ld.lld %S/Inputs/i386-got32x-baseless.elf -o %t1 -pie 2>&1 | \ # RUN: FileCheck %s --check-prefix=ERR -# ERR: relocation R_386_GOT32X against 'foo' without base register can not be used when PIC enabled -# ERR: relocation R_386_GOT32X against 'foo' without base register can not be used when PIC enabled +# ERR: error: can't create dynamic relocation R_386_GOT32X against symbol: foo in readonly segment; recompile object files with -fPIC +# ERR: error: can't create dynamic relocation R_386_GOT32X against symbol: foo in readonly segment; recompile object files with -fPIC diff --git a/lld/test/ELF/invalid/invalid-debug-relocations.test b/lld/test/ELF/invalid/invalid-debug-relocations.test index bd13db76f35..9c86b674309 100644 --- a/lld/test/ELF/invalid/invalid-debug-relocations.test +++ b/lld/test/ELF/invalid/invalid-debug-relocations.test @@ -2,7 +2,7 @@ # RUN: yaml2obj %s -o %t.o # RUN: not ld.lld -gdb-index %t.o -o %t.exe 2>&1 | FileCheck %s -# CHECK: error: {{.*}}invalid-debug-relocations.test.tmp.o: unknown relocation type: Unknown (255) +# CHECK: error: {{.*}}invalid-debug-relocations.test.tmp.o:(.debug_info+0x0): has non-ABS relocation Unknown (255) against symbol '_start' !ELF FileHeader: diff --git a/lld/test/ELF/invalid/invalid-relocation-x64.test b/lld/test/ELF/invalid/invalid-relocation-x64.test index c93920bd3e1..a9b31641569 100644 --- a/lld/test/ELF/invalid/invalid-relocation-x64.test +++ b/lld/test/ELF/invalid/invalid-relocation-x64.test @@ -3,8 +3,8 @@ # RUN: echo ".global foo; foo:" > %t2.s # RUN: llvm-mc %t2.s -o %t2.o -filetype=obj -triple x86_64-pc-linux # RUN: not ld.lld %t1.o %t2.o -o /dev/null 2>&1 | FileCheck %s -# CHECK: {{.*}}1.o: unknown relocation type: Unknown (152) -# CHECK: {{.*}}1.o: unknown relocation type: Unknown (153) +# CHECK: error: unrecognized reloc 152 +# CHECK: error: unrecognized reloc 153 !ELF FileHeader: |