blob: a40635568cdddcb1695ee52c9de335907669ecee [file] [log] [blame]
Paul Robinson17536b92017-06-29 16:52:08 +00001//===- DWARFDataExtractor.cpp ---------------------------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h"
Rafael Espindolac398e672017-07-19 22:27:28 +000011#include "llvm/DebugInfo/DWARF/DWARFContext.h"
Paul Robinson17536b92017-06-29 16:52:08 +000012
13using namespace llvm;
14
15uint64_t DWARFDataExtractor::getRelocatedValue(uint32_t Size, uint32_t *Off,
16 uint64_t *SecNdx) const {
Rafael Espindolac398e672017-07-19 22:27:28 +000017 if (!Section)
Paul Robinson17536b92017-06-29 16:52:08 +000018 return getUnsigned(Off, Size);
Rafael Espindolac398e672017-07-19 22:27:28 +000019 Optional<RelocAddrEntry> Rel = Obj->find(*Section, *Off);
20 if (!Rel)
Paul Robinson17536b92017-06-29 16:52:08 +000021 return getUnsigned(Off, Size);
22 if (SecNdx)
Rafael Espindolac398e672017-07-19 22:27:28 +000023 *SecNdx = Rel->SectionIndex;
24 return getUnsigned(Off, Size) + Rel->Value;
Paul Robinson17536b92017-06-29 16:52:08 +000025}