summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Atanasyan <simon@atanasyan.com>2015-03-16 09:14:40 +0000
committerSimon Atanasyan <simon@atanasyan.com>2015-03-16 09:14:40 +0000
commita1abb2e2c7fd1e92b984d381128971a7733d8a2e (patch)
treebb5f506b41cf7787373f1152b72f95847b02cce9
parent622a4bc83b35d3147a71caa220191a23f37789b7 (diff)
downloadbcm5719-llvm-a1abb2e2c7fd1e92b984d381128971a7733d8a2e.tar.gz
bcm5719-llvm-a1abb2e2c7fd1e92b984d381128971a7733d8a2e.zip
[Mips] Do not check the relocation type twice
No functional changes. llvm-svn: 232363
-rw-r--r--lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp b/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp
index 5bd949d925f..606d90482a1 100644
--- a/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp
+++ b/lld/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp
@@ -730,6 +730,7 @@ template <typename ELFT>
void RelocationPass<ELFT>::handle26(const MipsELFDefinedAtom<ELFT> &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<SharedLibraryAtom>(ref.target());
if (sla && sla->type() == SharedLibraryAtom::Type::Code)
@@ -738,17 +739,12 @@ void RelocationPass<ELFT>::handle26(const MipsELFDefinedAtom<ELFT> &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 <typename ELFT> void RelocationPass<ELFT>::handleGOT(Reference &ref) {
OpenPOWER on IntegriCloud