Skip to content

Commit 717946f

Browse files
committed
Revert "[dsymutil] Add support for mergeable libraries"
This reverts commit 122c89b. Change does not build, with errors such as: In file included from ../llvm-project/llvm/tools/dsymutil/DebugMap.h:24, from ../llvm-project/llvm/tools/dsymutil/DwarfLinkerForBinary.h:13, from ../llvm-project/llvm/tools/dsymutil/DwarfLinkerForBinary.cpp:9: ../llvm-project/llvm/tools/dsymutil/RelocationMap.h:60:17: error: declaration of ‘llvm::dsymutil::SymbolMapping llvm::dsymutil::ValidReloc::SymbolMapping’ changes meaning of ‘SymbolMapping’ [-fpermissive] 60 | SymbolMapping SymbolMapping; | ^~~~~~~~~~~~~ ../llvm-project/llvm/tools/dsymutil/RelocationMap.h:36:8: note: ‘SymbolMapping’ declared here as ‘struct llvm::dsymutil::SymbolMapping’ 36 | struct SymbolMapping { | ^~~~~~~~~~~~~ In file included from ../llvm-project/llvm/tools/dsymutil/DwarfLinkerForBinary.h:13, from ../llvm-project/llvm/tools/dsymutil/DwarfLinkerForBinary.cpp:9: ../llvm-project/llvm/tools/dsymutil/DebugMap.h:198:32: error: declaration of ‘std::optional<llvm::dsymutil::RelocationMap> llvm::dsymutil::DebugMapObject::RelocationMap’ changes meaning of ‘RelocationMap’ [-fpermissive] 198 | std::optional<RelocationMap> RelocationMap; | ^~~~~~~~~~~~~ In file included from ../llvm-project/llvm/tools/dsymutil/DebugMap.h:24, from ../llvm-project/llvm/tools/dsymutil/DwarfLinkerForBinary.h:13, from ../llvm-project/llvm/tools/dsymutil/DwarfLinkerForBinary.cpp:9: ../llvm-project/llvm/tools/dsymutil/RelocationMap.h:76:7: note: ‘RelocationMap’ declared here as ‘class llvm::dsymutil::RelocationMap’ 76 | class RelocationMap { | ^~~~~~~~~~~~~
1 parent 3a72bcb commit 717946f

File tree

34 files changed

+198
-1217
lines changed

34 files changed

+198
-1217
lines changed

llvm/docs/CommandGuide/dsymutil.rst

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,11 @@ OPTIONS
3232
architectures will be linked by default and any architectures that can't be
3333
properly linked will cause :program:`dsymutil` to return an error.
3434

35-
.. option:: --build-variant-suffix <suffix=buildvariant>
36-
37-
Specify the build variant suffix used to build the executabe file.
38-
There can be multiple variants for the binary of a product, each built
39-
slightly differently. The most common build variants are 'debug' and
40-
'profile'. Setting the DYLD_IMAGE_SUFFIX environment variable will
41-
cause dyld to load the specified variant at runtime.
42-
4335
.. option:: --dump-debug-map
4436

4537
Dump the *executable*'s debug-map (the list of the object files containing the
4638
debug information) in YAML format and exit. No DWARF link will take place.
4739

48-
.. option:: -D <path>
49-
50-
Specify a directory that contain dSYM files to search for.
51-
This is used for mergeable libraries, so dsymutil knows where to look
52-
for dSYM files with debug information about symbols present in those
53-
libraries.
54-
5540
.. option:: --fat64
5641

5742
Use a 64-bit header when emitting universal binaries.

llvm/include/llvm/BinaryFormat/Dwarf.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,6 @@ HANDLE_DW_AT(0x3fec, APPLE_objc_complete_type, 0, APPLE)
629629
HANDLE_DW_AT(0x3fed, APPLE_property, 0, APPLE)
630630
HANDLE_DW_AT(0x3fee, APPLE_objc_direct, 0, APPLE)
631631
HANDLE_DW_AT(0x3fef, APPLE_sdk, 0, APPLE)
632-
HANDLE_DW_AT(0x3ff0, APPLE_origin, 0, APPLE)
633632

634633
// Attribute form encodings.
635634
HANDLE_DW_FORM(0x01, addr, 2, DWARF)

llvm/include/llvm/BinaryFormat/MachO.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,6 @@ enum StabType {
373373
N_SSYM = 0x60u,
374374
N_SO = 0x64u,
375375
N_OSO = 0x66u,
376-
N_LIB = 0x68u,
377376
N_LSYM = 0x80u,
378377
N_BINCL = 0x82u,
379378
N_SOL = 0x84u,

llvm/include/llvm/DWARFLinker/DWARFLinker.h

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -62,33 +62,13 @@ class AddressesMap {
6262
virtual std::optional<int64_t>
6363
getSubprogramRelocAdjustment(const DWARFDie &DIE) = 0;
6464

65-
/// Returns the file name associated to the AddessesMap
66-
virtual std::optional<StringRef> getLibraryInstallName() = 0;
67-
6865
/// Apply the valid relocations to the buffer \p Data, taking into
6966
/// account that Data is at \p BaseOffset in the .debug_info section.
7067
///
7168
/// \returns true whether any reloc has been applied.
7269
virtual bool applyValidRelocs(MutableArrayRef<char> Data, uint64_t BaseOffset,
7370
bool IsLittleEndian) = 0;
7471

75-
/// Check if the linker needs to gather and save relocation info.
76-
virtual bool needToSaveValidRelocs() = 0;
77-
78-
/// Update and save original relocations located in between StartOffset and
79-
/// EndOffset. LinkedOffset is the value which should be added to the original
80-
/// relocation offset to get new relocation offset in linked binary.
81-
virtual void updateAndSaveValidRelocs(bool IsDWARF5,
82-
uint64_t OriginalUnitOffset,
83-
int64_t LinkedOffset,
84-
uint64_t StartOffset,
85-
uint64_t EndOffset) = 0;
86-
87-
/// Update the valid relocations that used OriginalUnitOffset as the compile
88-
/// unit offset, and update their values to reflect OutputUnitOffset.
89-
virtual void updateRelocationsWithUnitOffset(uint64_t OriginalUnitOffset,
90-
uint64_t OutputUnitOffset) = 0;
91-
9272
/// Erases all data.
9373
virtual void clear() = 0;
9474
};
@@ -772,9 +752,6 @@ class DWARFLinker {
772752
/// Is there a DW_AT_str_offsets_base in the CU?
773753
bool AttrStrOffsetBaseSeen = false;
774754

775-
/// Is there a DW_AT_APPLE_origin in the CU?
776-
bool HasAppleOrigin = false;
777-
778755
AttributesInfo() = default;
779756
};
780757

llvm/include/llvm/DWARFLinkerParallel/AddressesMap.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -55,31 +55,13 @@ class AddressesMap {
5555
virtual std::optional<int64_t>
5656
getSubprogramRelocAdjustment(const DWARFDie &DIE) = 0;
5757

58-
// Returns the library install name associated to the AddessesMap.
59-
virtual std::optional<StringRef> getLibraryInstallName() = 0;
60-
6158
/// Apply the valid relocations to the buffer \p Data, taking into
6259
/// account that Data is at \p BaseOffset in the .debug_info section.
6360
///
6461
/// \returns true whether any reloc has been applied.
6562
virtual bool applyValidRelocs(MutableArrayRef<char> Data, uint64_t BaseOffset,
6663
bool IsLittleEndian) = 0;
6764

68-
/// Check if the linker needs to gather and save relocation info.
69-
virtual bool needToSaveValidRelocs() = 0;
70-
71-
/// Update and save relocation values to be serialized
72-
virtual void updateAndSaveValidRelocs(bool IsDWARF5,
73-
uint64_t OriginalUnitOffset,
74-
int64_t LinkedOffset,
75-
uint64_t StartOffset,
76-
uint64_t EndOffset) = 0;
77-
78-
/// Update the valid relocations that used OriginalUnitOffset as the compile
79-
/// unit offset, and update their values to reflect OutputUnitOffset.
80-
virtual void updateRelocationsWithUnitOffset(uint64_t OriginalUnitOffset,
81-
uint64_t OutputUnitOffset) = 0;
82-
8365
/// Erases all data.
8466
virtual void clear() = 0;
8567

llvm/include/llvm/TargetParser/Triple.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,9 @@ class Triple {
418418
/// Get the architecture (first) component of the triple.
419419
StringRef getArchName() const;
420420

421+
/// Get the architecture name based on Kind and SubArch.
422+
StringRef getArchName(ArchType Kind, SubArchType SubArch = NoSubArch) const;
423+
421424
/// Get the vendor (second) component of the triple.
422425
StringRef getVendorName() const;
423426

@@ -1115,9 +1118,6 @@ class Triple {
11151118
/// Get the canonical name for the \p Kind architecture.
11161119
static StringRef getArchTypeName(ArchType Kind);
11171120

1118-
/// Get the architecture name based on \p Kind and \p SubArch.
1119-
static StringRef getArchName(ArchType Kind, SubArchType SubArch = NoSubArch);
1120-
11211121
/// Get the "prefix" canonical name for the \p Kind architecture. This is the
11221122
/// prefix used by the architecture specific builtins, and is suitable for
11231123
/// passing to \see Intrinsic::getIntrinsicForClangBuiltin().

llvm/lib/DWARFLinker/DWARFLinker.cpp

Lines changed: 4 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,15 +1026,6 @@ unsigned DWARFLinker::DIECloner::cloneStringAttribute(DIE &Die,
10261026
StringEntry = DebugLineStrPool.getEntry(*String);
10271027
} else {
10281028
StringEntry = DebugStrPool.getEntry(*String);
1029-
1030-
if (AttrSpec.Attr == dwarf::DW_AT_APPLE_origin) {
1031-
Info.HasAppleOrigin = true;
1032-
if (std::optional<StringRef> FileName =
1033-
ObjFile.Addresses->getLibraryInstallName()) {
1034-
StringEntry = DebugStrPool.getEntry(*FileName);
1035-
}
1036-
}
1037-
10381029
// Update attributes info.
10391030
if (AttrSpec.Attr == dwarf::DW_AT_name)
10401031
Info.Name = StringEntry;
@@ -1646,12 +1637,6 @@ shouldSkipAttribute(bool Update,
16461637
}
16471638
}
16481639

1649-
struct AttributeLinkedOffsetFixup {
1650-
int64_t LinkedOffsetFixupVal;
1651-
uint64_t InputAttrStartOffset;
1652-
uint64_t InputAttrEndOffset;
1653-
};
1654-
16551640
DIE *DWARFLinker::DIECloner::cloneDIE(const DWARFDie &InputDIE,
16561641
const DWARFFile &File, CompileUnit &Unit,
16571642
int64_t PCOffset, uint32_t OutOffset,
@@ -1735,51 +1720,24 @@ DIE *DWARFLinker::DIECloner::cloneDIE(const DWARFDie &InputDIE,
17351720
Flags |= TF_SkipPC;
17361721
}
17371722

1738-
std::optional<StringRef> LibraryInstallName =
1739-
ObjFile.Addresses->getLibraryInstallName();
1740-
SmallVector<AttributeLinkedOffsetFixup> AttributesFixups;
17411723
for (const auto &AttrSpec : Abbrev->attributes()) {
17421724
if (shouldSkipAttribute(Update, AttrSpec, Flags & TF_SkipPC)) {
17431725
DWARFFormValue::skipValue(AttrSpec.Form, Data, &Offset,
17441726
U.getFormParams());
17451727
continue;
17461728
}
17471729

1748-
AttributeLinkedOffsetFixup CurAttrFixup;
1749-
CurAttrFixup.InputAttrStartOffset = InputDIE.getOffset() + Offset;
1750-
CurAttrFixup.LinkedOffsetFixupVal =
1751-
Unit.getStartOffset() + OutOffset - CurAttrFixup.InputAttrStartOffset;
1752-
17531730
DWARFFormValue Val = AttrSpec.getFormValue();
17541731
uint64_t AttrSize = Offset;
17551732
Val.extractValue(Data, &Offset, U.getFormParams(), &U);
1756-
CurAttrFixup.InputAttrEndOffset = InputDIE.getOffset() + Offset;
17571733
AttrSize = Offset - AttrSize;
17581734

1759-
uint64_t FinalAttrSize =
1760-
cloneAttribute(*Die, InputDIE, File, Unit, Val, AttrSpec, AttrSize,
1761-
AttrInfo, IsLittleEndian);
1762-
if (FinalAttrSize != 0 && ObjFile.Addresses->needToSaveValidRelocs())
1763-
AttributesFixups.push_back(CurAttrFixup);
1764-
1765-
OutOffset += FinalAttrSize;
1766-
}
1767-
1768-
uint16_t Tag = InputDIE.getTag();
1769-
// Add the DW_AT_APPLE_origin attribute to Compile Unit die if we have
1770-
// an install name and the DWARF doesn't have the attribute yet.
1771-
const bool NeedsAppleOrigin = (Tag == dwarf::DW_TAG_compile_unit) &&
1772-
LibraryInstallName.has_value() &&
1773-
!AttrInfo.HasAppleOrigin;
1774-
if (NeedsAppleOrigin) {
1775-
auto StringEntry = DebugStrPool.getEntry(LibraryInstallName.value());
1776-
Die->addValue(DIEAlloc, dwarf::Attribute(dwarf::DW_AT_APPLE_origin),
1777-
dwarf::DW_FORM_strp, DIEInteger(StringEntry.getOffset()));
1778-
AttrInfo.Name = StringEntry;
1779-
OutOffset += 4;
1735+
OutOffset += cloneAttribute(*Die, InputDIE, File, Unit, Val, AttrSpec,
1736+
AttrSize, AttrInfo, IsLittleEndian);
17801737
}
17811738

17821739
// Look for accelerator entries.
1740+
uint16_t Tag = InputDIE.getTag();
17831741
// FIXME: This is slightly wrong. An inline_subroutine without a
17841742
// low_pc, but with AT_ranges might be interesting to get into the
17851743
// accelerator tables too. For now stick with dsymutil's behavior.
@@ -1848,19 +1806,8 @@ DIE *DWARFLinker::DIECloner::cloneDIE(const DWARFDie &InputDIE,
18481806
Linker.assignAbbrev(NewAbbrev);
18491807
Die->setAbbrevNumber(NewAbbrev.getNumber());
18501808

1851-
uint64_t AbbrevNumberSize = getULEB128Size(Die->getAbbrevNumber());
1852-
18531809
// Add the size of the abbreviation number to the output offset.
1854-
OutOffset += AbbrevNumberSize;
1855-
1856-
// Update fixups with the size of the abbreviation number
1857-
for (AttributeLinkedOffsetFixup &F : AttributesFixups)
1858-
F.LinkedOffsetFixupVal += AbbrevNumberSize;
1859-
1860-
for (AttributeLinkedOffsetFixup &F : AttributesFixups)
1861-
ObjFile.Addresses->updateAndSaveValidRelocs(
1862-
Unit.getOrigUnit().getVersion() >= 5, Unit.getOrigUnit().getOffset(),
1863-
F.LinkedOffsetFixupVal, F.InputAttrStartOffset, F.InputAttrEndOffset);
1810+
OutOffset += getULEB128Size(Die->getAbbrevNumber());
18641811

18651812
if (!HasChildren) {
18661813
// Update our size.

llvm/lib/TargetParser/Triple.cpp

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -90,36 +90,6 @@ StringRef Triple::getArchTypeName(ArchType Kind) {
9090
llvm_unreachable("Invalid ArchType!");
9191
}
9292

93-
StringRef Triple::getArchName(ArchType Kind, SubArchType SubArch) {
94-
switch (Kind) {
95-
case Triple::mips:
96-
if (SubArch == MipsSubArch_r6)
97-
return "mipsisa32r6";
98-
break;
99-
case Triple::mipsel:
100-
if (SubArch == MipsSubArch_r6)
101-
return "mipsisa32r6el";
102-
break;
103-
case Triple::mips64:
104-
if (SubArch == MipsSubArch_r6)
105-
return "mipsisa64r6";
106-
break;
107-
case Triple::mips64el:
108-
if (SubArch == MipsSubArch_r6)
109-
return "mipsisa64r6el";
110-
break;
111-
case Triple::aarch64:
112-
if (SubArch == AArch64SubArch_arm64ec)
113-
return "arm64ec";
114-
if (SubArch == AArch64SubArch_arm64e)
115-
return "arm64e";
116-
break;
117-
default:
118-
break;
119-
}
120-
return getArchTypeName(Kind);
121-
}
122-
12393
StringRef Triple::getArchTypePrefix(ArchType Kind) {
12494
switch (Kind) {
12595
default:
@@ -1173,6 +1143,34 @@ StringRef Triple::getArchName() const {
11731143
return StringRef(Data).split('-').first; // Isolate first component
11741144
}
11751145

1146+
StringRef Triple::getArchName(ArchType Kind, SubArchType SubArch) const {
1147+
switch (Kind) {
1148+
case Triple::mips:
1149+
if (SubArch == MipsSubArch_r6)
1150+
return "mipsisa32r6";
1151+
break;
1152+
case Triple::mipsel:
1153+
if (SubArch == MipsSubArch_r6)
1154+
return "mipsisa32r6el";
1155+
break;
1156+
case Triple::mips64:
1157+
if (SubArch == MipsSubArch_r6)
1158+
return "mipsisa64r6";
1159+
break;
1160+
case Triple::mips64el:
1161+
if (SubArch == MipsSubArch_r6)
1162+
return "mipsisa64r6el";
1163+
break;
1164+
case Triple::aarch64:
1165+
if (SubArch == AArch64SubArch_arm64ec)
1166+
return "arm64ec";
1167+
break;
1168+
default:
1169+
break;
1170+
}
1171+
return getArchTypeName(Kind);
1172+
}
1173+
11761174
StringRef Triple::getVendorName() const {
11771175
StringRef Tmp = StringRef(Data).split('-').second; // Strip first component
11781176
return Tmp.split('-').first; // Isolate second component

llvm/test/tools/dsymutil/Inputs/bar-relink-variant.dylib.dSYM/Contents/Info.plist

Lines changed: 0 additions & 20 deletions
This file was deleted.

llvm/test/tools/dsymutil/Inputs/bar-relink-variant.dylib.dSYM/Contents/Resources/Relocations/aarch64/bar-relink-variant.dylib.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.

llvm/test/tools/dsymutil/Inputs/bar-relink.dylib.dSYM/Contents/Info.plist

Lines changed: 0 additions & 20 deletions
This file was deleted.

llvm/test/tools/dsymutil/Inputs/bar-relink.dylib.dSYM/Contents/Resources/Relocations/aarch64/bar-relink.dylib.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.

llvm/test/tools/dsymutil/Inputs/foo-relink-variant.dylib.dSYM/Contents/Info.plist

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)