[llvm-commits] LLD Add x86 relocation reference code
Shankar Easwaran
shankare at codeaurora.org
Mon Oct 22 09:49:34 PDT 2012
Hi Sid,
On 10/19/2012 5:15 PM, Sid Manning wrote:
>
> This attached change does the following:
> * Moves x86 content from ReferenceKinds.cpp to a new file,
> x86Reference.cpp
> * Adds support for R_386_32 and R_386_PC32 relocs
> * Includes simple testcase
>
>
+void KindHandler_x86::applyFixup(int32_t reloc, uint64_t addend,
+ uint8_t *location, uint64_t fixupAddress,
+ uint64_t targetAddress) {
+ int error;
+ if (_fixupHandler[reloc])
+ {
+ error = (*_fixupHandler[reloc])(location,
+ fixupAddress, targetAddress, addend);
+ }
+}
I think the else part of the code needs to have a call to llvm_unreachable
+StringRef KindHandler_x86::kindToString(Reference::Kind kind) {
+ switch ((int32_t)kind) {
+ case llvm::ELF::R_386_32:
+ return "R_386_32";
+ case llvm::ELF::R_386_PC32:
+ return "R_386_PC32";
+ default:
+ return "none";
+ }
+}
+
Should the default case return string "unknown" ?
Thanks
Shankar Easwaran
Qualcomm Innovation Center.
More information about the llvm-commits
mailing list