blob: 861dd313fb095d48a0e9cb38fcb1745dc7ef3e73 [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 {
George Rimar2f95c8b2017-09-04 10:30:39 +000017 if (SecNdx)
18 *SecNdx = -1ULL;
Rafael Espindolac398e672017-07-19 22:27:28 +000019 if (!Section)
Paul Robinson17536b92017-06-29 16:52:08 +000020 return getUnsigned(Off, Size);
Rafael Espindolac398e672017-07-19 22:27:28 +000021 Optional<RelocAddrEntry> Rel = Obj->find(*Section, *Off);
22 if (!Rel)
Paul Robinson17536b92017-06-29 16:52:08 +000023 return getUnsigned(Off, Size);
24 if (SecNdx)
Rafael Espindolac398e672017-07-19 22:27:28 +000025 *SecNdx = Rel->SectionIndex;
26 return getUnsigned(Off, Size) + Rel->Value;
Paul Robinson17536b92017-06-29 16:52:08 +000027}