[lld] r232363 - [Mips] Do not check the relocation type twice
Simon Atanasyan
simon at atanasyan.com
Mon Mar 16 02:14:40 PDT 2015
Author: atanasyan
Date: Mon Mar 16 04:14:40 2015
New Revision: 232363
URL: http://llvm.org/viewvc/llvm-project?rev=232363&view=rev
Log:
[Mips] Do not check the relocation type twice
No functional changes.
Modified:
lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp
Modified: lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp?rev=232363&r1=232362&r2=232363&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Mips/MipsRelocationPass.cpp Mon Mar 16 04:14:40 2015
@@ -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(cons
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) {
More information about the llvm-commits
mailing list