llvm.org GIT mirror llvm / 3802947
Object/RelocVisitor: Add minimal support, R_MIPS_32, for mips. It fixes llvm-dwarfdump for mips and mipsel. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173567 91177308-0d34-0410-b5e6-96231b3b80d8 NAKAMURA Takumi 7 years ago
2 changed file(s) with 18 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
23442344 return "ELF32-arm";
23452345 case ELF::EM_HEXAGON:
23462346 return "ELF32-hexagon";
2347 case ELF::EM_MIPS:
2348 return "ELF32-mips";
23472349 default:
23482350 return "ELF32-unknown";
23492351 }
8383 HasError = true;
8484 return RelocToApply();
8585 }
86 } else if (FileFormat == "ELF32-mips") {
87 switch (RelocType) {
88 case llvm::ELF::R_MIPS_32:
89 return visitELF_MIPS_32(R, Value);
90 default:
91 HasError = true;
92 return RelocToApply();
93 }
8694 }
8795 HasError = true;
8896 return RelocToApply();
155163 uint32_t Res = (Value + Addend) & 0xFFFFFFFF;
156164 return RelocToApply(Res, 4);
157165 }
166
167 /// MIPS ELF
168 RelocToApply visitELF_MIPS_32(RelocationRef R, uint64_t Value) {
169 int64_t Addend;
170 R.getAdditionalInfo(Addend);
171 uint32_t Res = (Value + Addend) & 0xFFFFFFFF;
172 return RelocToApply(Res, 4);
173 }
158174 };
159175
160176 }