aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-dwarfutil
diff options
context:
space:
mode:
authorAlexey Lapshin <a.v.lapshin@mail.ru>2023-02-02 17:17:52 +0100
committerAlexey Lapshin <a.v.lapshin@mail.ru>2023-02-13 12:25:22 +0100
commit4c273cd071150912fd6f1e4aee12148cf78a6410 (patch)
treec2deb6b00e2a7ce3083e274d28c2369c13ac4aad /llvm/tools/llvm-dwarfutil
parent30f515a9101da65de3ca32306c9de80fb16c9f92 (diff)
downloadllvm-4c273cd071150912fd6f1e4aee12148cf78a6410.zip
llvm-4c273cd071150912fd6f1e4aee12148cf78a6410.tar.gz
llvm-4c273cd071150912fd6f1e4aee12148cf78a6410.tar.bz2
[DWARFLinker] Refactor cloneAddressAttribute().
As a preparation for implementing DWARFv5 address ranges generation, this patch refactors cloneAddressAttribute() method. It has special handling for addresses which can be relocated in some unrelated value, for applying relocations twice, for indexed addresses. Instead of all these special handlings this patch uses general handling: Read attribute value from InputDIE and apply PCOffset. Another thing is that current handling of DW_FORM_addrx misses the fact that relocations might be applied twice in some cases. This patch fixes this problem also. Differential Revision: https://reviews.llvm.org/D143269
Diffstat (limited to 'llvm/tools/llvm-dwarfutil')
-rw-r--r--llvm/tools/llvm-dwarfutil/DebugInfoLinker.cpp27
1 files changed, 1 insertions, 26 deletions
diff --git a/llvm/tools/llvm-dwarfutil/DebugInfoLinker.cpp b/llvm/tools/llvm-dwarfutil/DebugInfoLinker.cpp
index ef222f8..5d2352e 100644
--- a/llvm/tools/llvm-dwarfutil/DebugInfoLinker.cpp
+++ b/llvm/tools/llvm-dwarfutil/DebugInfoLinker.cpp
@@ -41,7 +41,7 @@ class ObjFileAddressMap : public AddressesMap {
public:
ObjFileAddressMap(DWARFContext &Context, const Options &Options,
object::ObjectFile &ObjFile)
- : Opts(Options), Context(Context) {
+ : Opts(Options) {
// Remember addresses of existing text sections.
for (const object::SectionRef &Sect : ObjFile.sections()) {
if (!Sect.isText())
@@ -138,30 +138,6 @@ public:
void clear() override { DWARFAddressRanges.clear(); }
- llvm::Expected<uint64_t> relocateIndexedAddr(uint64_t StartOffset,
- uint64_t EndOffset) override {
- // No relocations in linked binary. Return just address value.
-
- const char *AddrPtr =
- Context.getDWARFObj().getAddrSection().Data.data() + StartOffset;
- support::endianness Endianess =
- Context.getDWARFObj().isLittleEndian() ? support::little : support::big;
-
- assert(EndOffset > StartOffset);
- switch (EndOffset - StartOffset) {
- case 1:
- return *AddrPtr;
- case 2:
- return support::endian::read16(AddrPtr, Endianess);
- case 4:
- return support::endian::read32(AddrPtr, Endianess);
- case 8:
- return support::endian::read64(AddrPtr, Endianess);
- }
-
- llvm_unreachable("relocateIndexedAddr unhandled case!");
- }
-
protected:
// returns true if specified address range is inside address ranges
// of executable sections.
@@ -231,7 +207,6 @@ private:
RangesTy DWARFAddressRanges;
AddressRanges TextAddressRanges;
const Options &Opts;
- DWARFContext &Context;
};
static bool knownByDWARFUtil(StringRef SecName) {