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 (SecNdx) 18 *SecNdx = -1ULL; 19 if (!Section) 20 return getUnsigned(Off, Size); 21 Optional<RelocAddrEntry> Rel = Obj->find(*Section, *Off); 22 if (!Rel) 23 return getUnsigned(Off, Size); 24 if (SecNdx) 25 *SecNdx = Rel->SectionIndex; 26 return getUnsigned(Off, Size) + Rel->Value; 27 } 28