forked from OSchip/llvm-project
[DWARF] - Add RelocAddrEntry for cleanup. NFCi.
Was mentioned as possible cleanup during review of D33184. llvm-svn: 303171
This commit is contained in:
parent
6f91112051
commit
41e656768d
|
@ -43,13 +43,6 @@ namespace llvm {
|
|||
class MemoryBuffer;
|
||||
class raw_ostream;
|
||||
|
||||
// In place of applying the relocations to the data we've read from disk we use
|
||||
// a separate mapping table to the side and checking that at locations in the
|
||||
// dwarf where we expect relocated values. This adds a bit of complexity to the
|
||||
// dwarf parsing/extraction at the benefit of not allocating memory for the
|
||||
// entire size of the debug info sections.
|
||||
typedef DenseMap<uint64_t, std::pair<uint8_t, int64_t>> RelocAddrMap;
|
||||
|
||||
/// Reads a value from data extractor and applies a relocation to the result if
|
||||
/// one exists for the given offset.
|
||||
uint64_t getRelocatedValue(const DataExtractor &Data, uint32_t Size,
|
||||
|
|
|
@ -16,7 +16,17 @@
|
|||
|
||||
namespace llvm {
|
||||
|
||||
typedef DenseMap<uint64_t, std::pair<uint8_t, int64_t>> RelocAddrMap;
|
||||
struct RelocAddrEntry {
|
||||
uint8_t Width;
|
||||
int64_t Value;
|
||||
};
|
||||
|
||||
// In place of applying the relocations to the data we've read from disk we use
|
||||
// a separate mapping table to the side and checking that at locations in the
|
||||
// dwarf where we expect relocated values. This adds a bit of complexity to the
|
||||
// dwarf parsing/extraction at the benefit of not allocating memory for the
|
||||
// entire size of the debug info sections.
|
||||
typedef DenseMap<uint64_t, RelocAddrEntry> RelocAddrMap;
|
||||
|
||||
} // end namespace llvm
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ uint64_t llvm::getRelocatedValue(const DataExtractor &Data, uint32_t Size,
|
|||
RelocAddrMap::const_iterator AI = Relocs->find(*Off);
|
||||
if (AI == Relocs->end())
|
||||
return Data.getUnsigned(Off, Size);
|
||||
return Data.getUnsigned(Off, Size) + AI->second.second;
|
||||
return Data.getUnsigned(Off, Size) + AI->second.Value;
|
||||
}
|
||||
|
||||
static void dumpAccelSection(raw_ostream &OS, StringRef Name,
|
||||
|
@ -1127,7 +1127,7 @@ DWARFContextInMemory::DWARFContextInMemory(const object::ObjectFile &Obj,
|
|||
<< " at " << format("%p", Address)
|
||||
<< " with width " << format("%d", R.Width)
|
||||
<< "\n");
|
||||
Map->insert(std::make_pair(Address, std::make_pair(R.Width, R.Value)));
|
||||
Map->insert({Address, {(uint8_t)R.Width, R.Value}});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue