diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:10:56 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:10:56 +0000 | 
| commit | 044eb2f6afba375a914ac9d8024f8f5142bb912e (patch) | |
| tree | 1475247dc9f9fe5be155ebd4c9069c75aadf8c20 /include/llvm/Object/RelocVisitor.h | |
| parent | eb70dddbd77e120e5d490bd8fbe7ff3f8fa81c6b (diff) | |
Notes
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 c358d3996435..2d0e938f06fd 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; | 
