diff options
Diffstat (limited to 'include/llvm/Object/RelocVisitor.h')
-rw-r--r-- | include/llvm/Object/RelocVisitor.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/include/llvm/Object/RelocVisitor.h b/include/llvm/Object/RelocVisitor.h index c358d39964352..2d0e938f06fdc 100644 --- a/include/llvm/Object/RelocVisitor.h +++ b/include/llvm/Object/RelocVisitor.h @@ -25,7 +25,6 @@ #include "llvm/Object/ObjectFile.h" #include "llvm/Support/Casting.h" #include "llvm/Support/ErrorHandling.h" -#include "llvm/Support/ErrorOr.h" #include <cstdint> #include <system_error> @@ -115,9 +114,10 @@ private: } int64_t getELFAddend(RelocationRef R) { - ErrorOr<int64_t> AddendOrErr = ELFRelocationRef(R).getAddend(); - if (std::error_code EC = AddendOrErr.getError()) - report_fatal_error(EC.message()); + Expected<int64_t> AddendOrErr = ELFRelocationRef(R).getAddend(); + handleAllErrors(AddendOrErr.takeError(), [](const ErrorInfoBase &EI) { + report_fatal_error(EI.message()); + }); return *AddendOrErr; } @@ -169,6 +169,8 @@ private: return (Value + getELFAddend(R)) & 0xFFFFFFFF; case ELF::R_MIPS_64: return Value + getELFAddend(R); + case ELF::R_MIPS_TLS_DTPREL64: + return Value + getELFAddend(R) - 0x8000; } HasError = true; return 0; @@ -260,8 +262,11 @@ private: } uint64_t visitMips32(uint32_t Rel, RelocationRef R, uint64_t Value) { + // FIXME: Take in account implicit addends to get correct results. if (Rel == ELF::R_MIPS_32) return Value & 0xFFFFFFFF; + if (Rel == ELF::R_MIPS_TLS_DTPREL32) + return Value & 0xFFFFFFFF; HasError = true; return 0; } @@ -297,6 +302,8 @@ private: return Value; } break; + default: + break; } HasError = true; return 0; |