[llvm] [BOLT][DebugInfo] Add DWARF64 support for BOLT (PR #206437)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 29 02:36:09 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-bolt
Author: Thrrreeee (Thrrreeee)
<details>
<summary>Changes</summary>
BOLT currently assumes the DWARF32 format when it rewrites debug sections. As a result, rewriting a binary that was compiled with `-gdwarf64` either produces a corrupted output or fails `llvm-dwarfdump --verify`. This patch adds DWARF64 support to the BOLT DWARF rewriter, honoring each unit's DwarfFormat and emitting correct encodings DWARF64 for binaries, including mix DWARF32 and DWARF64.
---
Patch is 91.89 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/206437.diff
18 Files Affected:
- (modified) bolt/include/bolt/Core/DIEBuilder.h (+2-2)
- (modified) bolt/include/bolt/Core/DebugData.h (+30-17)
- (modified) bolt/include/bolt/Core/DebugNames.h (+4-3)
- (modified) bolt/lib/Core/BinaryContext.cpp (+1)
- (modified) bolt/lib/Core/DebugData.cpp (+94-57)
- (modified) bolt/lib/Core/DebugNames.cpp (+33-17)
- (modified) bolt/lib/Core/GDBIndex.cpp (+6-4)
- (modified) bolt/lib/Rewrite/DWARFRewriter.cpp (+42-18)
- (added) bolt/test/X86/dwarf64-debug-info-aranges.test (+46)
- (added) bolt/test/X86/dwarf64-debug-names.test (+111)
- (added) bolt/test/X86/dwarf64-loclists.test (+166)
- (added) bolt/test/X86/dwarf64-lowpc-highpc-convert.test (+143)
- (added) bolt/test/X86/dwarf64-ref-addr.test (+134)
- (added) bolt/test/X86/dwarf64-split-dwarf.test (+56)
- (added) bolt/test/X86/dwarf64-str-offsets.test (+144)
- (added) bolt/test/X86/mixed-dwarf32-dwarf64-debug-names.test (+173)
- (added) bolt/test/X86/mixed-dwarf32-dwarf64-rnglists.test (+241)
- (added) bolt/test/X86/mixed-dwarf32-dwarf64-str-offsets.test (+269)
``````````diff
diff --git a/bolt/include/bolt/Core/DIEBuilder.h b/bolt/include/bolt/Core/DIEBuilder.h
index 8fba755e154d5..a9ccd35c90298 100644
--- a/bolt/include/bolt/Core/DIEBuilder.h
+++ b/bolt/include/bolt/Core/DIEBuilder.h
@@ -56,8 +56,8 @@ class DIEBuilder {
std::vector<std::unique_ptr<DIEInfo>> DieInfoVector;
DIE *UnitDie = nullptr;
uint32_t UnitId = 0;
- uint32_t UnitOffset = 0;
- uint32_t UnitLength = 0;
+ uint64_t UnitOffset = 0;
+ uint64_t UnitLength = 0;
bool IsConstructed = false;
// A map of DIE offsets in original DWARF section to DIE ID.
// Which is used to access DieInfoVector.
diff --git a/bolt/include/bolt/Core/DebugData.h b/bolt/include/bolt/Core/DebugData.h
index 67a1c5c739c25..7462ec87068ea 100644
--- a/bolt/include/bolt/Core/DebugData.h
+++ b/bolt/include/bolt/Core/DebugData.h
@@ -64,15 +64,15 @@ std::optional<AttrInfo> findAttributeInfo(const DWARFDie DIE,
// DWARF5 Header in order of encoding.
// Types represent encoding sizes.
-using UnitLengthType = uint32_t;
+using UnitLengthType = uint64_t;
using VersionType = uint16_t;
using AddressSizeType = uint8_t;
using SegmentSelectorType = uint8_t;
using OffsetEntryCountType = uint32_t;
/// Get DWARF5 Header size.
/// Rangelists and Loclists have the same header.
-constexpr uint32_t getDWARF5RngListLocListHeaderSize() {
- return sizeof(UnitLengthType) + sizeof(VersionType) +
+inline uint32_t getDWARF5RngListLocListHeaderSize(dwarf::DwarfFormat Format) {
+ return dwarf::getUnitLengthFieldByteSize(Format) + sizeof(VersionType) +
sizeof(AddressSizeType) + sizeof(SegmentSelectorType) +
sizeof(OffsetEntryCountType);
}
@@ -150,10 +150,11 @@ using DebugBufferVector = SmallVector<char, 16>;
/// Map of old CU offset to new offset and length.
struct CUInfo {
- uint32_t Offset;
- uint32_t Length;
+ uint64_t Offset;
+ uint64_t Length;
+ dwarf::DwarfFormat Format;
};
-using CUOffsetMap = std::map<uint32_t, CUInfo>;
+using CUOffsetMap = std::map<uint64_t, CUInfo>;
enum class RangesWriterKind { DebugRangesWriter, DebugRangeListsWriter };
/// Serializes the .debug_ranges DWARF section.
@@ -269,9 +270,9 @@ class DebugRangeListsSectionWriter : public DebugRangesSectionWriter {
DWARFUnit *CU;
/// Current relative offset of range list entry within this CUs rangelist
/// body.
- uint32_t CurrentOffset{0};
+ uint64_t CurrentOffset{0};
/// Contains relative offset of each range list entry.
- SmallVector<uint32_t, 1> RangeEntries;
+ SmallVector<uint64_t, 1> RangeEntries;
std::unique_ptr<DebugBufferVector> CUBodyBuffer;
std::unique_ptr<raw_svector_ostream> CUBodyStream;
@@ -418,9 +419,10 @@ class DebugAddrWriterDwarf5 : public DebugAddrWriter {
DebugAddrWriterDwarf5() = delete;
DebugAddrWriterDwarf5(BinaryContext *BC) : DebugAddrWriter(BC) {}
DebugAddrWriterDwarf5(BinaryContext *BC, uint8_t AddressByteSize,
- std::optional<uint64_t> AddrOffsetSectionBase)
+ std::optional<uint64_t> AddrOffsetSectionBase,
+ dwarf::DwarfFormat Format)
: DebugAddrWriter(BC, AddressByteSize),
- AddrOffsetSectionBase(AddrOffsetSectionBase) {}
+ AddrOffsetSectionBase(AddrOffsetSectionBase), Format(Format) {}
/// Write out entries in to .debug_addr section for CUs.
virtual std::optional<uint64_t> finalize(const size_t BufferSize) override;
@@ -441,8 +443,12 @@ class DebugAddrWriterDwarf5 : public DebugAddrWriter {
}
private:
+ // TODO: This is a temporary solution.
+ uint32_t getHeaderSize() const {
+ return dwarf::getUnitLengthFieldByteSize(Format) + 4;
+ }
std::optional<uint64_t> AddrOffsetSectionBase = std::nullopt;
- static constexpr uint32_t HeaderSize = 8;
+ dwarf::DwarfFormat Format = dwarf::DwarfFormat::DWARF32;
};
/// This class is NOT thread safe.
@@ -455,7 +461,7 @@ class DebugStrOffsetsWriter {
}
/// Update Str offset in .debug_str in .debug_str_offsets.
- void updateAddressMap(uint32_t Index, uint32_t Address,
+ void updateAddressMap(uint32_t Index, uint64_t Address,
const DWARFUnit &Unit);
/// Get offset for given index in original .debug_str_offsets section.
@@ -493,10 +499,10 @@ class DebugStrOffsetsWriter {
private:
std::unique_ptr<DebugStrOffsetsBufferVector> StrOffsetsBuffer;
std::unique_ptr<raw_svector_ostream> StrOffsetsStream;
- std::map<uint32_t, uint32_t> IndexToAddressMap;
+ std::map<uint32_t, uint64_t> IndexToAddressMap;
[[maybe_unused]]
DenseSet<uint64_t> DebugStrOffsetFinalized;
- SmallVector<uint32_t, 5> StrOffsets;
+ SmallVector<uint64_t, 5> StrOffsets;
std::unordered_map<uint64_t, uint64_t> ProcessedBaseOffsets;
bool StrOffsetSectionWasModified = false;
BinaryContext &BC;
@@ -660,7 +666,7 @@ class DebugLoclistWriter : public DebugLocWriter {
// Used for DWARF5 to store location lists before being finalized.
std::unique_ptr<DebugBufferVector> LocBodyBuffer;
std::unique_ptr<raw_svector_ostream> LocBodyStream;
- std::vector<uint32_t> RelativeLocListOffsets;
+ std::vector<uint64_t> RelativeLocListOffsets;
uint32_t NumberOfEntries{0};
};
@@ -788,8 +794,9 @@ class DwarfLineTable {
/// Raw data representing complete debug line section for the unit.
StringRef RawData;
- /// DWARF Version
- uint16_t DwarfVersion;
+ /// DWARF version and format for this line table.
+ uint16_t DwarfVersion = 0;
+ dwarf::DwarfFormat Format = dwarf::DWARF32;
public:
/// Emit line info for all units in the binary context.
@@ -847,6 +854,12 @@ class DwarfLineTable {
// Returns DWARF Version for this line table.
uint16_t getDwarfVersion() const { return DwarfVersion; }
+
+ /// Sets DWARF format for this line table.
+ void setFormat(dwarf::DwarfFormat F) { Format = F; }
+
+ /// Returns DWARF format for this line table.
+ dwarf::DwarfFormat getFormat() const { return Format; }
};
/// ClusteredRows represents a collection of debug line table row references.
diff --git a/bolt/include/bolt/Core/DebugNames.h b/bolt/include/bolt/Core/DebugNames.h
index 297f004b2a45b..4213cfc7283b6 100644
--- a/bolt/include/bolt/Core/DebugNames.h
+++ b/bolt/include/bolt/Core/DebugNames.h
@@ -107,15 +107,15 @@ class DWARF5AcceleratorTable {
struct HashData {
uint64_t StrOffset;
uint32_t HashValue;
- uint32_t EntryOffset;
+ uint64_t EntryOffset;
std::vector<BOLTDWARF5AccelTableData *> Values;
};
using HashList = std::vector<HashData *>;
using BucketList = std::vector<HashList>;
/// Contains all the offsets of CUs.
- SmallVector<uint32_t, 1> CUList;
+ SmallVector<uint64_t, 1> CUList;
/// Contains all the offsets of local TUs.
- SmallVector<uint32_t, 1> LocalTUList;
+ SmallVector<uint64_t, 1> LocalTUList;
/// Contains all the type hashes for split dwarf TUs.
SmallVector<uint64_t, 1> ForeignTUList;
using StringEntries =
@@ -131,6 +131,7 @@ class DWARF5AcceleratorTable {
uint32_t BucketCount = 0;
uint32_t UniqueHashCount = 0;
uint32_t AbbrevTableSize = 0;
+ dwarf::DwarfFormat Format = dwarf::DwarfFormat::DWARF32;
uint32_t CUIndexEncodingSize = 4;
uint32_t TUIndexEncodingSize = 4;
uint32_t AugmentationStringSize = 0;
diff --git a/bolt/lib/Core/BinaryContext.cpp b/bolt/lib/Core/BinaryContext.cpp
index 43ce56ef083b5..07864b3d2d98b 100644
--- a/bolt/lib/Core/BinaryContext.cpp
+++ b/bolt/lib/Core/BinaryContext.cpp
@@ -1896,6 +1896,7 @@ void BinaryContext::preprocessDebugInfo() {
LineTable->Prologue.FileNames;
uint16_t DwarfVersion = LineTable->Prologue.getVersion();
+ BinaryLineTable.setFormat(LineTable->Prologue.getFormParams().Format);
if (DwarfVersion >= 5) {
std::optional<MD5::MD5Result> Checksum;
if (LineTable->Prologue.ContentTypes.HasMD5)
diff --git a/bolt/lib/Core/DebugData.cpp b/bolt/lib/Core/DebugData.cpp
index db51343908717..6a27d630cd0f6 100644
--- a/bolt/lib/Core/DebugData.cpp
+++ b/bolt/lib/Core/DebugData.cpp
@@ -189,6 +189,7 @@ uint64_t DebugRangeListsSectionWriter::addRanges(
}
struct LocListsRangelistsHeader {
+ dwarf::DwarfFormat Format;
UnitLengthType UnitLength; // Size of loclist entries section, not including
// size of header.
VersionType Version;
@@ -197,6 +198,16 @@ struct LocListsRangelistsHeader {
OffsetEntryCountType OffsetEntryCount;
};
+static void writeDwarfOffset(raw_ostream &OS, dwarf::DwarfFormat Format,
+ uint64_t Value,
+ endianness Endian = llvm::endianness::little) {
+ if (Format == dwarf::DwarfFormat::DWARF64) {
+ support::endian::write(OS, Value, Endian);
+ return;
+ }
+ support::endian::write(OS, static_cast<uint32_t>(Value), Endian);
+}
+
static std::unique_ptr<DebugBufferVector>
getDWARF5Header(const LocListsRangelistsHeader &Header) {
std::unique_ptr<DebugBufferVector> HeaderBuffer =
@@ -206,11 +217,14 @@ getDWARF5Header(const LocListsRangelistsHeader &Header) {
// 7.29 length of the set of entries for this compilation unit, not including
// the length field itself
- const uint32_t HeaderSize =
- getDWARF5RngListLocListHeaderSize() - sizeof(UnitLengthType);
+ const uint32_t HeaderSize = getDWARF5RngListLocListHeaderSize(Header.Format) -
+ dwarf::getUnitLengthFieldByteSize(Header.Format);
- support::endian::write(*HeaderStream, Header.UnitLength + HeaderSize,
- llvm::endianness::little);
+ if (Header.Format == dwarf::DwarfFormat::DWARF64)
+ support::endian::write(*HeaderStream, dwarf::DW_LENGTH_DWARF64,
+ llvm::endianness::little);
+ writeDwarfOffset(*HeaderStream, Header.Format,
+ Header.UnitLength + HeaderSize);
support::endian::write(*HeaderStream, Header.Version,
llvm::endianness::little);
support::endian::write(*HeaderStream, Header.AddressSize,
@@ -312,15 +326,15 @@ void DebugRangeListsSectionWriter::finalizeSection() {
std::make_unique<DebugBufferVector>();
std::unique_ptr<raw_svector_ostream> CUArrayStream =
std::make_unique<raw_svector_ostream>(*CUArrayBuffer);
- constexpr uint32_t SizeOfArrayEntry = 4;
- const uint32_t SizeOfArraySection = RangeEntries.size() * SizeOfArrayEntry;
- for (uint32_t Offset : RangeEntries)
- support::endian::write(*CUArrayStream, Offset + SizeOfArraySection,
- llvm::endianness::little);
-
- std::unique_ptr<DebugBufferVector> Header = getDWARF5Header(
- {static_cast<uint32_t>(SizeOfArraySection + CUBodyBuffer->size()), 5, 8,
- 0, static_cast<uint32_t>(RangeEntries.size())});
+ const dwarf::DwarfFormat Format = CU->getFormParams().Format;
+ const uint64_t SizeOfArraySection =
+ RangeEntries.size() * dwarf::getDwarfOffsetByteSize(Format);
+ for (uint64_t Offset : RangeEntries)
+ writeDwarfOffset(*CUArrayStream, Format, Offset + SizeOfArraySection);
+
+ std::unique_ptr<DebugBufferVector> Header =
+ getDWARF5Header({Format, SizeOfArraySection + CUBodyBuffer->size(), 5, 8,
+ 0, static_cast<uint32_t>(RangeEntries.size())});
*RangesStream << *Header;
*RangesStream << *CUArrayBuffer;
*RangesStream << *CUBodyBuffer;
@@ -349,27 +363,37 @@ void DebugARangesSectionWriter::writeARangesSection(
const uint64_t Offset = CUOffsetAddressRangesPair.first;
const DebugAddressRangesVector &AddressRanges =
CUOffsetAddressRangesPair.second;
+ assert(CUMap.count(Offset) && "Original CU offset is not found in CU Map");
+ const CUInfo &Info = CUMap.find(Offset)->second;
+ const dwarf::DwarfFormat Format = Info.Format;
+ const uint8_t DwarfOffsetByteSize = dwarf::getDwarfOffsetByteSize(Format);
// Emit header.
- // Size of this set: 8 (size of the header) + 4 (padding after header)
- // + 2*sizeof(uint64_t) bytes for each of the ranges, plus an extra
- // pair of uint64_t's for the terminating, zero-length range.
- // Does not include size field itself.
- uint32_t Size = 8 + 4 + 2 * sizeof(uint64_t) * (AddressRanges.size() + 1);
+ // Size of this set: header(8/16 bytes depending on the DWARF format),
+ // padding after header (4/8 bytes), and address/length pairs for each
+ // range, plus an extra pair of uint64_t's for the terminating, zero-length
+ // range. Does not include size field itself.
+
+ // Header size: version(2) + offset(4/8) + address size(1) + segment(1).
+ const uint64_t HeaderSize = sizeof(uint16_t) + DwarfOffsetByteSize +
+ sizeof(uint8_t) + sizeof(uint8_t);
+
+ const uint64_t Size = HeaderSize + DwarfOffsetByteSize +
+ 2 * sizeof(uint64_t) * (AddressRanges.size() + 1);
// Header field #1: set size.
- support::endian::write(RangesStream, Size, llvm::endianness::little);
+ if (Format == dwarf::DwarfFormat::DWARF64)
+ support::endian::write(RangesStream, dwarf::DW_LENGTH_DWARF64,
+ llvm::endianness::little);
+ writeDwarfOffset(RangesStream, Format, Size);
// Header field #2: version number, 2 as per the specification.
support::endian::write(RangesStream, static_cast<uint16_t>(2),
llvm::endianness::little);
- assert(CUMap.count(Offset) && "Original CU offset is not found in CU Map");
// Header field #3: debug info offset of the correspondent compile unit.
- support::endian::write(
- RangesStream, static_cast<uint32_t>(CUMap.find(Offset)->second.Offset),
- llvm::endianness::little);
+ writeDwarfOffset(RangesStream, Format, Info.Offset);
// Header field #4: address size.
// 8 since we only write ELF64 binaries for now.
@@ -378,9 +402,8 @@ void DebugARangesSectionWriter::writeARangesSection(
// Header field #5: segment size of target architecture.
RangesStream << char(0);
- // Padding before address table - 4 bytes in the 64-bit-pointer case.
- support::endian::write(RangesStream, static_cast<uint32_t>(0),
- llvm::endianness::little);
+ // Padding before address table - 4/8 bytes.
+ writeDwarfOffset(RangesStream, Format, 0);
writeAddressRanges(RangesStream, AddressRanges, true);
}
@@ -482,8 +505,9 @@ std::optional<uint64_t> DebugAddrWriter::finalize(const size_t BufferSize) {
void DebugAddrWriterDwarf5::updateAddrBase(DIEBuilder &DIEBlder, DWARFUnit &CU,
const uint64_t Offset) {
- /// Header for DWARF5 has size 8, so we add it to the offset.
- updateAddressBase(DIEBlder, *this, CU, Offset + HeaderSize);
+ /// Header for DWARF5 has size 8 bytes in DWARF32 or 16 bytes in DWARF64,
+ /// so we add it to the offset.
+ updateAddressBase(DIEBlder, *this, CU, Offset + getHeaderSize());
}
DenseMap<uint64_t, uint64_t> DebugAddrWriter::UnmodifiedAddressOffsets;
@@ -506,8 +530,7 @@ DebugAddrWriterDwarf5::finalize(const size_t BufferSize) {
if (!AddrOffsetSectionBase)
return std::nullopt;
// Address base offset is to the first entry.
- // The size of header is 8 bytes.
- uint64_t Offset = *AddrOffsetSectionBase - HeaderSize;
+ uint64_t Offset = *AddrOffsetSectionBase - getHeaderSize();
auto Iter = UnmodifiedAddressOffsets.find(Offset);
if (Iter != UnmodifiedAddressOffsets.end())
return Iter->second;
@@ -527,8 +550,10 @@ DebugAddrWriterDwarf5::finalize(const size_t BufferSize) {
// Sorting address in increasing order of indices.
llvm::sort(SortedMap, llvm::less_first());
// Writing out Header
- const uint32_t Length = SortedMap.size() * AddressByteSize + 4;
- support::endian::write(*AddressStream, Length, Endian);
+ const uint64_t Length = SortedMap.size() * AddressByteSize + 4;
+ if (Format == dwarf::DwarfFormat::DWARF64)
+ support::endian::write(*AddressStream, dwarf::DW_LENGTH_DWARF64, Endian);
+ writeDwarfOffset(*AddressStream, Format, Length, Endian);
support::endian::write(*AddressStream, static_cast<uint16_t>(5), Endian);
support::endian::write(*AddressStream, static_cast<uint8_t>(AddressByteSize),
Endian);
@@ -677,7 +702,7 @@ static void writeDWARF5LocList(uint32_t &NumberOfEntries, DIEValue &AttrInfo,
DebugLocationsVector &LocList, DIE &Die,
DIEBuilder &DIEBldr, DebugAddrWriter &AddrWriter,
DebugBufferVector &LocBodyBuffer,
- std::vector<uint32_t> &RelativeLocListOffsets,
+ std::vector<uint64_t> &RelativeLocListOffsets,
DWARFUnit &CU,
raw_svector_ostream &LocBodyStream) {
@@ -742,7 +767,8 @@ void DebugLoclistWriter::finalizeDWARF5(DIEBuilder &DIEBldr, DIE &Die) {
if (!isSplitDwarf() && LocListBaseAttrInfo.getType())
DIEBldr.replaceValue(&Die, dwarf::DW_AT_loclists_base,
LocListBaseAttrInfo.getForm(),
- DIEInteger(getDWARF5RngListLocListHeaderSize()));
+ DIEInteger(getDWARF5RngListLocListHeaderSize(
+ CU.getFormParams().Format)));
return;
}
@@ -751,23 +777,23 @@ void DebugLoclistWriter::finalizeDWARF5(DIEBuilder &DIEBldr, DIE &Die) {
std::unique_ptr<raw_svector_ostream> LocArrayStream =
std::make_unique<raw_svector_ostream>(*LocArrayBuffer);
- const uint32_t SizeOfArraySection = NumberOfEntries * sizeof(uint32_t);
+ const dwarf::DwarfFormat Format = CU.getFormParams().Format;
+ const uint64_t SizeOfArraySection =
+ NumberOfEntries * dwarf::getDwarfOffsetByteSize(Format);
// Write out IndexArray
- for (uint32_t RelativeOffset : RelativeLocListOffsets)
- support::endian::write(
- *LocArrayStream,
- static_cast<uint32_t>(SizeOfArraySection + RelativeOffset),
- llvm::endianness::little);
+ for (uint64_t RelativeOffset : RelativeLocListOffsets)
+ writeDwarfOffset(*LocArrayStream, Format,
+ SizeOfArraySection + RelativeOffset);
- std::unique_ptr<DebugBufferVector> Header = getDWARF5Header(
- {static_cast<uint32_t>(SizeOfArraySection + LocBodyBuffer->size()), 5, 8,
- 0, NumberOfEntries});
+ std::unique_ptr<DebugBufferVector> Header =
+ getDWARF5Header({Format, SizeOfArraySection + LocBodyBuffer->size(), 5, 8,
+ 0, NumberOfEntries});
*LocStream << *Header;
*LocStream << *LocArrayBuffer;
*LocStream << *LocBodyBuffer;
if (!isSplitDwarf()) {
- const uint64_t LocalBase = getDWARF5RngListLocListHeaderSize();
+ const uint64_t LocalBase = getDWARF5RngListLocListHeaderSize(Format);
DIEValue LocListBaseAttrInfo =
Die.findAttribute(dwarf::DW_AT_loclists_base);
if (LocListBaseAttrInfo.getType()) {
@@ -855,15 +881,20 @@ void DebugStrOffsetsWriter::initialize(DWARFUnit &Unit) {
if (!Contr)
return;
const uint8_t DwarfOffsetByteSize = Contr->getDwarfOffsetByteSize();
- assert(DwarfOffsetByteSize == 4 &&
- "Dwarf String Offsets Byte Size is not supported.");
- StrOffsets.reserve(Contr->Size);
- for (uint64_t Offset = 0; Offset < Contr->Size; Offset += DwarfOffsetByteSize)
- StrOffsets.push_back(support::endian::read32le(
- StrOffsetsSection.Data.data() + Contr->Base + Offset));
+ StrOffsets.reserve(Contr->Size / DwarfOffsetByteSize);
+ for (uint64_t Offset = 0; Offset < Contr->Size;
+ Offset += DwarfOffsetByteSize) {
+ uint64_t Value =
+ DwarfOffsetByteSize == 4
+ ? support::endian::read32le(StrOffsetsSection.Data.data() +
+ Contr->Base + Offset)
+ : support::endian::read64le(StrOffsetsSection.Data.data() +
+ Contr->Base + Offset);
+ StrOffsets.push_back(Value);
+ }
}
-void DebugStrOffsetsWriter::updateAddressMap(uint32_t Index, uint32_t Address,
+void DebugStrOffsetsWriter::updateAddressMap(uint32_t Index, uint64_t Address,
const DWARFUnit &Unit) {
assert(DebugStrOffsetFinalized.count(Unit.getOffset()) == 0 &&
"Cannot update address map since debug_str_offsets was already "
@@ -897,10 +928,14 @@ void DebugStrOffsetsWriter::finalizeSection(DWARFUnit &Unit,
// Update String Off...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/206437
More information about the llvm-commits
mailing list