1 //===- 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"
11 #include "llvm/DebugInfo/DWARF/DWARFContext.h"
12 
13 using namespace llvm;
14 
15 uint64_t DWARFDataExtractor::getRelocatedValue(uint32_t Size, uint32_t *Off,
16                                                uint64_t *SecNdx) const {
17   if (!Section)
18     return getUnsigned(Off, Size);
19   Optional<RelocAddrEntry> Rel = Obj->find(*Section, *Off);
20   if (!Rel)
21     return getUnsigned(Off, Size);
22   if (SecNdx)
23     *SecNdx = Rel->SectionIndex;
24   return getUnsigned(Off, Size) + Rel->Value;
25 }
26