[llvm-commits] [llvm] r173567 - Object/RelocVisitor: Add minimal support, R_MIPS_32, for mips.
NAKAMURA Takumi
geek4civic at gmail.com
Sat Jan 26 00:27:36 PST 2013
Author: chapuni
Date: Sat Jan 26 02:27:36 2013
New Revision: 173567
URL: http://llvm.org/viewvc/llvm-project?rev=173567&view=rev
Log:
Object/RelocVisitor: Add minimal support, R_MIPS_32, for mips.
It fixes llvm-dwarfdump for mips and mipsel.
Modified:
llvm/trunk/include/llvm/Object/ELF.h
llvm/trunk/include/llvm/Object/RelocVisitor.h
Modified: llvm/trunk/include/llvm/Object/ELF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ELF.h?rev=173567&r1=173566&r2=173567&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/ELF.h (original)
+++ llvm/trunk/include/llvm/Object/ELF.h Sat Jan 26 02:27:36 2013
@@ -2345,6 +2345,8 @@ StringRef ELFObjectFile<ELFT>::getFileFo
return "ELF32-arm";
case ELF::EM_HEXAGON:
return "ELF32-hexagon";
+ case ELF::EM_MIPS:
+ return "ELF32-mips";
default:
return "ELF32-unknown";
}
Modified: llvm/trunk/include/llvm/Object/RelocVisitor.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/RelocVisitor.h?rev=173567&r1=173566&r2=173567&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/RelocVisitor.h (original)
+++ llvm/trunk/include/llvm/Object/RelocVisitor.h Sat Jan 26 02:27:36 2013
@@ -84,6 +84,14 @@ public:
HasError = true;
return RelocToApply();
}
+ } else if (FileFormat == "ELF32-mips") {
+ switch (RelocType) {
+ case llvm::ELF::R_MIPS_32:
+ return visitELF_MIPS_32(R, Value);
+ default:
+ HasError = true;
+ return RelocToApply();
+ }
}
HasError = true;
return RelocToApply();
@@ -156,6 +164,14 @@ private:
uint32_t Res = (Value + Addend) & 0xFFFFFFFF;
return RelocToApply(Res, 4);
}
+
+ /// MIPS ELF
+ RelocToApply visitELF_MIPS_32(RelocationRef R, uint64_t Value) {
+ int64_t Addend;
+ R.getAdditionalInfo(Addend);
+ uint32_t Res = (Value + Addend) & 0xFFFFFFFF;
+ return RelocToApply(Res, 4);
+ }
};
}
More information about the llvm-commits
mailing list