[llvm] 53d40b9 - Emit a .debug_str_offsets section with dsymutil to
Shubham Sandeep Rastogi via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 14 09:49:27 PDT 2023
Author: Shubham Sandeep Rastogi
Date: 2023-08-14T09:43:47-07:00
New Revision: 53d40b973913f60caee2e21908a48bf865e5ba1c
URL: https://github.com/llvm/llvm-project/commit/53d40b973913f60caee2e21908a48bf865e5ba1c
DIFF: https://github.com/llvm/llvm-project/commit/53d40b973913f60caee2e21908a48bf865e5ba1c.diff
LOG: Emit a .debug_str_offsets section with dsymutil to
support DW_FORM_strx in dsymutil.
Differential Revision: https://reviews.llvm.org/D157036
Added:
llvm/test/tools/dsymutil/ARM/dwarf5-addr-base.test
llvm/test/tools/dsymutil/ARM/dwarf5-str-offsets-base-strx.test
llvm/test/tools/dsymutil/Inputs/DWARF5-addr-base-str-off-base/1.o
llvm/test/tools/dsymutil/Inputs/DWARF5-addr-base-str-off-base/2.o
llvm/test/tools/dsymutil/Inputs/DWARF5-addr-base-str-off-base/3.o
Modified:
llvm/include/llvm/DWARFLinker/DWARFLinker.h
llvm/include/llvm/DWARFLinker/DWARFStreamer.h
llvm/lib/DWARFLinker/DWARFLinker.cpp
llvm/lib/DWARFLinker/DWARFStreamer.cpp
llvm/test/tools/dsymutil/ARM/dwarf5-addrx-0x0-last.test
llvm/test/tools/dsymutil/ARM/dwarf5-dwarf4-combination-macho.test
llvm/test/tools/dsymutil/ARM/dwarf5-macho.test
llvm/test/tools/dsymutil/X86/dwarf5-addrbase-broken.test
llvm/test/tools/dsymutil/X86/dwarf5-addrx.test
llvm/test/tools/dsymutil/X86/dwarf5-loclists.test
llvm/test/tools/dsymutil/X86/op-convert-offset.test
llvm/test/tools/llvm-dwarfutil/ELF/X86/dwarf5-addresses.test
llvm/test/tools/llvm-dwarfutil/ELF/X86/dwarf5-rnglists.test
Removed:
llvm/test/tools/dsymutil/ARM/dwarf5-addr_base.test
llvm/test/tools/dsymutil/Inputs/DWARF5-addr_base/1.o
llvm/test/tools/dsymutil/Inputs/DWARF5-addr_base/2.o
llvm/test/tools/dsymutil/Inputs/DWARF5-addr_base/3.o
################################################################################
diff --git a/llvm/include/llvm/DWARFLinker/DWARFLinker.h b/llvm/include/llvm/DWARFLinker/DWARFLinker.h
index 1bbf318fda66cc..7a19858f426792 100644
--- a/llvm/include/llvm/DWARFLinker/DWARFLinker.h
+++ b/llvm/include/llvm/DWARFLinker/DWARFLinker.h
@@ -75,22 +75,22 @@ class AddressesMap {
using Offset2UnitMap = DenseMap<uint64_t, CompileUnit *>;
-struct DebugAddrPool {
- DenseMap<uint64_t, uint64_t> AddrIndexMap;
- SmallVector<uint64_t> Addrs;
-
- uint64_t getAddrIndex(uint64_t Addr) {
- DenseMap<uint64_t, uint64_t>::iterator It = AddrIndexMap.find(Addr);
- if (It == AddrIndexMap.end()) {
- It = AddrIndexMap.insert(std::make_pair(Addr, Addrs.size())).first;
- Addrs.push_back(Addr);
+struct DebugDieValuePool {
+ DenseMap<uint64_t, uint64_t> DieValueMap;
+ SmallVector<uint64_t> DieValues;
+
+ uint64_t getValueIndex(uint64_t Value) {
+ DenseMap<uint64_t, uint64_t>::iterator It = DieValueMap.find(Value);
+ if (It == DieValueMap.end()) {
+ It = DieValueMap.insert(std::make_pair(Value, DieValues.size())).first;
+ DieValues.push_back(Value);
}
return It->second;
}
void clear() {
- AddrIndexMap.clear();
- Addrs.clear();
+ DieValueMap.clear();
+ DieValues.clear();
}
};
@@ -113,6 +113,11 @@ class DwarfEmitter {
/// Emit the string table described by \p Pool into .debug_str table.
virtual void emitStrings(const NonRelocatableStringpool &Pool) = 0;
+ /// Emit the debug string offset table described by \p StringOffsets into the
+ /// .debug_str_offsets table.
+ virtual void emitStringOffsets(const SmallVector<uint64_t> &StringOffsets,
+ uint16_t TargetDWARFVersion) = 0;
+
/// Emit the string table described by \p Pool into .debug_line_str table.
virtual void emitLineStrings(const NonRelocatableStringpool &Pool) = 0;
@@ -142,7 +147,7 @@ class DwarfEmitter {
/// Emit debug ranges (.debug_ranges, .debug_rnglists) fragment.
virtual void emitDwarfDebugRangeListFragment(
const CompileUnit &Unit, const AddressRanges &LinkedRanges,
- PatchLocation Patch, DebugAddrPool &AddrPool) = 0;
+ PatchLocation Patch, DebugDieValuePool &AddrPool) = 0;
/// Emit debug ranges (.debug_ranges, .debug_rnglists) footer.
virtual void emitDwarfDebugRangeListFooter(const CompileUnit &Unit,
@@ -155,7 +160,7 @@ class DwarfEmitter {
virtual void emitDwarfDebugLocListFragment(
const CompileUnit &Unit,
const DWARFLocationExpressionsVector &LinkedLocationExpression,
- PatchLocation Patch, DebugAddrPool &AddrPool) = 0;
+ PatchLocation Patch, DebugDieValuePool &AddrPool) = 0;
/// Emit debug locations (.debug_loc, .debug_loclists) footer.
virtual void emitDwarfDebugLocListFooter(const CompileUnit &Unit,
@@ -607,6 +612,7 @@ class DWARFLinker {
DeclContextTree &ODRContexts,
OffsetsStringPool &DebugStrPool,
OffsetsStringPool &DebugLineStrPool,
+ DebugDieValuePool &StringOffsetPool,
unsigned Indent = 0);
unsigned shouldKeepDIE(AddressesMap &RelocMgr, const DWARFDie &DIE,
@@ -654,7 +660,8 @@ class DWARFLinker {
DWARFFile &ObjFile;
OffsetsStringPool &DebugStrPool;
OffsetsStringPool &DebugLineStrPool;
- DebugAddrPool AddrPool;
+ DebugDieValuePool &StringOffsetPool;
+ DebugDieValuePool AddrPool;
/// Allocator used for all the DIEValue objects.
BumpPtrAllocator &DIEAlloc;
@@ -672,10 +679,12 @@ class DWARFLinker {
BumpPtrAllocator &DIEAlloc,
std::vector<std::unique_ptr<CompileUnit>> &CompileUnits,
bool Update, OffsetsStringPool &DebugStrPool,
- OffsetsStringPool &DebugLineStrPool)
+ OffsetsStringPool &DebugLineStrPool,
+ DebugDieValuePool &StringOffsetPool)
: Linker(Linker), Emitter(Emitter), ObjFile(ObjFile),
DebugStrPool(DebugStrPool), DebugLineStrPool(DebugLineStrPool),
- DIEAlloc(DIEAlloc), CompileUnits(CompileUnits), Update(Update) {}
+ StringOffsetPool(StringOffsetPool), DIEAlloc(DIEAlloc),
+ CompileUnits(CompileUnits), Update(Update) {}
/// Recursively clone \p InputDIE into an tree of DIE objects
/// where useless (as decided by lookForDIEsToKeep()) bits have been
@@ -736,6 +745,9 @@ class DWARFLinker {
/// Is this DIE only a declaration?
bool IsDeclaration = false;
+ /// Is there a DW_AT_str_offsets_base in the CU?
+ bool AttrStrOffsetBaseSeen = false;
+
AttributesInfo() = default;
};
@@ -825,7 +837,7 @@ class DWARFLinker {
/// Compute and emit debug ranges(.debug_aranges, .debug_ranges,
/// .debug_rnglists) for \p Unit, patch the attributes referencing it.
void generateUnitRanges(CompileUnit &Unit, const DWARFFile &File,
- DebugAddrPool &AddrPool) const;
+ DebugDieValuePool &AddrPool) const;
/// Emit the accelerator entries for \p Unit.
void emitAcceleratorEntriesForUnit(CompileUnit &Unit);
diff --git a/llvm/include/llvm/DWARFLinker/DWARFStreamer.h b/llvm/include/llvm/DWARFLinker/DWARFStreamer.h
index 88c917e0190638..b95abfbefa1065 100644
--- a/llvm/include/llvm/DWARFLinker/DWARFStreamer.h
+++ b/llvm/include/llvm/DWARFLinker/DWARFStreamer.h
@@ -81,6 +81,11 @@ class DwarfStreamer : public DwarfEmitter {
/// Emit the string table described by \p Pool into .debug_str table.
void emitStrings(const NonRelocatableStringpool &Pool) override;
+ /// Emit the debug string offset table described by \p StringOffsets into the
+ /// .debug_str_offsets table.
+ void emitStringOffsets(const SmallVector<uint64_t> &StringOffset,
+ uint16_t TargetDWARFVersion) override;
+
/// Emit the string table described by \p Pool into .debug_line_str table.
void emitLineStrings(const NonRelocatableStringpool &Pool) override;
@@ -99,7 +104,7 @@ class DwarfStreamer : public DwarfEmitter {
void emitDwarfDebugRangeListFragment(const CompileUnit &Unit,
const AddressRanges &LinkedRanges,
PatchLocation Patch,
- DebugAddrPool &AddrPool) override;
+ DebugDieValuePool &AddrPool) override;
/// Emit debug ranges(.debug_ranges, .debug_rnglists) footer.
void emitDwarfDebugRangeListFooter(const CompileUnit &Unit,
@@ -123,7 +128,7 @@ class DwarfStreamer : public DwarfEmitter {
void emitDwarfDebugLocListFragment(
const CompileUnit &Unit,
const DWARFLocationExpressionsVector &LinkedLocationExpression,
- PatchLocation Patch, DebugAddrPool &AddrPool) override;
+ PatchLocation Patch, DebugDieValuePool &AddrPool) override;
/// Emit debug ranges(.debug_loc, .debug_loclists) footer.
void emitDwarfDebugLocListFooter(const CompileUnit &Unit,
@@ -222,7 +227,7 @@ class DwarfStreamer : public DwarfEmitter {
void emitDwarfDebugRngListsTableFragment(const CompileUnit &Unit,
const AddressRanges &LinkedRanges,
PatchLocation Patch,
- DebugAddrPool &AddrPool);
+ DebugDieValuePool &AddrPool);
/// Emit piece of .debug_loc for \p LinkedRanges.
void emitDwarfDebugLocTableFragment(
@@ -234,7 +239,7 @@ class DwarfStreamer : public DwarfEmitter {
void emitDwarfDebugLocListsTableFragment(
const CompileUnit &Unit,
const DWARFLocationExpressionsVector &LinkedLocationExpression,
- PatchLocation Patch, DebugAddrPool &AddrPool);
+ PatchLocation Patch, DebugDieValuePool &AddrPool);
/// \defgroup Line table emission
/// @{
@@ -293,6 +298,7 @@ class DwarfStreamer : public DwarfEmitter {
uint64_t MacInfoSectionSize = 0;
uint64_t MacroSectionSize = 0;
uint64_t AddrSectionSize = 0;
+ uint64_t StrOffsetSectionSize = 0;
/// Keep track of emitted CUs and their Unique ID.
struct EmittedUnit {
diff --git a/llvm/lib/DWARFLinker/DWARFLinker.cpp b/llvm/lib/DWARFLinker/DWARFLinker.cpp
index 968fba2ffea251..58c52534f05f45 100644
--- a/llvm/lib/DWARFLinker/DWARFLinker.cpp
+++ b/llvm/lib/DWARFLinker/DWARFLinker.cpp
@@ -1014,32 +1014,36 @@ void DWARFLinker::assignAbbrev(DIEAbbrev &Abbrev) {
unsigned DWARFLinker::DIECloner::cloneStringAttribute(DIE &Die,
AttributeSpec AttrSpec,
const DWARFFormValue &Val,
- const DWARFUnit &,
+ const DWARFUnit &U,
AttributesInfo &Info) {
std::optional<const char *> String = dwarf::toString(Val);
if (!String)
return 0;
-
DwarfStringPoolEntryRef StringEntry;
if (AttrSpec.Form == dwarf::DW_FORM_line_strp) {
StringEntry = DebugLineStrPool.getEntry(*String);
} else {
StringEntry = DebugStrPool.getEntry(*String);
-
// Update attributes info.
if (AttrSpec.Attr == dwarf::DW_AT_name)
Info.Name = StringEntry;
else if (AttrSpec.Attr == dwarf::DW_AT_MIPS_linkage_name ||
AttrSpec.Attr == dwarf::DW_AT_linkage_name)
Info.MangledName = StringEntry;
-
+ if (U.getVersion() >= 5) {
+ // Switch everything to DW_FORM_strx strings.
+ auto StringOffsetIndex =
+ StringOffsetPool.getValueIndex(StringEntry.getOffset());
+ return Die
+ .addValue(DIEAlloc, dwarf::Attribute(AttrSpec.Attr),
+ dwarf::DW_FORM_strx, DIEInteger(StringOffsetIndex))
+ ->sizeOf(U.getFormParams());
+ }
// Switch everything to out of line strings.
AttrSpec.Form = dwarf::DW_FORM_strp;
}
-
Die.addValue(DIEAlloc, dwarf::Attribute(AttrSpec.Attr), AttrSpec.Form,
DIEInteger(StringEntry.getOffset()));
-
return 4;
}
@@ -1359,7 +1363,7 @@ unsigned DWARFLinker::DIECloner::cloneAddressAttribute(
return Unit.getOrigUnit().getAddressByteSize();
}
- auto AddrIndex = AddrPool.getAddrIndex(*Addr);
+ auto AddrIndex = AddrPool.getValueIndex(*Addr);
return Die
.addValue(DIEAlloc, static_cast<dwarf::Attribute>(AttrSpec.Attr),
@@ -1391,6 +1395,17 @@ unsigned DWARFLinker::DIECloner::cloneScalarAttribute(
}
}
+ if (AttrSpec.Attr == dwarf::DW_AT_str_offsets_base) {
+ // DWARFLinker generates common .debug_str_offsets table used for all
+ // compile units. The offset to the common .debug_str_offsets table is 8 on
+ // DWARF32.
+ Info.AttrStrOffsetBaseSeen = true;
+ return Die
+ .addValue(DIEAlloc, dwarf::DW_AT_str_offsets_base,
+ dwarf::DW_FORM_sec_offset, DIEInteger(8))
+ ->sizeOf(Unit.getOrigUnit().getFormParams());
+ }
+
if (LLVM_UNLIKELY(Linker.Options.Update)) {
if (auto OptionalValue = Val.getAsUnsignedConstant())
Value = *OptionalValue;
@@ -1634,9 +1649,6 @@ shouldSkipAttribute(bool Update,
// Since DW_AT_rnglists_base is used for only DW_FORM_rnglistx the
// DW_AT_rnglists_base is removed.
return !Update;
- case dwarf::DW_AT_str_offsets_base:
- // FIXME: Use the string offset table with Dwarf 5.
- return true;
case dwarf::DW_AT_loclists_base:
// In case !Update the .debug_addr table is not generated/preserved.
// Thus instead of DW_FORM_loclistx the DW_FORM_sec_offset is used.
@@ -1803,6 +1815,14 @@ DIE *DWARFLinker::DIECloner::cloneDIE(const DWARFDie &InputDIE,
}
}
+ if (Unit.getOrigUnit().getVersion() >= 5 && !AttrInfo.AttrStrOffsetBaseSeen &&
+ Die->getTag() == dwarf::DW_TAG_compile_unit) {
+ // No DW_AT_str_offsets_base seen, add it to the DIE.
+ Die->addValue(DIEAlloc, dwarf::DW_AT_str_offsets_base,
+ dwarf::DW_FORM_sec_offset, DIEInteger(8));
+ OutOffset += 4;
+ }
+
DIEAbbrev NewAbbrev = Die->generateAbbrev();
if (HasChildren)
NewAbbrev.setChildrenFlag(dwarf::DW_CHILDREN_yes);
@@ -1839,7 +1859,7 @@ DIE *DWARFLinker::DIECloner::cloneDIE(const DWARFDie &InputDIE,
/// entries and emit them in the output file. Update the relevant attributes
/// to point at the new entries.
void DWARFLinker::generateUnitRanges(CompileUnit &Unit, const DWARFFile &File,
- DebugAddrPool &AddrPool) const {
+ DebugDieValuePool &AddrPool) const {
if (LLVM_UNLIKELY(Options.Update))
return;
@@ -1981,13 +2001,14 @@ void DWARFLinker::DIECloner::emitDebugAddrSection(
if (DwarfVersion < 5)
return;
- if (AddrPool.Addrs.empty())
+ if (AddrPool.DieValues.empty())
return;
MCSymbol *EndLabel = Emitter->emitDwarfDebugAddrsHeader(Unit);
patchAddrBase(*Unit.getOutputUnitDIE(),
DIEInteger(Emitter->getDebugAddrSectionSize()));
- Emitter->emitDwarfDebugAddrs(AddrPool.Addrs, Unit.getOrigUnit().getAddressByteSize());
+ Emitter->emitDwarfDebugAddrs(AddrPool.DieValues,
+ Unit.getOrigUnit().getAddressByteSize());
Emitter->emitDwarfDebugAddrsFooter(Unit, EndLabel);
}
@@ -2701,6 +2722,7 @@ Error DWARFLinker::link() {
// reproducibility.
OffsetsStringPool DebugStrPool(StringsTranslator, true);
OffsetsStringPool DebugLineStrPool(StringsTranslator, false);
+ DebugDieValuePool StringOffsetPool;
// ODR Contexts for the optimize.
DeclContextTree ODRContexts;
@@ -2767,7 +2789,7 @@ Error DWARFLinker::link() {
for (auto &CU : OptContext.ModuleUnits) {
if (Error Err = cloneModuleUnit(OptContext, CU, ODRContexts, DebugStrPool,
- DebugLineStrPool))
+ DebugLineStrPool, StringOffsetPool))
reportWarning(toString(std::move(Err)), CU.File);
}
}
@@ -2864,7 +2886,7 @@ Error DWARFLinker::link() {
SizeByObject[OptContext.File.FileName].Output =
DIECloner(*this, TheDwarfEmitter.get(), OptContext.File, DIEAlloc,
OptContext.CompileUnits, Options.Update, DebugStrPool,
- DebugLineStrPool)
+ DebugLineStrPool, StringOffsetPool)
.cloneAllCompileUnits(*OptContext.File.Dwarf, OptContext.File,
OptContext.File.Dwarf->isLittleEndian());
}
@@ -2881,6 +2903,8 @@ Error DWARFLinker::link() {
if (TheDwarfEmitter != nullptr) {
TheDwarfEmitter->emitAbbrevs(Abbreviations, Options.TargetDWARFVersion);
TheDwarfEmitter->emitStrings(DebugStrPool);
+ TheDwarfEmitter->emitStringOffsets(StringOffsetPool.DieValues,
+ Options.TargetDWARFVersion);
TheDwarfEmitter->emitLineStrings(DebugLineStrPool);
for (AccelTableKind TableKind : Options.AccelTables) {
switch (TableKind) {
@@ -2997,6 +3021,7 @@ Error DWARFLinker::cloneModuleUnit(LinkContext &Context, RefModuleUnit &Unit,
DeclContextTree &ODRContexts,
OffsetsStringPool &DebugStrPool,
OffsetsStringPool &DebugLineStrPool,
+ DebugDieValuePool &StringOffsetPool,
unsigned Indent) {
assert(Unit.Unit.get() != nullptr);
@@ -3023,7 +3048,7 @@ Error DWARFLinker::cloneModuleUnit(LinkContext &Context, RefModuleUnit &Unit,
CompileUnits.emplace_back(std::move(Unit.Unit));
assert(TheDwarfEmitter);
DIECloner(*this, TheDwarfEmitter.get(), Unit.File, DIEAlloc, CompileUnits,
- Options.Update, DebugStrPool, DebugLineStrPool)
+ Options.Update, DebugStrPool, DebugLineStrPool, StringOffsetPool)
.cloneAllCompileUnits(*Unit.File.Dwarf, Unit.File,
Unit.File.Dwarf->isLittleEndian());
return Error::success();
diff --git a/llvm/lib/DWARFLinker/DWARFStreamer.cpp b/llvm/lib/DWARFLinker/DWARFStreamer.cpp
index 3047e4cdc13eed..4d5eef54408edb 100644
--- a/llvm/lib/DWARFLinker/DWARFStreamer.cpp
+++ b/llvm/lib/DWARFLinker/DWARFStreamer.cpp
@@ -258,6 +258,39 @@ void DwarfStreamer::emitStrings(const NonRelocatableStringpool &Pool) {
}
}
+/// Emit the debug string offset table described by \p StringOffsets into the
+/// .debug_str_offsets table.
+void DwarfStreamer::emitStringOffsets(
+ const SmallVector<uint64_t> &StringOffsets, uint16_t TargetDWARFVersion) {
+
+ if (TargetDWARFVersion < 5 || StringOffsets.empty())
+ return;
+
+ Asm->OutStreamer->switchSection(MOFI->getDwarfStrOffSection());
+
+ MCSymbol *BeginLabel = Asm->createTempSymbol("Bdebugstroff");
+ MCSymbol *EndLabel = Asm->createTempSymbol("Edebugstroff");
+
+ // Length.
+ Asm->emitLabelDifference(EndLabel, BeginLabel, sizeof(uint32_t));
+ Asm->OutStreamer->emitLabel(BeginLabel);
+ StrOffsetSectionSize += sizeof(uint32_t);
+
+ // Version.
+ MS->emitInt16(5);
+ StrOffsetSectionSize += sizeof(uint16_t);
+
+ // Padding.
+ MS->emitInt16(0);
+ StrOffsetSectionSize += sizeof(uint16_t);
+
+ for (auto Off : StringOffsets) {
+ Asm->OutStreamer->emitInt32(Off);
+ StrOffsetSectionSize += sizeof(uint32_t);
+ }
+ Asm->OutStreamer->emitLabel(EndLabel);
+}
+
/// Emit the debug_line_str section stored in \p Pool.
void DwarfStreamer::emitLineStrings(const NonRelocatableStringpool &Pool) {
Asm->OutStreamer->switchSection(MOFI->getDwarfLineStrSection());
@@ -455,7 +488,7 @@ DwarfStreamer::emitDwarfDebugRangeListHeader(const CompileUnit &Unit) {
void DwarfStreamer::emitDwarfDebugRangeListFragment(
const CompileUnit &Unit, const AddressRanges &LinkedRanges,
- PatchLocation Patch, DebugAddrPool &AddrPool) {
+ PatchLocation Patch, DebugDieValuePool &AddrPool) {
if (Unit.getOrigUnit().getVersion() < 5) {
emitDwarfDebugRangesTableFragment(Unit, LinkedRanges, Patch);
return;
@@ -478,7 +511,7 @@ void DwarfStreamer::emitDwarfDebugRangeListFooter(const CompileUnit &Unit,
void DwarfStreamer::emitDwarfDebugRngListsTableFragment(
const CompileUnit &Unit, const AddressRanges &LinkedRanges,
- PatchLocation Patch, DebugAddrPool &AddrPool) {
+ PatchLocation Patch, DebugDieValuePool &AddrPool) {
Patch.set(RngListsSectionSize);
// Make .debug_rnglists to be current section.
@@ -494,7 +527,7 @@ void DwarfStreamer::emitDwarfDebugRngListsTableFragment(
MS->emitInt8(dwarf::DW_RLE_base_addressx);
RngListsSectionSize += 1;
RngListsSectionSize +=
- MS->emitULEB128IntValue(AddrPool.getAddrIndex(*BaseAddress));
+ MS->emitULEB128IntValue(AddrPool.getValueIndex(*BaseAddress));
}
// Emit type of entry.
@@ -554,7 +587,7 @@ MCSymbol *DwarfStreamer::emitDwarfDebugLocListHeader(const CompileUnit &Unit) {
void DwarfStreamer::emitDwarfDebugLocListFragment(
const CompileUnit &Unit,
const DWARFLocationExpressionsVector &LinkedLocationExpression,
- PatchLocation Patch, DebugAddrPool &AddrPool) {
+ PatchLocation Patch, DebugDieValuePool &AddrPool) {
if (Unit.getOrigUnit().getVersion() < 5) {
emitDwarfDebugLocTableFragment(Unit, LinkedLocationExpression, Patch);
return;
@@ -672,7 +705,7 @@ void DwarfStreamer::emitDwarfDebugAddrsFooter(const CompileUnit &Unit,
void DwarfStreamer::emitDwarfDebugLocListsTableFragment(
const CompileUnit &Unit,
const DWARFLocationExpressionsVector &LinkedLocationExpression,
- PatchLocation Patch, DebugAddrPool &AddrPool) {
+ PatchLocation Patch, DebugDieValuePool &AddrPool) {
Patch.set(LocListsSectionSize);
// Make .debug_loclists the current section.
@@ -691,7 +724,7 @@ void DwarfStreamer::emitDwarfDebugLocListsTableFragment(
MS->emitInt8(dwarf::DW_LLE_base_addressx);
LocListsSectionSize += 1;
LocListsSectionSize +=
- MS->emitULEB128IntValue(AddrPool.getAddrIndex(*BaseAddress));
+ MS->emitULEB128IntValue(AddrPool.getValueIndex(*BaseAddress));
}
// Emit type of entry.
diff --git a/llvm/test/tools/dsymutil/ARM/dwarf5-addr_base.test b/llvm/test/tools/dsymutil/ARM/dwarf5-addr-base.test
similarity index 72%
rename from llvm/test/tools/dsymutil/ARM/dwarf5-addr_base.test
rename to llvm/test/tools/dsymutil/ARM/dwarf5-addr-base.test
index fb6382971fa5d3..96973fe122c8c4 100644
--- a/llvm/test/tools/dsymutil/ARM/dwarf5-addr_base.test
+++ b/llvm/test/tools/dsymutil/ARM/dwarf5-addr-base.test
@@ -46,36 +46,36 @@
RUN: rm -rf %t.dir && mkdir -p %t.dir
-RUN: dsymutil -y %p/dummy-debug-map-amr64.map -oso-prepend-path=%p/../Inputs/DWARF5-addr_base -o %t.dir/dwarf5-addr_base.dSYM
-RUN: llvm-dwarfdump %t.dir/dwarf5-addr_base.dSYM -a --verbose | FileCheck %s
+RUN: dsymutil -y %p/dummy-debug-map-amr64.map -oso-prepend-path=%p/../Inputs/DWARF5-addr-base-str-off-base -o %t.dir/dwarf5-addr-base.dSYM
+RUN: llvm-dwarfdump %t.dir/dwarf5-addr-base.dSYM -a --verbose | FileCheck %s
-RUN: dsymutil --update -y %p/dummy-debug-map-amr64.map -oso-prepend-path=%p/../Inputs/DWARF5-addr_base -o %t.dir/dwarf5-addr_base.dSYM
-RUN: llvm-dwarfdump %t.dir/dwarf5-addr_base.dSYM -a --verbose | FileCheck %s --check-prefix=UPD
+RUN: dsymutil --update -y %p/dummy-debug-map-amr64.map -oso-prepend-path=%p/../Inputs/DWARF5-addr-base-str-off-base -o %t.dir/dwarf5-addr-base.dSYM
+RUN: llvm-dwarfdump %t.dir/dwarf5-addr-base.dSYM -a --verbose | FileCheck %s --check-prefix=UPD
CHECK: .debug_info contents:
-CHECK-NEXT: 0x00000000: Compile Unit: length = 0x00000061, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x00000065)
+CHECK-NEXT: 0x00000000: Compile Unit: length = 0x0000004a, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08
CHECK: 0x0000000c: DW_TAG_compile_unit [1] *
CHECK: DW_AT_addr_base [DW_FORM_sec_offset] (0x00000008)
-CHECK: 0x00000037: DW_TAG_subprogram [2] * (0x0000000c)
+CHECK: 0x0000002c: DW_TAG_subprogram [2] * (0x0000000c)
CHECK-NEXT: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x[[ADDR1:[0-9a-f]+]])
-CHECK: 0x00000065: Compile Unit: length = 0x00000061, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x000000ca)
+CHECK: 0x0000004e: Compile Unit: length = 0x0000004a, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08
-CHECK: 0x00000071: DW_TAG_compile_unit [1] *
+CHECK: 0x0000005a: DW_TAG_compile_unit [1] *
CHECK: DW_AT_addr_base [DW_FORM_sec_offset] (0x00000018)
-CHECK: 0x0000009c: DW_TAG_subprogram [2] * (0x00000071)
+CHECK: 0x0000007a: DW_TAG_subprogram [2] * (0x0000005a)
CHECK-NEXT: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x[[ADDR2:[0-9a-f]+]])
-CHECK: 0x000000ca: Compile Unit: length = 0x0000005a, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x00000128)
+CHECK: 0x0000009c: Compile Unit: length = 0x00000043, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08
-CHECK: 0x000000d6: DW_TAG_compile_unit [5] *
+CHECK: 0x000000a8: DW_TAG_compile_unit [5] *
CHECK: DW_AT_addr_base [DW_FORM_sec_offset] (0x00000028)
-CHECK: 0x000000fa: DW_TAG_subprogram [2] * (0x000000d6)
+CHECK: 0x000000c1: DW_TAG_subprogram [2] * (0x000000a8)
CHECK-NEXT: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x[[ADDR3:[0-9a-f]+]])
CHECK: .debug_addr contents:
@@ -93,44 +93,44 @@ CHECK-NEXT: 0x[[ADDR3]]
CHECK-NEXT: ]
UPD: .debug_info contents:
-UPD-NEXT: 0x00000000: Compile Unit: length = 0x000000aa, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x000000ae)
+UPD-NEXT: 0x00000000: Compile Unit: length = 0x00000081, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08
UPD: 0x0000000c: DW_TAG_compile_unit [1] *
UPD: DW_AT_addr_base [DW_FORM_sec_offset] (0x00000008)
-UPD: 0x0000003c: DW_TAG_subprogram [2] (0x0000000c)
+UPD: 0x00000031: DW_TAG_subprogram [2] (0x0000000c)
UPD-NEXT: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x0000000000000018)
-UPD: 0x0000004e: DW_TAG_subprogram [3] * (0x0000000c)
+UPD: 0x0000003d: DW_TAG_subprogram [3] * (0x0000000c)
UPD-NEXT: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000001) address = 0x0000000000000000)
-UPD: 0x00000071: DW_TAG_subprogram [3] * (0x0000000c)
+UPD: 0x00000057: DW_TAG_subprogram [3] * (0x0000000c)
UPD-NEXT: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000002) address = 0x0000000000000008)
-UPD: 0x00000094: DW_TAG_subprogram [5] (0x0000000c)
+UPD: 0x00000071: DW_TAG_subprogram [5] (0x0000000c)
UPD-NEXT: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000003) address = 0x0000000000000010)
-UPD: 0x000000ae: Compile Unit: length = 0x00000098, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x0000014a)
+UPD: 0x00000085: Compile Unit: length = 0x00000072, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08
-UPD: 0x000000ba: DW_TAG_compile_unit [1] *
+UPD: 0x00000091: DW_TAG_compile_unit [1] *
UPD: DW_AT_addr_base [DW_FORM_sec_offset] (0x00000008)
-UPD: 0x000000ea: DW_TAG_subprogram [2] (0x000000ba)
+UPD: 0x000000b6: DW_TAG_subprogram [2] (0x00000091)
UPD-NEXT: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x0000000000000018)
-UPD: 0x000000fc: DW_TAG_subprogram [3] * (0x000000ba)
+UPD: 0x000000c2: DW_TAG_subprogram [3] * (0x00000091)
UPD-NEXT: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000001) address = 0x0000000000000000)
-UPD: 0x0000011f: DW_TAG_subprogram [3] * (0x000000ba)
+UPD: 0x000000dc: DW_TAG_subprogram [3] * (0x00000091)
UPD-NEXT: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000002) address = 0x0000000000000008)
-UPD: 0x0000014a: Compile Unit: length = 0x0000005b, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x000001a9)
+UPD: 0x000000fb: Compile Unit: length = 0x00000044, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08
-UPD: 0x00000156: DW_TAG_compile_unit [7] *
+UPD: 0x00000107: DW_TAG_compile_unit [7] *
UPD: DW_AT_addr_base [DW_FORM_sec_offset] (0x00000008)
-UPD: 0x0000017e: DW_TAG_subprogram [3] * (0x00000156)
+UPD: 0x00000124: DW_TAG_subprogram [3] * (0x00000107)
UPD-NEXT: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x0000000000000018)
UPD: .debug_addr contents:
diff --git a/llvm/test/tools/dsymutil/ARM/dwarf5-addrx-0x0-last.test b/llvm/test/tools/dsymutil/ARM/dwarf5-addrx-0x0-last.test
index 0fbadd6e0deb88..f74c514ab51697 100644
--- a/llvm/test/tools/dsymutil/ARM/dwarf5-addrx-0x0-last.test
+++ b/llvm/test/tools/dsymutil/ARM/dwarf5-addrx-0x0-last.test
@@ -33,7 +33,7 @@ CHECK-NOT: error:
DEBUGINFO: DW_TAG_subprogram
DEBUGINFO: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x0000000100003f4c)
DEBUGINFO: DW_AT_high_pc [DW_FORM_data4] (0x00000054)
-DEBUGINFO: DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000011c] = "main")
+DEBUGINFO: DW_AT_name [DW_FORM_strx] (indexed (00000007) string = "main")
DEBUGLINE: 0x0000000100003f4c 4 0 {{.*}} is_stmt
DEBUGLINE: 0x0000000100003f6c 5 17 {{.*}} is_stmt prologue_end
diff --git a/llvm/test/tools/dsymutil/ARM/dwarf5-dwarf4-combination-macho.test b/llvm/test/tools/dsymutil/ARM/dwarf5-dwarf4-combination-macho.test
index a8acba4f2e7f3a..cb73e28396a0d3 100644
--- a/llvm/test/tools/dsymutil/ARM/dwarf5-dwarf4-combination-macho.test
+++ b/llvm/test/tools/dsymutil/ARM/dwarf5-dwarf4-combination-macho.test
@@ -39,27 +39,45 @@ CHECK:.debug_abbrev contents:
CHECK-NEXT: Abbrev table for offset: 0x00000000
CHECK: .debug_info contents:
-CHECK: 0x00000000: Compile Unit: length = 0x00000061, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08
+CHECK: 0x00000000: Compile Unit: length = 0x0000004a, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08
+CHECK: DW_AT_producer [DW_FORM_strx] (indexed (00000000) string = "Apple clang version 14.0.3 (clang-1403.0.22.14.1)")
+CHECK: DW_AT_name [DW_FORM_strx] (indexed (00000001) string = "a.cpp")
+CHECK: DW_AT_LLVM_sysroot [DW_FORM_strx] (indexed (00000002) string = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk")
+CHECK: DW_AT_APPLE_sdk [DW_FORM_strx] (indexed (00000003) string = "MacOSX.sdk")
+CHECK: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x00000008)
+CHECK: DW_AT_comp_dir [DW_FORM_strx] (indexed (00000004) string = "/Users/shubham/Development/test109275485")
CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x[[RANGELIST_OFFSET:[0-9a-f]+]]
CHECK-NEXT: [0x[[RANGELIST_OFFSET_START:[0-9a-f]+]], 0x[[RANGELIST_OFFSET_END:[0-9a-f]+]]))
CHECK-NEXT: DW_AT_addr_base [DW_FORM_sec_offset] (0x00000008)
-CHECK: 0x00000037: DW_TAG_subprogram [2] * (0x0000000c)
+CHECK: 0x0000002c: DW_TAG_subprogram [2] * (0x0000000c)
CHECK-NEXT: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x[[#%.16x,LOCLIST_LOWPC:]])
-CHECK: 0x0000004d: DW_TAG_formal_parameter [3] (0x00000037)
+CHECK: DW_AT_linkage_name [DW_FORM_strx] (indexed (00000005) string = "_Z4foo2i")
+CHECK: DW_AT_name [DW_FORM_strx] (indexed (00000006) string = "foo2")
+CHECK: 0x0000003c: DW_TAG_formal_parameter [3] (0x0000002c)
CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] (0x[[LOCLIST_OFFSET:[0-9a-f]+]]:
CHECK-NEXT: [0x[[#%.16x,LOCLIST_PAIR_START:]], 0x[[#%.16x,LOCLIST_PAIR_END:]]): [[LOCLIST_EXPR:.*]]
CHECK-NEXT: [0x[[#%.16x,LOCLIST_PAIR_START2:]], 0x[[#%.16x,LOCLIST_PAIR_END2:]]): [[LOCLIST_EXPR2:.*]])
-
-CHECK: 0x00000065: Compile Unit: length = 0x00000072, format = DWARF32, version = 0x0004, abbr_offset = 0x0000, addr_size = 0x08
+CHECK: DW_AT_name [DW_FORM_strx] (indexed (00000007) string = "a")
+
+CHECK: 0x0000004e: Compile Unit: length = 0x00000072, format = DWARF32, version = 0x0004, abbr_offset = 0x0000, addr_size = 0x08
+CHECK: DW_AT_producer [DW_FORM_strp] ( .debug_str[0x00000001] = "Apple clang version 14.0.3 (clang-1403.0.22.14.1)")
+CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x000000e0] = "b.cpp")
+CHECK: DW_AT_LLVM_sysroot [DW_FORM_strp] ( .debug_str[0x00000039] = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk")
+CHECK: DW_AT_APPLE_sdk [DW_FORM_strp] ( .debug_str[0x00000098] = "MacOSX.sdk")
+CHECK-NOT: DW_AT_str_offsets_base
+CHECK: DW_AT_comp_dir [DW_FORM_strp] ( .debug_str[0x000000a3] = "/Users/shubham/Development/test109275485")
CHECK: DW_AT_low_pc [DW_FORM_addr] (0x[[#%.16x,RANGE_LOWPC:]])
CHECK-NEXT: DW_AT_ranges [DW_FORM_sec_offset] (0x00000000
CHECK-NEXT: [0x[[#%.16x,RANGE_START:]], 0x[[#%.16x,RANGE_END:]]))
-CHECK: 0x00000097: DW_TAG_subprogram [6] * (0x00000070)
+CHECK: 0x00000080: DW_TAG_subprogram [6] * (0x00000059)
CHECK-NEXT: DW_AT_low_pc [DW_FORM_addr] (0x[[#%.16x,LOC_LOWPC:]])
-CHECK: 0x000000b4: DW_TAG_formal_parameter [3] (0x00000097)
+CHECK: DW_AT_linkage_name [DW_FORM_strp] ( .debug_str[0x000000e6] = "_Z3bari")
+CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x000000ee] = "bar")
+CHECK: 0x0000009d: DW_TAG_formal_parameter [7] (0x00000080)
CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] (0x[[LOC_OFFSET:[0-9a-f]+]]:
CHECK-NEXT: [0x[[#%.16x,LOC_PAIR_START:]], 0x[[#%.16x,LOC_PAIR_END:]]): [[LOC_EXPR:.*]]
CHECK-NEXT: [0x[[#%.16x,LOC_PAIR_START2:]], 0x[[#%.16x,LOC_PAIR_END2:]]): [[LOC_EXPR2:.*]])
+CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x000000f2] = "x")
CHECK: .debug_loc contents:
CHECK-NEXT: 0x[[LOC_OFFSET]]:
@@ -137,6 +155,21 @@ CHECK-NEXT: mod_time: 0x00000000
CHECK-NEXT: length: 0x00000000
CHECK: .debug_str contents:
+CHECK-NEXT: 0x00000000: ""
+CHECK-NEXT: 0x00000001: "Apple clang version 14.0.3 (clang-1403.0.22.14.1)"
+CHECK-NEXT: 0x00000033: "a.cpp"
+CHECK-NEXT: 0x00000039: "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
+CHECK-NEXT: 0x00000098: "MacOSX.sdk"
+CHECK-NEXT: 0x000000a3: "/Users/shubham/Development/test109275485"
+CHECK-NEXT: 0x000000cc: "_Z4foo2i"
+CHECK-NEXT: 0x000000d5: "foo2"
+CHECK-NEXT: 0x000000da: "a"
+CHECK-NEXT: 0x000000dc: "int"
+CHECK-NEXT: 0x000000e0: "b.cpp"
+CHECK-NEXT: 0x000000e6: "_Z3bari"
+CHECK-NEXT: 0x000000ee: "bar"
+CHECK-NEXT: 0x000000f2: "x"
+CHECK-NEXT: 0x000000f4: "y"
CHECK: .debug_line_str contents:
CHECK-NEXT: 0x00000000: "/Users/shubham/Development/test109275485"
@@ -152,6 +185,18 @@ CHECK-NEXT: [[RANGELIST_OFFSET]]: [DW_RLE_base_addressx]: 0x0000000000000000
CHECK-NEXT: 0x0000000e: [DW_RLE_offset_pair ]: {{.*}}[0x[[RANGELIST_OFFSET_START]], 0x[[RANGELIST_OFFSET_END]])
CHECK-NEXT: 0x00000011: [DW_RLE_end_of_list ]
+CHECK: .debug_str_offsets contents:
+CHECK-NEXT: 0x00000000: Contribution size = 40, Format = DWARF32, Version = 5
+CHECK-NEXT: 0x00000008: 00000001 "Apple clang version 14.0.3 (clang-1403.0.22.14.1)"
+CHECK-NEXT: 0x0000000c: 00000033 "a.cpp"
+CHECK-NEXT: 0x00000010: 00000039 "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
+CHECK-NEXT: 0x00000014: 00000098 "MacOSX.sdk"
+CHECK-NEXT: 0x00000018: 000000a3 "/Users/shubham/Development/test109275485"
+CHECK-NEXT: 0x0000001c: 000000cc "_Z4foo2i"
+CHECK-NEXT: 0x00000020: 000000d5 "foo2"
+CHECK-NEXT: 0x00000024: 000000da "a"
+CHECK-NEXT: 0x00000028: 000000dc "int"
+
CHECK: .debug_names contents:
CHECK-NEXT: Name Index @ 0x0 {
CHECK-NEXT: Header {
diff --git a/llvm/test/tools/dsymutil/ARM/dwarf5-macho.test b/llvm/test/tools/dsymutil/ARM/dwarf5-macho.test
index 4a352c95f053e8..6e4636486c3cca 100644
--- a/llvm/test/tools/dsymutil/ARM/dwarf5-macho.test
+++ b/llvm/test/tools/dsymutil/ARM/dwarf5-macho.test
@@ -25,13 +25,13 @@ CHECK:.debug_abbrev contents:
CHECK-NEXT: Abbrev table for offset: 0x00000000
CHECK: .debug_info contents:
-CHECK-NEXT: Compile Unit: length = 0x00000061, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08
+CHECK-NEXT: Compile Unit: length = 0x0000004a, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08
CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x[[RANGELIST_OFFSET:[0-9a-f]+]]
CHECK-NEXT: [0x[[RANGELIST_OFFSET_START:[0-9a-f]+]], 0x[[RANGELIST_OFFSET_END:[0-9a-f]+]]))
CHECK-NEXT: DW_AT_addr_base [DW_FORM_sec_offset] (0x00000008)
-CHECK: 0x00000037: DW_TAG_subprogram [2] * (0x0000000c)
+CHECK: 0x0000002c: DW_TAG_subprogram [2] * (0x0000000c)
CHECK-NEXT: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x[[#%.16x,LOCLIST_LOWPC:]])
-CHECK: 0x0000004d: DW_TAG_formal_parameter [3] (0x00000037)
+CHECK: 0x0000003c: DW_TAG_formal_parameter [3] (0x0000002c)
CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] (0x[[LOC_OFFSET:[0-9a-f]+]]:
CHECK-NEXT: [0x[[#%.16x,LOCLIST_PAIR_START:]], 0x[[#%.16x,LOCLIST_PAIR_END:]]): [[LOCLIST_EXPR:.*]]
CHECK-NEXT: [0x[[#%.16x,LOCLIST_PAIR_START2:]], 0x[[#%.16x,LOCLIST_PAIR_END2:]]): [[LOCLIST_EXPR2:.*]])
diff --git a/llvm/test/tools/dsymutil/ARM/dwarf5-str-offsets-base-strx.test b/llvm/test/tools/dsymutil/ARM/dwarf5-str-offsets-base-strx.test
new file mode 100644
index 00000000000000..4765d02a13f1aa
--- /dev/null
+++ b/llvm/test/tools/dsymutil/ARM/dwarf5-str-offsets-base-strx.test
@@ -0,0 +1,323 @@
+; This test checks to ensure that if three DWARFv5 object files have correct values for the DW_AT_str_offsets_base and DW_FORM_strx for strings in their compile units.
+
+; 1.o was produced with the source file:
+
+; a.cpp
+; __attribute__((section("1,__text_foo"))) void foo() {}
+;
+; int foo2(int a) {
+; return a+5;
+; }
+;
+; int foo3(int x) {
+; return x+2;
+; }
+;
+; int main () {
+; return 1;
+; }
+
+; clang -g -c -O1 a.cpp -gdwarf-5 -o 1.o
+
+; 2.o was produced with the following source file:
+
+; b.cpp
+; __attribute__((section("1,__text_foo"))) void bar() {}
+;
+; int bar2(int a) {
+; return a+5;
+; }
+;
+; int bar3(int x) {
+; return x+2;
+; }
+
+; clang -g -c -O1 b.cpp -gdwarf-5 -o 2.o
+
+; 3.o was produced with the following source file:
+
+; c.cpp
+;
+; int baz(int x) {
+; return x+2;
+; }
+
+; clang -g -c -O1 c.cpp -gdwarf-5 -o 3.o
+
+
+RUN: rm -rf %t.dir && mkdir -p %t.dir
+RUN: dsymutil -y %p/dummy-debug-map-amr64.map -oso-prepend-path=%p/../Inputs/DWARF5-addr-base-str-off-base -o %t.dir/dwarf5-addr-base.dSYM
+RUN: llvm-dwarfdump %t.dir/dwarf5-addr-base.dSYM -a --verbose | FileCheck %s
+
+RUN: dsymutil --update -y %p/dummy-debug-map-amr64.map -oso-prepend-path=%p/../Inputs/DWARF5-addr-base-str-off-base -o %t.dir/dwarf5-addr-base.dSYM
+RUN: llvm-dwarfdump %t.dir/dwarf5-addr-base.dSYM -a --verbose | FileCheck %s --check-prefix=UPD
+
+CHECK: .debug_info contents:
+CHECK: 0x00000000: Compile Unit: length = 0x0000004a, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x0000004e)
+
+CHECK: 0x0000000c: DW_TAG_compile_unit [1] *
+CHECK: DW_AT_producer [DW_FORM_strx] (indexed (00000000) string = "Apple clang version 15.0.0 (clang-1500.0.31.1)")
+CHECK: DW_AT_name [DW_FORM_strx] (indexed (00000001) string = "a.cpp")
+CHECK: DW_AT_LLVM_sysroot [DW_FORM_strx] (indexed (00000002) string = "/Users/shubham/apple-internal/Xcode-Rainbow/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk")
+CHECK: DW_AT_APPLE_sdk [DW_FORM_strx] (indexed (00000003) string = "MacOSX14.0.sdk")
+CHECK: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x00000008)
+CHECK: DW_AT_comp_dir [DW_FORM_strx] (indexed (00000004) string = "/Users/shubham/Development/test109275485")
+
+CHECK: 0x0000002c: DW_TAG_subprogram [2] * (0x0000000c)
+CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x0000000000010000)
+CHECK: DW_AT_linkage_name [DW_FORM_strx] (indexed (00000005) string = "_Z4foo2i")
+CHECK: DW_AT_name [DW_FORM_strx] (indexed (00000006) string = "foo2")
+
+CHECK: 0x0000003c: DW_TAG_formal_parameter [3] (0x0000002c)
+CHECK: DW_AT_name [DW_FORM_strx] (indexed (00000007) string = "a")
+
+CHECK: 0x00000048: NULL
+
+CHECK: 0x00000049: DW_TAG_base_type [4] (0x0000000c)
+CHECK: DW_AT_name [DW_FORM_strx] (indexed (00000008) string = "int")
+
+CHECK: 0x0000004d: NULL
+
+CHECK: 0x0000004e: Compile Unit: length = 0x0000004a, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x0000009c)
+
+CHECK: 0x0000005a: DW_TAG_compile_unit [1] *
+CHECK: DW_AT_producer [DW_FORM_strx] (indexed (00000000) string = "Apple clang version 15.0.0 (clang-1500.0.31.1)")
+CHECK: DW_AT_name [DW_FORM_strx] (indexed (00000009) string = "b.cpp")
+CHECK: DW_AT_LLVM_sysroot [DW_FORM_strx] (indexed (00000002) string = "/Users/shubham/apple-internal/Xcode-Rainbow/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk")
+CHECK: DW_AT_APPLE_sdk [DW_FORM_strx] (indexed (00000003) string = "MacOSX14.0.sdk")
+CHECK: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x00000008)
+CHECK: DW_AT_comp_dir [DW_FORM_strx] (indexed (00000004) string = "/Users/shubham/Development/test109275485")
+
+CHECK: 0x0000007a: DW_TAG_subprogram [2] * (0x0000005a)
+CHECK: DW_AT_linkage_name [DW_FORM_strx] (indexed (0000000a) string = "_Z4bar2i")
+CHECK: DW_AT_name [DW_FORM_strx] (indexed (0000000b) string = "bar2")
+
+CHECK: 0x0000008a: DW_TAG_formal_parameter [3] (0x0000007a)
+CHECK: DW_AT_name [DW_FORM_strx] (indexed (00000007) string = "a")
+
+CHECK: 0x00000096: NULL
+
+CHECK: 0x00000097: DW_TAG_base_type [4] (0x0000005a)
+CHECK: DW_AT_name [DW_FORM_strx] (indexed (00000008) string = "int")
+
+CHECK: 0x0000009b: NULL
+
+CHECK: 0x0000009c: Compile Unit: length = 0x00000043, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x000000e3)
+
+CHECK: 0x000000a8: DW_TAG_compile_unit [5] *
+CHECK: DW_AT_producer [DW_FORM_strx] (indexed (00000000) string = "Apple clang version 15.0.0 (clang-1500.0.31.1)")
+CHECK: DW_AT_name [DW_FORM_strx] (indexed (0000000c) string = "c.cpp")
+CHECK: DW_AT_LLVM_sysroot [DW_FORM_strx] (indexed (00000002) string = "/Users/shubham/apple-internal/Xcode-Rainbow/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk")
+CHECK: DW_AT_APPLE_sdk [DW_FORM_strx] (indexed (00000003) string = "MacOSX14.0.sdk")
+CHECK: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x00000008)
+CHECK: DW_AT_comp_dir [DW_FORM_strx] (indexed (00000004) string = "/Users/shubham/Development/test109275485")
+
+CHECK: 0x000000c1: DW_TAG_subprogram [2] * (0x000000a8)
+CHECK: DW_AT_linkage_name [DW_FORM_strx] (indexed (0000000d) string = "_Z3bazi")
+CHECK: DW_AT_name [DW_FORM_strx] (indexed (0000000e) string = "baz")
+
+CHECK: 0x000000d1: DW_TAG_formal_parameter [3] (0x000000c1)
+CHECK: DW_AT_name [DW_FORM_strx] (indexed (0000000f) string = "x")
+
+CHECK: 0x000000dd: NULL
+
+CHECK: 0x000000de: DW_TAG_base_type [4] (0x000000a8)
+CHECK: DW_AT_name [DW_FORM_strx] (indexed (00000008) string = "int")
+
+CHECK: 0x000000e2: NULL
+
+CHECK: .debug_str contents:
+CHECK-NEXT: 0x00000000: ""
+CHECK-NEXT: 0x00000001: "Apple clang version 15.0.0 (clang-1500.0.31.1)"
+CHECK-NEXT: 0x00000030: "a.cpp"
+CHECK-NEXT: 0x00000036: "/Users/shubham/apple-internal/Xcode-Rainbow/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk"
+CHECK-NEXT: 0x000000b7: "MacOSX14.0.sdk"
+CHECK-NEXT: 0x000000c6: "/Users/shubham/Development/test109275485"
+CHECK-NEXT: 0x000000ef: "_Z4foo2i"
+CHECK-NEXT: 0x000000f8: "foo2"
+CHECK-NEXT: 0x000000fd: "a"
+CHECK-NEXT: 0x000000ff: "int"
+CHECK-NEXT: 0x00000103: "b.cpp"
+CHECK-NEXT: 0x00000109: "_Z4bar2i"
+CHECK-NEXT: 0x00000112: "bar2"
+CHECK-NEXT: 0x00000117: "c.cpp"
+CHECK-NEXT: 0x0000011d: "_Z3bazi"
+CHECK-NEXT: 0x00000125: "baz"
+CHECK-NEXT: 0x00000129: "x"
+
+CHECK: .debug_str_offsets contents:
+CHECK-NEXT: 0x00000000: Contribution size = 68, Format = DWARF32, Version = 5
+CHECK-NEXT: 0x00000008: 00000001 "Apple clang version 15.0.0 (clang-1500.0.31.1)"
+CHECK-NEXT: 0x0000000c: 00000030 "a.cpp"
+CHECK-NEXT: 0x00000010: 00000036 "/Users/shubham/apple-internal/Xcode-Rainbow/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk"
+CHECK-NEXT: 0x00000014: 000000b7 "MacOSX14.0.sdk"
+CHECK-NEXT: 0x00000018: 000000c6 "/Users/shubham/Development/test109275485"
+CHECK-NEXT: 0x0000001c: 000000ef "_Z4foo2i"
+CHECK-NEXT: 0x00000020: 000000f8 "foo2"
+CHECK-NEXT: 0x00000024: 000000fd "a"
+CHECK-NEXT: 0x00000028: 000000ff "int"
+CHECK-NEXT: 0x0000002c: 00000103 "b.cpp"
+CHECK-NEXT: 0x00000030: 00000109 "_Z4bar2i"
+CHECK-NEXT: 0x00000034: 00000112 "bar2"
+CHECK-NEXT: 0x00000038: 00000117 "c.cpp"
+CHECK-NEXT: 0x0000003c: 0000011d "_Z3bazi"
+CHECK-NEXT: 0x00000040: 00000125 "baz"
+CHECK-NEXT: 0x00000044: 00000129 "x"
+
+UPD: .debug_info contents:
+UPD: 0x00000000: Compile Unit: length = 0x00000081, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x00000085)
+
+UPD: 0x0000000c: DW_TAG_compile_unit [1] *
+UPD: DW_AT_producer [DW_FORM_strx] (indexed (00000000) string = "Apple clang version 15.0.0 (clang-1500.0.31.1)")
+UPD: DW_AT_name [DW_FORM_strx] (indexed (00000001) string = "a.cpp")
+UPD: DW_AT_LLVM_sysroot [DW_FORM_strx] (indexed (00000002) string = "/Users/shubham/apple-internal/Xcode-Rainbow/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk")
+UPD: DW_AT_APPLE_sdk [DW_FORM_strx] (indexed (00000003) string = "MacOSX14.0.sdk")
+UPD: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x00000008)
+UPD: DW_AT_comp_dir [DW_FORM_strx] (indexed (00000004) string = "/Users/shubham/Development/test109275485")
+
+UPD: 0x00000031: DW_TAG_subprogram [2] (0x0000000c)
+UPD: DW_AT_linkage_name [DW_FORM_strx] (indexed (00000005) string = "_Z3foov")
+UPD: DW_AT_name [DW_FORM_strx] (indexed (00000006) string = "foo")
+
+UPD: 0x0000003d: DW_TAG_subprogram [3] * (0x0000000c)
+UPD: DW_AT_linkage_name [DW_FORM_strx] (indexed (00000007) string = "_Z4foo2i")
+UPD: DW_AT_name [DW_FORM_strx] (indexed (00000008) string = "foo2")
+
+UPD: 0x0000004d: DW_TAG_formal_parameter [4] (0x0000003d)
+UPD: DW_AT_name [DW_FORM_strx] (indexed (00000009) string = "a")
+
+UPD: 0x00000056: NULL
+
+UPD: 0x00000057: DW_TAG_subprogram [3] * (0x0000000c)
+UPD: DW_AT_linkage_name [DW_FORM_strx] (indexed (0000000a) string = "_Z4foo3i")
+UPD: DW_AT_name [DW_FORM_strx] (indexed (0000000b) string = "foo3")
+
+UPD: 0x00000067: DW_TAG_formal_parameter [4] (0x00000057)
+UPD: DW_AT_name [DW_FORM_strx] (indexed (0000000c) string = "x")
+
+UPD: 0x00000070: NULL
+
+UPD: 0x00000071: DW_TAG_subprogram [5] (0x0000000c)
+UPD: DW_AT_name [DW_FORM_strx] (indexed (0000000d) string = "main")
+
+UPD: 0x00000080: DW_TAG_base_type [6] (0x0000000c)
+UPD: DW_AT_name [DW_FORM_strx] (indexed (0000000e) string = "int")
+
+UPD: 0x00000084: NULL
+
+UPD: 0x00000085: Compile Unit: length = 0x00000072, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x000000fb)
+
+UPD: 0x00000091: DW_TAG_compile_unit [1] *
+UPD: DW_AT_producer [DW_FORM_strx] (indexed (00000000) string = "Apple clang version 15.0.0 (clang-1500.0.31.1)")
+UPD: DW_AT_name [DW_FORM_strx] (indexed (0000000f) string = "b.cpp")
+UPD: DW_AT_LLVM_sysroot [DW_FORM_strx] (indexed (00000002) string = "/Users/shubham/apple-internal/Xcode-Rainbow/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk")
+UPD: DW_AT_APPLE_sdk [DW_FORM_strx] (indexed (00000003) string = "MacOSX14.0.sdk")
+UPD: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x00000008)
+UPD: DW_AT_comp_dir [DW_FORM_strx] (indexed (00000004) string = "/Users/shubham/Development/test109275485")
+
+UPD: 0x000000b6: DW_TAG_subprogram [2] (0x00000091)
+UPD: DW_AT_linkage_name [DW_FORM_strx] (indexed (00000010) string = "_Z3barv")
+UPD: DW_AT_name [DW_FORM_strx] (indexed (00000011) string = "bar")
+
+UPD: 0x000000c2: DW_TAG_subprogram [3] * (0x00000091)
+UPD: DW_AT_linkage_name [DW_FORM_strx] (indexed (00000012) string = "_Z4bar2i")
+UPD: DW_AT_name [DW_FORM_strx] (indexed (00000013) string = "bar2")
+
+UPD: 0x000000d2: DW_TAG_formal_parameter [4] (0x000000c2)
+UPD: DW_AT_name [DW_FORM_strx] (indexed (00000009) string = "a")
+
+UPD: 0x000000db: NULL
+
+UPD: 0x000000dc: DW_TAG_subprogram [3] * (0x00000091)
+UPD: DW_AT_linkage_name [DW_FORM_strx] (indexed (00000014) string = "_Z4bar3i")
+UPD: DW_AT_name [DW_FORM_strx] (indexed (00000015) string = "bar3")
+
+UPD: 0x000000ec: DW_TAG_formal_parameter [4] (0x000000dc)
+UPD: DW_AT_name [DW_FORM_strx] (indexed (0000000c) string = "x")
+
+UPD: 0x000000f5: NULL
+
+UPD: 0x000000f6: DW_TAG_base_type [6] (0x00000091)
+UPD: DW_AT_name [DW_FORM_strx] (indexed (0000000e) string = "int")
+
+UPD: 0x000000fa: NULL
+
+UPD: 0x000000fb: Compile Unit: length = 0x00000044, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x00000143)
+
+UPD: 0x00000107: DW_TAG_compile_unit [7] *
+UPD: DW_AT_producer [DW_FORM_strx] (indexed (00000000) string = "Apple clang version 15.0.0 (clang-1500.0.31.1)")
+UPD: DW_AT_name [DW_FORM_strx] (indexed (00000016) string = "c.cpp")
+UPD: DW_AT_LLVM_sysroot [DW_FORM_strx] (indexed (00000002) string = "/Users/shubham/apple-internal/Xcode-Rainbow/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk")
+UPD: DW_AT_APPLE_sdk [DW_FORM_strx] (indexed (00000003) string = "MacOSX14.0.sdk")
+UPD: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x00000008)
+UPD: DW_AT_comp_dir [DW_FORM_strx] (indexed (00000004) string = "/Users/shubham/Development/test109275485")
+
+UPD: 0x00000124: DW_TAG_subprogram [3] * (0x00000107)
+UPD: DW_AT_linkage_name [DW_FORM_strx] (indexed (00000017) string = "_Z3bazi")
+UPD: DW_AT_name [DW_FORM_strx] (indexed (00000018) string = "baz")
+
+UPD: 0x00000134: DW_TAG_formal_parameter [4] (0x00000124)
+UPD: DW_AT_name [DW_FORM_strx] (indexed (0000000c) string = "x")
+
+UPD: 0x0000013d: NULL
+
+UPD: 0x0000013e: DW_TAG_base_type [6] (0x00000107)
+UPD: DW_AT_name [DW_FORM_strx] (indexed (0000000e) string = "int")
+
+UPD: 0x00000142: NULL
+
+UPD: .debug_str contents:
+UPD-NEXT: 0x00000000: ""
+UPD-NEXT: 0x00000001: "Apple clang version 15.0.0 (clang-1500.0.31.1)"
+UPD-NEXT: 0x00000030: "a.cpp"
+UPD-NEXT: 0x00000036: "/Users/shubham/apple-internal/Xcode-Rainbow/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk"
+UPD-NEXT: 0x000000b7: "MacOSX14.0.sdk"
+UPD-NEXT: 0x000000c6: "/Users/shubham/Development/test109275485"
+UPD-NEXT: 0x000000ef: "_Z3foov"
+UPD-NEXT: 0x000000f7: "foo"
+UPD-NEXT: 0x000000fb: "_Z4foo2i"
+UPD-NEXT: 0x00000104: "foo2"
+UPD-NEXT: 0x00000109: "a"
+UPD-NEXT: 0x0000010b: "_Z4foo3i"
+UPD-NEXT: 0x00000114: "foo3"
+UPD-NEXT: 0x00000119: "x"
+UPD-NEXT: 0x0000011b: "main"
+UPD-NEXT: 0x00000120: "int"
+UPD-NEXT: 0x00000124: "b.cpp"
+UPD-NEXT: 0x0000012a: "_Z3barv"
+UPD-NEXT: 0x00000132: "bar"
+UPD-NEXT: 0x00000136: "_Z4bar2i"
+UPD-NEXT: 0x0000013f: "bar2"
+UPD-NEXT: 0x00000144: "_Z4bar3i"
+UPD-NEXT: 0x0000014d: "bar3"
+UPD-NEXT: 0x00000152: "c.cpp"
+UPD-NEXT: 0x00000158: "_Z3bazi"
+UPD-NEXT: 0x00000160: "baz"
+
+UPD: .debug_str_offsets contents:
+UPD-NEXT: 0x00000000: Contribution size = 104, Format = DWARF32, Version = 5
+UPD-NEXT: 0x00000008: 00000001 "Apple clang version 15.0.0 (clang-1500.0.31.1)"
+UPD-NEXT: 0x0000000c: 00000030 "a.cpp"
+UPD-NEXT: 0x00000010: 00000036 "/Users/shubham/apple-internal/Xcode-Rainbow/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk"
+UPD-NEXT: 0x00000014: 000000b7 "MacOSX14.0.sdk"
+UPD-NEXT: 0x00000018: 000000c6 "/Users/shubham/Development/test109275485"
+UPD-NEXT: 0x0000001c: 000000ef "_Z3foov"
+UPD-NEXT: 0x00000020: 000000f7 "foo"
+UPD-NEXT: 0x00000024: 000000fb "_Z4foo2i"
+UPD-NEXT: 0x00000028: 00000104 "foo2"
+UPD-NEXT: 0x0000002c: 00000109 "a"
+UPD-NEXT: 0x00000030: 0000010b "_Z4foo3i"
+UPD-NEXT: 0x00000034: 00000114 "foo3"
+UPD-NEXT: 0x00000038: 00000119 "x"
+UPD-NEXT: 0x0000003c: 0000011b "main"
+UPD-NEXT: 0x00000040: 00000120 "int"
+UPD-NEXT: 0x00000044: 00000124 "b.cpp"
+UPD-NEXT: 0x00000048: 0000012a "_Z3barv"
+UPD-NEXT: 0x0000004c: 00000132 "bar"
+UPD-NEXT: 0x00000050: 00000136 "_Z4bar2i"
+UPD-NEXT: 0x00000054: 0000013f "bar2"
+UPD-NEXT: 0x00000058: 00000144 "_Z4bar3i"
+UPD-NEXT: 0x0000005c: 0000014d "bar3"
+UPD-NEXT: 0x00000060: 00000152 "c.cpp"
+UPD-NEXT: 0x00000064: 00000158 "_Z3bazi"
+UPD-NEXT: 0x00000068: 00000160 "baz"
diff --git a/llvm/test/tools/dsymutil/Inputs/DWARF5-addr_base/1.o b/llvm/test/tools/dsymutil/Inputs/DWARF5-addr-base-str-off-base/1.o
similarity index 100%
rename from llvm/test/tools/dsymutil/Inputs/DWARF5-addr_base/1.o
rename to llvm/test/tools/dsymutil/Inputs/DWARF5-addr-base-str-off-base/1.o
diff --git a/llvm/test/tools/dsymutil/Inputs/DWARF5-addr_base/2.o b/llvm/test/tools/dsymutil/Inputs/DWARF5-addr-base-str-off-base/2.o
similarity index 100%
rename from llvm/test/tools/dsymutil/Inputs/DWARF5-addr_base/2.o
rename to llvm/test/tools/dsymutil/Inputs/DWARF5-addr-base-str-off-base/2.o
diff --git a/llvm/test/tools/dsymutil/Inputs/DWARF5-addr_base/3.o b/llvm/test/tools/dsymutil/Inputs/DWARF5-addr-base-str-off-base/3.o
similarity index 100%
rename from llvm/test/tools/dsymutil/Inputs/DWARF5-addr_base/3.o
rename to llvm/test/tools/dsymutil/Inputs/DWARF5-addr-base-str-off-base/3.o
diff --git a/llvm/test/tools/dsymutil/X86/dwarf5-addrbase-broken.test b/llvm/test/tools/dsymutil/X86/dwarf5-addrbase-broken.test
index e648ae0df62483..cfe70586431e66 100644
--- a/llvm/test/tools/dsymutil/X86/dwarf5-addrbase-broken.test
+++ b/llvm/test/tools/dsymutil/X86/dwarf5-addrbase-broken.test
@@ -25,14 +25,14 @@
# CHECK: DW_TAG_variable
# CHECK: DW_AT_name{{.*}}"var1"
# CHECK: DW_AT_location (DW_OP_addr
-# CHECK: 0x0000004e: NULL
+# CHECK: 0x00000043: NULL
# CHECK: Compile Unit:
# CHECK: DW_TAG_compile_unit
# CHECK-NOT: DW_AT_low_pc
# CHECK: DW_AT_name{{.*}}"BadCU"
# CHECK-NOT: DW_TAG_subprogram
# CHECK-NOT: DW_TAG_variable
-# CHECK: 0x0000006b: NULL
+# CHECK: 0x0000005b: NULL
--- !mach-o
FileHeader:
diff --git a/llvm/test/tools/dsymutil/X86/dwarf5-addrx.test b/llvm/test/tools/dsymutil/X86/dwarf5-addrx.test
index b9d59fedc61044..463c51a1b068ee 100644
--- a/llvm/test/tools/dsymutil/X86/dwarf5-addrx.test
+++ b/llvm/test/tools/dsymutil/X86/dwarf5-addrx.test
@@ -55,87 +55,87 @@ RUN: llvm-dwarfdump --verbose %t.dSYM | FileCheck %s --check-prefix UPDATE-DWARF
CHECK-NOT: error:
DWARF: DW_TAG_compile_unit
-DWARF: DW_AT_name [DW_FORM_strp] {{.*}} "dwarf5-addrx.c"
+DWARF: DW_AT_name [DW_FORM_strx] {{.*}} "dwarf5-addrx.c"
DWARF: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x0000000100000eb0)
DWARF: DW_AT_high_pc [DW_FORM_data4] (0x00000103)
DWARF: DW_AT_addr_base [DW_FORM_sec_offset] (0x00000008)
DWARF: DW_TAG_subprogram
DWARF: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x0000000100000eb0)
DWARF: DW_AT_high_pc [DW_FORM_data4] (0x00000010)
-DWARF: DW_AT_name [DW_FORM_strp] {{.*}} "foo1"
+DWARF: DW_AT_name [DW_FORM_strx] {{.*}} "foo1"
DWARF: DW_TAG_subprogram
DWARF: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000001) address = 0x0000000100000ec0)
DWARF: DW_AT_high_pc [DW_FORM_data4] (0x00000010)
-DWARF: DW_AT_name [DW_FORM_strp] {{.*}} "foo2"
+DWARF: DW_AT_name [DW_FORM_strx] {{.*}} "foo2"
DWARF: DW_TAG_subprogram
DWARF: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000002) address = 0x0000000100000ed0)
DWARF: DW_AT_high_pc [DW_FORM_data4] (0x00000010)
-DWARF: DW_AT_name [DW_FORM_strp] {{.*}} "foo3"
+DWARF: DW_AT_name [DW_FORM_strx] {{.*}} "foo3"
DWARF: DW_TAG_subprogram
DWARF: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000003) address = 0x0000000100000ee0)
DWARF: DW_AT_high_pc [DW_FORM_data4] (0x00000010)
-DWARF: DW_AT_name [DW_FORM_strp] {{.*}} "foo4"
+DWARF: DW_AT_name [DW_FORM_strx] {{.*}} "foo4"
DWARF: DW_TAG_subprogram
DWARF: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000004) address = 0x0000000100000ef0)
DWARF: DW_AT_high_pc [DW_FORM_data4] (0x00000010)
-DWARF: DW_AT_name [DW_FORM_strp] {{.*}} "foo5"
+DWARF: DW_AT_name [DW_FORM_strx] {{.*}} "foo5"
DWARF: DW_TAG_subprogram
DWARF: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000005) address = 0x0000000100000f00)
DWARF: DW_AT_high_pc [DW_FORM_data4] (0x00000010)
-DWARF: DW_AT_name [DW_FORM_strp] {{.*}} "foo6"
+DWARF: DW_AT_name [DW_FORM_strx] {{.*}} "foo6"
DWARF: DW_TAG_subprogram
DWARF: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000006) address = 0x0000000100000f10)
DWARF: DW_AT_high_pc [DW_FORM_data4] (0x00000010)
-DWARF: DW_AT_name [DW_FORM_strp] {{.*}} "foo7"
+DWARF: DW_AT_name [DW_FORM_strx] {{.*}} "foo7"
DWARF: DW_TAG_subprogram
DWARF: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000007) address = 0x0000000100000f20)
DWARF: DW_AT_high_pc [DW_FORM_data4] (0x00000010)
-DWARF: DW_AT_name [DW_FORM_strp] {{.*}} "foo8"
+DWARF: DW_AT_name [DW_FORM_strx] {{.*}} "foo8"
DWARF: DW_TAG_subprogram
DWARF: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000008) address = 0x0000000100000f30)
DWARF: DW_AT_high_pc [DW_FORM_data4] (0x00000083)
-DWARF: DW_AT_name [DW_FORM_strp] {{.*}} "main"
+DWARF: DW_AT_name [DW_FORM_strx] {{.*}} "main"
UPDATE-DWARF: DW_TAG_compile_unit
-UPDATE-DWARF: DW_AT_name [DW_FORM_strp] {{.*}} "dwarf5-addrx.c"
+UPDATE-DWARF: DW_AT_name [DW_FORM_strx] {{.*}} "dwarf5-addrx.c"
UPDATE-DWARF: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x0000000000000000)
UPDATE-DWARF: DW_AT_high_pc [DW_FORM_data4] (0x00000103)
UPDATE-DWARF: DW_TAG_subprogram
UPDATE-DWARF: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x0000000000000000)
UPDATE-DWARF: DW_AT_high_pc [DW_FORM_data4] (0x00000010)
-UPDATE-DWARF: DW_AT_name [DW_FORM_strp] {{.*}} "foo1"
+UPDATE-DWARF: DW_AT_name [DW_FORM_strx] {{.*}} "foo1"
UPDATE-DWARF: DW_TAG_subprogram
UPDATE-DWARF: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000001) address = 0x0000000000000010)
UPDATE-DWARF: DW_AT_high_pc [DW_FORM_data4] (0x00000010)
-UPDATE-DWARF: DW_AT_name [DW_FORM_strp] {{.*}} "foo2"
+UPDATE-DWARF: DW_AT_name [DW_FORM_strx] {{.*}} "foo2"
UPDATE-DWARF: DW_TAG_subprogram
UPDATE-DWARF: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000002) address = 0x0000000000000020)
UPDATE-DWARF: DW_AT_high_pc [DW_FORM_data4] (0x00000010)
-UPDATE-DWARF: DW_AT_name [DW_FORM_strp] {{.*}} "foo3"
+UPDATE-DWARF: DW_AT_name [DW_FORM_strx] {{.*}} "foo3"
UPDATE-DWARF: DW_TAG_subprogram
UPDATE-DWARF: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000003) address = 0x0000000000000030)
UPDATE-DWARF: DW_AT_high_pc [DW_FORM_data4] (0x00000010)
-UPDATE-DWARF: DW_AT_name [DW_FORM_strp] {{.*}} "foo4"
+UPDATE-DWARF: DW_AT_name [DW_FORM_strx] {{.*}} "foo4"
UPDATE-DWARF: DW_TAG_subprogram
UPDATE-DWARF: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000004) address = 0x0000000000000040)
UPDATE-DWARF: DW_AT_high_pc [DW_FORM_data4] (0x00000010)
-UPDATE-DWARF: DW_AT_name [DW_FORM_strp] {{.*}} "foo5"
+UPDATE-DWARF: DW_AT_name [DW_FORM_strx] {{.*}} "foo5"
UPDATE-DWARF: DW_TAG_subprogram
UPDATE-DWARF: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000005) address = 0x0000000000000050)
UPDATE-DWARF: DW_AT_high_pc [DW_FORM_data4] (0x00000010)
-UPDATE-DWARF: DW_AT_name [DW_FORM_strp] {{.*}} "foo6"
+UPDATE-DWARF: DW_AT_name [DW_FORM_strx] {{.*}} "foo6"
UPDATE-DWARF: DW_TAG_subprogram
UPDATE-DWARF: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000006) address = 0x0000000000000060)
UPDATE-DWARF: DW_AT_high_pc [DW_FORM_data4] (0x00000010)
-UPDATE-DWARF: DW_AT_name [DW_FORM_strp] {{.*}} "foo7"
+UPDATE-DWARF: DW_AT_name [DW_FORM_strx] {{.*}} "foo7"
UPDATE-DWARF: DW_TAG_subprogram
UPDATE-DWARF: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000007) address = 0x0000000000000070)
UPDATE-DWARF: DW_AT_high_pc [DW_FORM_data4] (0x00000010)
-UPDATE-DWARF: DW_AT_name [DW_FORM_strp] {{.*}} "foo8"
+UPDATE-DWARF: DW_AT_name [DW_FORM_strx] {{.*}} "foo8"
UPDATE-DWARF: DW_TAG_subprogram
UPDATE-DWARF: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000008) address = 0x0000000000000080)
UPDATE-DWARF: DW_AT_high_pc [DW_FORM_data4] (0x00000083)
-UPDATE-DWARF: DW_AT_name [DW_FORM_strp] {{.*}} "main"
+UPDATE-DWARF: DW_AT_name [DW_FORM_strx] {{.*}} "main"
UPDATE-DWARF: .debug_addr contents:
UPDATE-DWARF: 0x00000000: Address table header: length = 0x0000004c, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00
UPDATE-DWARF: Addrs: [
diff --git a/llvm/test/tools/dsymutil/X86/dwarf5-loclists.test b/llvm/test/tools/dsymutil/X86/dwarf5-loclists.test
index 1d1e1169075003..ccb458c35c41aa 100644
--- a/llvm/test/tools/dsymutil/X86/dwarf5-loclists.test
+++ b/llvm/test/tools/dsymutil/X86/dwarf5-loclists.test
@@ -65,7 +65,7 @@
#UPD-DWARF-CHECK: DW_TAG_compile_unit
#UPD-DWARF-CHECK: DW_AT_name {{.*}} "dwarf5-loclists.c"
#UPD-DWARF-CHECK: DW_AT_loclists_base [DW_FORM_sec_offset] (0x0000000c)
-#UPD-DWARF-CHECK: DW_TAG_formal_parameter [8] (0x00000058)
+#UPD-DWARF-CHECK: DW_TAG_formal_parameter [8] (0x00000047)
#UPD-DWARF-CHECK: DW_AT_location [DW_FORM_loclistx] (indexed (0x0) loclist = 0x00000014:
#UPD-DWARF-CHECK: [0x0000000000000000, 0x0000000000000017): DW_OP_reg5 RDI
#UPD-DWARF-CHECK: [0x0000000000000017, 0x0000000000000023): DW_OP_reg3 RBX
@@ -73,7 +73,7 @@
#UPD-DWARF-CHECK: [0x0000000000000030, 0x0000000000000033): DW_OP_reg3 RBX
#UPD-DWARF-CHECK: [0x0000000000000033, 0x000000000000004c): DW_OP_breg6 RBP-20)
#UPD-DWARF-CHECK: DW_AT_name {{.*}} "argv"
-#UPD-DWARF-CHECK: DW_TAG_formal_parameter [8] (0x00000058)
+#UPD-DWARF-CHECK: DW_TAG_formal_parameter [8] (0x00000047)
#UPD-DWARF-CHECK: DW_AT_location [DW_FORM_loclistx] (indexed (0x1) loclist = 0x0000002f:
#UPD-DWARF-CHECK: [0x0000000000000000, 0x0000000000000019): DW_OP_reg4 RSI
#UPD-DWARF-CHECK: [0x0000000000000019, 0x000000000000004c): DW_OP_entry_value(DW_OP_reg4 RSI), DW_OP_stack_value)
diff --git a/llvm/test/tools/dsymutil/X86/op-convert-offset.test b/llvm/test/tools/dsymutil/X86/op-convert-offset.test
index b1dbba6b2f6dcf..80cfc867b1d92f 100644
--- a/llvm/test/tools/dsymutil/X86/op-convert-offset.test
+++ b/llvm/test/tools/dsymutil/X86/op-convert-offset.test
@@ -34,12 +34,12 @@ OBJ: DW_AT_location (DW_OP_breg2 RCX+0, DW_OP_constu 0x
OBJ: DW_AT_name ("b")
OBJ: DW_AT_type (0x000000af "_Bool")
-DSYM: 0x0000009a: DW_TAG_base_type
+DSYM: 0x00000084: DW_TAG_base_type
DSYM: DW_AT_name ("DW_ATE_unsigned_1")
DSYM: DW_AT_encoding (DW_ATE_unsigned)
DSYM: DW_AT_byte_size (0x01)
-DSYM: 0x000000ba: DW_TAG_formal_parameter
-DSYM: DW_AT_location (DW_OP_breg2 RCX+0, DW_OP_constu 0xff, DW_OP_and, DW_OP_convert (0x0000009a) "DW_ATE_unsigned_1", DW_OP_convert (0x000000a1) "DW_ATE_unsigned_8", DW_OP_stack_value)
+DSYM: 0x0000009b: DW_TAG_formal_parameter
+DSYM: DW_AT_location (DW_OP_breg2 RCX+0, DW_OP_constu 0xff, DW_OP_and, DW_OP_convert (0x00000084) "DW_ATE_unsigned_1", DW_OP_convert (0x00000088) "DW_ATE_unsigned_8", DW_OP_stack_value)
DSYM: DW_AT_name ("b")
-DSYM: DW_AT_type (0x000000d8 "_Bool")
+DSYM: DW_AT_type (0x000000b6 "_Bool")
diff --git a/llvm/test/tools/llvm-dwarfutil/ELF/X86/dwarf5-addresses.test b/llvm/test/tools/llvm-dwarfutil/ELF/X86/dwarf5-addresses.test
index 642de902a9ccf0..50dd070633bc78 100644
--- a/llvm/test/tools/llvm-dwarfutil/ELF/X86/dwarf5-addresses.test
+++ b/llvm/test/tools/llvm-dwarfutil/ELF/X86/dwarf5-addresses.test
@@ -24,44 +24,45 @@
#CHECK: No errors.
#DWARF-CHECK: DW_TAG_compile_unit
-#DWARF-CHECK: DW_AT_name [DW_FORM_strp] {{.*}} "CU1"
+#DWARF-CHECK: DW_AT_name [DW_FORM_strx] {{.*}} "CU1"
#DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x0000000000001130)
#DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000060)
+#DWARF-CHECK: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x00000008)
#DWARF-CHECK: DW_TAG_subprogram
-#DWARF-CHECK: DW_AT_name [DW_FORM_strp] {{.*}} "foo1"
+#DWARF-CHECK: DW_AT_name [DW_FORM_strx] {{.*}} "foo1"
#DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x0000000000001130)
#DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010)
#DWARF-CHECK: DW_TAG_subprogram
-#DWARF-CHECK: DW_AT_name [DW_FORM_strp] {{.*}} "foo2"
+#DWARF-CHECK: DW_AT_name [DW_FORM_strx] {{.*}} "foo2"
#DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000001) address = 0x0000000000001140)
#DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010)
#DWARF-CHECK: DW_TAG_subprogram
-#DWARF-CHECK: DW_AT_name [DW_FORM_strp] {{.*}} "foo3"
+#DWARF-CHECK: DW_AT_name [DW_FORM_strx] {{.*}} "foo3"
#DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000002) address = 0x0000000000001150)
#DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010)
#DWARF-CHECK: DW_TAG_subprogram
-#DWARF-CHECK: DW_AT_name [DW_FORM_strp] {{.*}} "foo4"
+#DWARF-CHECK: DW_AT_name [DW_FORM_strx] {{.*}} "foo4"
#DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000003) address = 0x0000000000001160)
#DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010)
#DWARF-CHECK: DW_TAG_subprogram
-#DWARF-CHECK: DW_AT_name [DW_FORM_strp] {{.*}} "foo5"
+#DWARF-CHECK: DW_AT_name [DW_FORM_strx] {{.*}} "foo5"
#DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000004) address = 0x0000000000001170)
#DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010)
#DWARF-CHECK: DW_TAG_subprogram
-#DWARF-CHECK: DW_AT_name [DW_FORM_strp] {{.*}} "foo6"
+#DWARF-CHECK: DW_AT_name [DW_FORM_strx] {{.*}} "foo6"
#DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000005) address = 0x0000000000001180)
#DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010)
#DWARF-CHECK: DW_TAG_variable
-#DWARF-CHECK: DW_AT_name [DW_FORM_strp] {{.*}} "var1"
+#DWARF-CHECK: DW_AT_name [DW_FORM_strx] {{.*}} "var1"
#DWARF-CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addr 0x2000)
#DWARF-CHECK: DW_TAG_variable
-#DWARF-CHECK: DW_AT_name [DW_FORM_strp] {{.*}} "var2"
+#DWARF-CHECK: DW_AT_name [DW_FORM_strx] {{.*}} "var2"
#DWARF-CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_addr 0x2000)
#DWARF-CHECK: DW_TAG_variable
-#DWARF-CHECK: DW_AT_name [DW_FORM_strp] {{.*}} "var3"
+#DWARF-CHECK: DW_AT_name [DW_FORM_strx] {{.*}} "var3"
#DWARF-CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_const8u 0x2000, DW_OP_form_tls_address)
#DWARF-CHECK: DW_TAG_variable
-#DWARF-CHECK: DW_AT_name [DW_FORM_strp] {{.*}} "var4"
+#DWARF-CHECK: DW_AT_name [DW_FORM_strx] {{.*}} "var4"
#DWARF-CHECK: DW_AT_location [DW_FORM_exprloc] (DW_OP_const8u 0x2000, DW_OP_form_tls_address)
#DWARF-CHECK=NOT: .debug_addr contents:
diff --git a/llvm/test/tools/llvm-dwarfutil/ELF/X86/dwarf5-rnglists.test b/llvm/test/tools/llvm-dwarfutil/ELF/X86/dwarf5-rnglists.test
index 7582b7129a4457..d9458e901944fa 100644
--- a/llvm/test/tools/llvm-dwarfutil/ELF/X86/dwarf5-rnglists.test
+++ b/llvm/test/tools/llvm-dwarfutil/ELF/X86/dwarf5-rnglists.test
@@ -19,33 +19,34 @@
#CHECK: No errors.
#DWARF-CHECK: DW_TAG_compile_unit
-#DWARF-CHECK: DW_AT_name [DW_FORM_strp] {{.*}} "CU1"
+#DWARF-CHECK: DW_AT_name [DW_FORM_strx] {{.*}} "CU1"
#DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x0000000000001130)
#DWARF-CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x[[CURANGE_OFF:[0-9a-f]*]]
#DWARF-CHECK: [0x0000000000001130, 0x0000000000001170))
+#DWARF-CHECK: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x00000008)
#DWARF-CHECK: DW_TAG_subprogram
-#DWARF-CHECK: DW_AT_name [DW_FORM_strp] {{.*}} "foo1"
+#DWARF-CHECK: DW_AT_name [DW_FORM_strx] {{.*}} "foo1"
#DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x0000000000001130)
#DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010)
#DWARF-CHECK: DW_TAG_lexical_block
#DWARF-CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x[[F1RANGE_OFF:[0-9a-f]*]]
#DWARF-CHECK: [0x0000000000001130, 0x0000000000001140))
#DWARF-CHECK: DW_TAG_subprogram
-#DWARF-CHECK: DW_AT_name [DW_FORM_strp] {{.*}} "foo2"
+#DWARF-CHECK: DW_AT_name [DW_FORM_strx] {{.*}} "foo2"
#DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000001) address = 0x0000000000001140)
#DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010)
#DWARF-CHECK: DW_TAG_lexical_block
#DWARF-CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x[[F2RANGE_OFF:[0-9a-f]*]]
#DWARF-CHECK: [0x0000000000001140, 0x0000000000001150))
#DWARF-CHECK: DW_TAG_subprogram
-#DWARF-CHECK: DW_AT_name [DW_FORM_strp] {{.*}} "foo3"
+#DWARF-CHECK: DW_AT_name [DW_FORM_strx] {{.*}} "foo3"
#DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000002) address = 0x0000000000001150)
#DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010)
#DWARF-CHECK: DW_TAG_lexical_block
#DWARF-CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x[[F3RANGE_OFF:[0-9a-f]*]]
#DWARF-CHECK: [0x0000000000001150, 0x0000000000001160))
#DWARF-CHECK: DW_TAG_subprogram
-#DWARF-CHECK: DW_AT_name [DW_FORM_strp] {{.*}} "foo4"
+#DWARF-CHECK: DW_AT_name [DW_FORM_strx] {{.*}} "foo4"
#DWARF-CHECK: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000003) address = 0x0000000000001160)
#DWARF-CHECK: DW_AT_high_pc [DW_FORM_data8] (0x0000000000000010)
#DWARF-CHECK: DW_TAG_lexical_block
More information about the llvm-commits
mailing list