From a1abb2e2c7fd1e92b984d381128971a7733d8a2e Mon Sep 17 00:00:00 2001 From: Simon Atanasyan Date: Mon, 16 Mar 2015 09:14:40 +0000 Subject: [PATCH] [Mips] Do not check the relocation type twice No functional changes. llvm-svn: 232363 --- lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp b/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp index 5bd949d..606d904 100644 --- a/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp +++ b/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp @@ -730,6 +730,7 @@ template void RelocationPass::handle26(const MipsELFDefinedAtom &atom, Reference &ref) { bool isMicro = ref.kindValue() == R_MICROMIPS_26_S1; + assert((isMicro || ref.kindValue() == R_MIPS_26) && "Unexpected relocation"); const auto *sla = dyn_cast(ref.target()); if (sla && sla->type() == SharedLibraryAtom::Type::Code) @@ -738,17 +739,12 @@ void RelocationPass::handle26(const MipsELFDefinedAtom &atom, if (requireLA25Stub(ref.target())) ref.setTarget(getLA25Entry(ref.target(), isMicro)); - if (!isLocal(ref.target())) - switch (ref.kindValue()) { - case R_MIPS_26: - ref.setKindValue(LLD_R_MIPS_GLOBAL_26); - break; - case R_MICROMIPS_26_S1: + if (!isLocal(ref.target())) { + if (isMicro) ref.setKindValue(LLD_R_MICROMIPS_GLOBAL_26_S1); - break; - default: - llvm_unreachable("Unexpected relocation kind"); - } + else + ref.setKindValue(LLD_R_MIPS_GLOBAL_26); + } } template void RelocationPass::handleGOT(Reference &ref) { -- 2.7.4