[llvm] Reland [dsymutil] Add support for mergeable libraries (PR #70256)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 25 15:54:38 PDT 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-debuginfo
Author: Alpha Abdoulaye (Alpha-10000)
<details>
<summary>Changes</summary>
Reland https://reviews.llvm.org/D158124
Fixed `-fpermissive` error reported by gcc only.
---
Patch is 90.38 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/70256.diff
44 Files Affected:
- (modified) llvm/docs/CommandGuide/dsymutil.rst (+15)
- (modified) llvm/include/llvm/BinaryFormat/Dwarf.def (+1)
- (modified) llvm/include/llvm/BinaryFormat/MachO.h (+1)
- (modified) llvm/include/llvm/DWARFLinker/DWARFLinker.h (+23)
- (modified) llvm/include/llvm/DWARFLinkerParallel/AddressesMap.h (+18)
- (modified) llvm/include/llvm/TargetParser/Triple.h (+3-3)
- (modified) llvm/lib/DWARFLinker/DWARFLinker.cpp (+57-4)
- (modified) llvm/lib/TargetParser/Triple.cpp (+30-28)
- (added) llvm/test/tools/dsymutil/Inputs/bar-relink-variant.dylib.dSYM/Contents/Info.plist (+20)
- (added) llvm/test/tools/dsymutil/Inputs/bar-relink-variant.dylib.dSYM/Contents/Resources/DWARF/bar-relink-variant.dylib ()
- (added) llvm/test/tools/dsymutil/Inputs/bar-relink-variant.dylib.dSYM/Contents/Resources/Relocations/aarch64/bar-relink-variant.dylib.yml (+8)
- (added) llvm/test/tools/dsymutil/Inputs/bar-relink.dylib.dSYM/Contents/Info.plist (+20)
- (added) llvm/test/tools/dsymutil/Inputs/bar-relink.dylib.dSYM/Contents/Resources/DWARF/bar-relink.dylib ()
- (added) llvm/test/tools/dsymutil/Inputs/bar-relink.dylib.dSYM/Contents/Resources/Relocations/aarch64/bar-relink.dylib.yml (+8)
- (added) llvm/test/tools/dsymutil/Inputs/basic-relink.macho.arm64.dylib ()
- (added) llvm/test/tools/dsymutil/Inputs/basic-relink.macho.arm64.o ()
- (added) llvm/test/tools/dsymutil/Inputs/foo-relink-variant.dylib.dSYM/Contents/Info.plist (+20)
- (added) llvm/test/tools/dsymutil/Inputs/foo-relink-variant.dylib.dSYM/Contents/Resources/DWARF/foo-relink-variant.dylib ()
- (added) llvm/test/tools/dsymutil/Inputs/foo-relink-variant.dylib.dSYM/Contents/Resources/DWARF/foo-relink-variant_debug.dylib ()
- (added) llvm/test/tools/dsymutil/Inputs/foo-relink-variant.dylib.dSYM/Contents/Resources/Relocations/aarch64/foo-relink-variant.dylib.yml (+9)
- (added) llvm/test/tools/dsymutil/Inputs/foo-relink.dylib.dSYM/Contents/Info.plist (+20)
- (added) llvm/test/tools/dsymutil/Inputs/foo-relink.dylib.dSYM/Contents/Resources/DWARF/foo-relink.dylib ()
- (added) llvm/test/tools/dsymutil/Inputs/foo-relink.dylib.dSYM/Contents/Resources/Relocations/aarch64/foo-relink.dylib.yml (+10)
- (added) llvm/test/tools/dsymutil/Inputs/proxy-relink.dylib.dSYM/Contents/Info.plist (+20)
- (added) llvm/test/tools/dsymutil/Inputs/proxy-relink.dylib.dSYM/Contents/Resources/DWARF/proxy-relink.dylib ()
- (added) llvm/test/tools/dsymutil/Inputs/proxy-relink.dylib.dSYM/Contents/Resources/Relocations/aarch64/proxy-relink.dylib.yml (+14)
- (added) llvm/test/tools/dsymutil/Inputs/two-level-relink.macho.arm64.dylib ()
- (added) llvm/test/tools/dsymutil/Inputs/variant-relink.macho.arm64.dylib ()
- (modified) llvm/test/tools/dsymutil/basic-linking.test (+122)
- (modified) llvm/test/tools/dsymutil/cmdline.test (+2)
- (modified) llvm/tools/dsymutil/CMakeLists.txt (+1)
- (modified) llvm/tools/dsymutil/DebugMap.cpp (+20-3)
- (modified) llvm/tools/dsymutil/DebugMap.h (+17-27)
- (modified) llvm/tools/dsymutil/DwarfLinkerForBinary.cpp (+158-44)
- (modified) llvm/tools/dsymutil/DwarfLinkerForBinary.h (+89-23)
- (modified) llvm/tools/dsymutil/LinkUtils.h (+6)
- (modified) llvm/tools/dsymutil/MachODebugMapParser.cpp (+197-29)
- (modified) llvm/tools/dsymutil/Options.td (+11)
- (added) llvm/tools/dsymutil/RelocationMap.cpp (+92)
- (added) llvm/tools/dsymutil/RelocationMap.h (+160)
- (modified) llvm/tools/dsymutil/dsymutil.cpp (+14-5)
- (modified) llvm/tools/dsymutil/dsymutil.h (+4-2)
- (modified) llvm/tools/llvm-dwarfutil/DebugInfoLinker.cpp (+12)
- (modified) llvm/tools/llvm-nm/llvm-nm.cpp (+16-31)
``````````diff
diff --git a/llvm/docs/CommandGuide/dsymutil.rst b/llvm/docs/CommandGuide/dsymutil.rst
index 02243e227a24d4a..df621a429bb5c38 100644
--- a/llvm/docs/CommandGuide/dsymutil.rst
+++ b/llvm/docs/CommandGuide/dsymutil.rst
@@ -32,11 +32,26 @@ OPTIONS
architectures will be linked by default and any architectures that can't be
properly linked will cause :program:`dsymutil` to return an error.
+.. option:: --build-variant-suffix <suffix=buildvariant>
+
+ Specify the build variant suffix used to build the executabe file.
+ There can be multiple variants for the binary of a product, each built
+ slightly differently. The most common build variants are 'debug' and
+ 'profile'. Setting the DYLD_IMAGE_SUFFIX environment variable will
+ cause dyld to load the specified variant at runtime.
+
.. option:: --dump-debug-map
Dump the *executable*'s debug-map (the list of the object files containing the
debug information) in YAML format and exit. No DWARF link will take place.
+ .. option:: -D <path>
+
+ Specify a directory that contain dSYM files to search for.
+ This is used for mergeable libraries, so dsymutil knows where to look
+ for dSYM files with debug information about symbols present in those
+ libraries.
+
.. option:: --fat64
Use a 64-bit header when emitting universal binaries.
diff --git a/llvm/include/llvm/BinaryFormat/Dwarf.def b/llvm/include/llvm/BinaryFormat/Dwarf.def
index fb328a025773252..d1abb1f361d3edf 100644
--- a/llvm/include/llvm/BinaryFormat/Dwarf.def
+++ b/llvm/include/llvm/BinaryFormat/Dwarf.def
@@ -629,6 +629,7 @@ HANDLE_DW_AT(0x3fec, APPLE_objc_complete_type, 0, APPLE)
HANDLE_DW_AT(0x3fed, APPLE_property, 0, APPLE)
HANDLE_DW_AT(0x3fee, APPLE_objc_direct, 0, APPLE)
HANDLE_DW_AT(0x3fef, APPLE_sdk, 0, APPLE)
+HANDLE_DW_AT(0x3ff0, APPLE_origin, 0, APPLE)
// Attribute form encodings.
HANDLE_DW_FORM(0x01, addr, 2, DWARF)
diff --git a/llvm/include/llvm/BinaryFormat/MachO.h b/llvm/include/llvm/BinaryFormat/MachO.h
index 49991ebe7bfaf27..bef70f869520b78 100644
--- a/llvm/include/llvm/BinaryFormat/MachO.h
+++ b/llvm/include/llvm/BinaryFormat/MachO.h
@@ -373,6 +373,7 @@ enum StabType {
N_SSYM = 0x60u,
N_SO = 0x64u,
N_OSO = 0x66u,
+ N_LIB = 0x68u,
N_LSYM = 0x80u,
N_BINCL = 0x82u,
N_SOL = 0x84u,
diff --git a/llvm/include/llvm/DWARFLinker/DWARFLinker.h b/llvm/include/llvm/DWARFLinker/DWARFLinker.h
index e5797514165a22b..a5721184a6a2f09 100644
--- a/llvm/include/llvm/DWARFLinker/DWARFLinker.h
+++ b/llvm/include/llvm/DWARFLinker/DWARFLinker.h
@@ -62,6 +62,9 @@ class AddressesMap {
virtual std::optional<int64_t>
getSubprogramRelocAdjustment(const DWARFDie &DIE) = 0;
+ /// Returns the file name associated to the AddessesMap
+ virtual std::optional<StringRef> getLibraryInstallName() = 0;
+
/// Apply the valid relocations to the buffer \p Data, taking into
/// account that Data is at \p BaseOffset in the .debug_info section.
///
@@ -69,6 +72,23 @@ class AddressesMap {
virtual bool applyValidRelocs(MutableArrayRef<char> Data, uint64_t BaseOffset,
bool IsLittleEndian) = 0;
+ /// Check if the linker needs to gather and save relocation info.
+ virtual bool needToSaveValidRelocs() = 0;
+
+ /// Update and save original relocations located in between StartOffset and
+ /// EndOffset. LinkedOffset is the value which should be added to the original
+ /// relocation offset to get new relocation offset in linked binary.
+ virtual void updateAndSaveValidRelocs(bool IsDWARF5,
+ uint64_t OriginalUnitOffset,
+ int64_t LinkedOffset,
+ uint64_t StartOffset,
+ uint64_t EndOffset) = 0;
+
+ /// Update the valid relocations that used OriginalUnitOffset as the compile
+ /// unit offset, and update their values to reflect OutputUnitOffset.
+ virtual void updateRelocationsWithUnitOffset(uint64_t OriginalUnitOffset,
+ uint64_t OutputUnitOffset) = 0;
+
/// Erases all data.
virtual void clear() = 0;
};
@@ -752,6 +772,9 @@ class DWARFLinker {
/// Is there a DW_AT_str_offsets_base in the CU?
bool AttrStrOffsetBaseSeen = false;
+ /// Is there a DW_AT_APPLE_origin in the CU?
+ bool HasAppleOrigin = false;
+
AttributesInfo() = default;
};
diff --git a/llvm/include/llvm/DWARFLinkerParallel/AddressesMap.h b/llvm/include/llvm/DWARFLinkerParallel/AddressesMap.h
index 22fbec20d7d3766..b451fee4e0b723a 100644
--- a/llvm/include/llvm/DWARFLinkerParallel/AddressesMap.h
+++ b/llvm/include/llvm/DWARFLinkerParallel/AddressesMap.h
@@ -55,6 +55,9 @@ class AddressesMap {
virtual std::optional<int64_t>
getSubprogramRelocAdjustment(const DWARFDie &DIE) = 0;
+ // Returns the library install name associated to the AddessesMap.
+ virtual std::optional<StringRef> getLibraryInstallName() = 0;
+
/// Apply the valid relocations to the buffer \p Data, taking into
/// account that Data is at \p BaseOffset in the .debug_info section.
///
@@ -62,6 +65,21 @@ class AddressesMap {
virtual bool applyValidRelocs(MutableArrayRef<char> Data, uint64_t BaseOffset,
bool IsLittleEndian) = 0;
+ /// Check if the linker needs to gather and save relocation info.
+ virtual bool needToSaveValidRelocs() = 0;
+
+ /// Update and save relocation values to be serialized
+ virtual void updateAndSaveValidRelocs(bool IsDWARF5,
+ uint64_t OriginalUnitOffset,
+ int64_t LinkedOffset,
+ uint64_t StartOffset,
+ uint64_t EndOffset) = 0;
+
+ /// Update the valid relocations that used OriginalUnitOffset as the compile
+ /// unit offset, and update their values to reflect OutputUnitOffset.
+ virtual void updateRelocationsWithUnitOffset(uint64_t OriginalUnitOffset,
+ uint64_t OutputUnitOffset) = 0;
+
/// Erases all data.
virtual void clear() = 0;
diff --git a/llvm/include/llvm/TargetParser/Triple.h b/llvm/include/llvm/TargetParser/Triple.h
index 53cef0abbe0e139..0f56ac68c851f67 100644
--- a/llvm/include/llvm/TargetParser/Triple.h
+++ b/llvm/include/llvm/TargetParser/Triple.h
@@ -418,9 +418,6 @@ class Triple {
/// Get the architecture (first) component of the triple.
StringRef getArchName() const;
- /// Get the architecture name based on Kind and SubArch.
- StringRef getArchName(ArchType Kind, SubArchType SubArch = NoSubArch) const;
-
/// Get the vendor (second) component of the triple.
StringRef getVendorName() const;
@@ -1118,6 +1115,9 @@ class Triple {
/// Get the canonical name for the \p Kind architecture.
static StringRef getArchTypeName(ArchType Kind);
+ /// Get the architecture name based on \p Kind and \p SubArch.
+ static StringRef getArchName(ArchType Kind, SubArchType SubArch = NoSubArch);
+
/// Get the "prefix" canonical name for the \p Kind architecture. This is the
/// prefix used by the architecture specific builtins, and is suitable for
/// passing to \see Intrinsic::getIntrinsicForClangBuiltin().
diff --git a/llvm/lib/DWARFLinker/DWARFLinker.cpp b/llvm/lib/DWARFLinker/DWARFLinker.cpp
index 2d8360f100c1172..80a4e2adefa6cb6 100644
--- a/llvm/lib/DWARFLinker/DWARFLinker.cpp
+++ b/llvm/lib/DWARFLinker/DWARFLinker.cpp
@@ -1026,6 +1026,15 @@ unsigned DWARFLinker::DIECloner::cloneStringAttribute(DIE &Die,
StringEntry = DebugLineStrPool.getEntry(*String);
} else {
StringEntry = DebugStrPool.getEntry(*String);
+
+ if (AttrSpec.Attr == dwarf::DW_AT_APPLE_origin) {
+ Info.HasAppleOrigin = true;
+ if (std::optional<StringRef> FileName =
+ ObjFile.Addresses->getLibraryInstallName()) {
+ StringEntry = DebugStrPool.getEntry(*FileName);
+ }
+ }
+
// Update attributes info.
if (AttrSpec.Attr == dwarf::DW_AT_name)
Info.Name = StringEntry;
@@ -1637,6 +1646,12 @@ shouldSkipAttribute(bool Update,
}
}
+struct AttributeLinkedOffsetFixup {
+ int64_t LinkedOffsetFixupVal;
+ uint64_t InputAttrStartOffset;
+ uint64_t InputAttrEndOffset;
+};
+
DIE *DWARFLinker::DIECloner::cloneDIE(const DWARFDie &InputDIE,
const DWARFFile &File, CompileUnit &Unit,
int64_t PCOffset, uint32_t OutOffset,
@@ -1720,6 +1735,9 @@ DIE *DWARFLinker::DIECloner::cloneDIE(const DWARFDie &InputDIE,
Flags |= TF_SkipPC;
}
+ std::optional<StringRef> LibraryInstallName =
+ ObjFile.Addresses->getLibraryInstallName();
+ SmallVector<AttributeLinkedOffsetFixup> AttributesFixups;
for (const auto &AttrSpec : Abbrev->attributes()) {
if (shouldSkipAttribute(Update, AttrSpec, Flags & TF_SkipPC)) {
DWARFFormValue::skipValue(AttrSpec.Form, Data, &Offset,
@@ -1727,17 +1745,41 @@ DIE *DWARFLinker::DIECloner::cloneDIE(const DWARFDie &InputDIE,
continue;
}
+ AttributeLinkedOffsetFixup CurAttrFixup;
+ CurAttrFixup.InputAttrStartOffset = InputDIE.getOffset() + Offset;
+ CurAttrFixup.LinkedOffsetFixupVal =
+ Unit.getStartOffset() + OutOffset - CurAttrFixup.InputAttrStartOffset;
+
DWARFFormValue Val = AttrSpec.getFormValue();
uint64_t AttrSize = Offset;
Val.extractValue(Data, &Offset, U.getFormParams(), &U);
+ CurAttrFixup.InputAttrEndOffset = InputDIE.getOffset() + Offset;
AttrSize = Offset - AttrSize;
- OutOffset += cloneAttribute(*Die, InputDIE, File, Unit, Val, AttrSpec,
- AttrSize, AttrInfo, IsLittleEndian);
+ uint64_t FinalAttrSize =
+ cloneAttribute(*Die, InputDIE, File, Unit, Val, AttrSpec, AttrSize,
+ AttrInfo, IsLittleEndian);
+ if (FinalAttrSize != 0 && ObjFile.Addresses->needToSaveValidRelocs())
+ AttributesFixups.push_back(CurAttrFixup);
+
+ OutOffset += FinalAttrSize;
}
- // Look for accelerator entries.
uint16_t Tag = InputDIE.getTag();
+ // Add the DW_AT_APPLE_origin attribute to Compile Unit die if we have
+ // an install name and the DWARF doesn't have the attribute yet.
+ const bool NeedsAppleOrigin = (Tag == dwarf::DW_TAG_compile_unit) &&
+ LibraryInstallName.has_value() &&
+ !AttrInfo.HasAppleOrigin;
+ if (NeedsAppleOrigin) {
+ auto StringEntry = DebugStrPool.getEntry(LibraryInstallName.value());
+ Die->addValue(DIEAlloc, dwarf::Attribute(dwarf::DW_AT_APPLE_origin),
+ dwarf::DW_FORM_strp, DIEInteger(StringEntry.getOffset()));
+ AttrInfo.Name = StringEntry;
+ OutOffset += 4;
+ }
+
+ // Look for accelerator entries.
// FIXME: This is slightly wrong. An inline_subroutine without a
// low_pc, but with AT_ranges might be interesting to get into the
// accelerator tables too. For now stick with dsymutil's behavior.
@@ -1806,8 +1848,19 @@ DIE *DWARFLinker::DIECloner::cloneDIE(const DWARFDie &InputDIE,
Linker.assignAbbrev(NewAbbrev);
Die->setAbbrevNumber(NewAbbrev.getNumber());
+ uint64_t AbbrevNumberSize = getULEB128Size(Die->getAbbrevNumber());
+
// Add the size of the abbreviation number to the output offset.
- OutOffset += getULEB128Size(Die->getAbbrevNumber());
+ OutOffset += AbbrevNumberSize;
+
+ // Update fixups with the size of the abbreviation number
+ for (AttributeLinkedOffsetFixup &F : AttributesFixups)
+ F.LinkedOffsetFixupVal += AbbrevNumberSize;
+
+ for (AttributeLinkedOffsetFixup &F : AttributesFixups)
+ ObjFile.Addresses->updateAndSaveValidRelocs(
+ Unit.getOrigUnit().getVersion() >= 5, Unit.getOrigUnit().getOffset(),
+ F.LinkedOffsetFixupVal, F.InputAttrStartOffset, F.InputAttrEndOffset);
if (!HasChildren) {
// Update our size.
diff --git a/llvm/lib/TargetParser/Triple.cpp b/llvm/lib/TargetParser/Triple.cpp
index b9fab469f747607..5d4eb79675f8916 100644
--- a/llvm/lib/TargetParser/Triple.cpp
+++ b/llvm/lib/TargetParser/Triple.cpp
@@ -90,6 +90,36 @@ StringRef Triple::getArchTypeName(ArchType Kind) {
llvm_unreachable("Invalid ArchType!");
}
+StringRef Triple::getArchName(ArchType Kind, SubArchType SubArch) {
+ switch (Kind) {
+ case Triple::mips:
+ if (SubArch == MipsSubArch_r6)
+ return "mipsisa32r6";
+ break;
+ case Triple::mipsel:
+ if (SubArch == MipsSubArch_r6)
+ return "mipsisa32r6el";
+ break;
+ case Triple::mips64:
+ if (SubArch == MipsSubArch_r6)
+ return "mipsisa64r6";
+ break;
+ case Triple::mips64el:
+ if (SubArch == MipsSubArch_r6)
+ return "mipsisa64r6el";
+ break;
+ case Triple::aarch64:
+ if (SubArch == AArch64SubArch_arm64ec)
+ return "arm64ec";
+ if (SubArch == AArch64SubArch_arm64e)
+ return "arm64e";
+ break;
+ default:
+ break;
+ }
+ return getArchTypeName(Kind);
+}
+
StringRef Triple::getArchTypePrefix(ArchType Kind) {
switch (Kind) {
default:
@@ -1143,34 +1173,6 @@ StringRef Triple::getArchName() const {
return StringRef(Data).split('-').first; // Isolate first component
}
-StringRef Triple::getArchName(ArchType Kind, SubArchType SubArch) const {
- switch (Kind) {
- case Triple::mips:
- if (SubArch == MipsSubArch_r6)
- return "mipsisa32r6";
- break;
- case Triple::mipsel:
- if (SubArch == MipsSubArch_r6)
- return "mipsisa32r6el";
- break;
- case Triple::mips64:
- if (SubArch == MipsSubArch_r6)
- return "mipsisa64r6";
- break;
- case Triple::mips64el:
- if (SubArch == MipsSubArch_r6)
- return "mipsisa64r6el";
- break;
- case Triple::aarch64:
- if (SubArch == AArch64SubArch_arm64ec)
- return "arm64ec";
- break;
- default:
- break;
- }
- return getArchTypeName(Kind);
-}
-
StringRef Triple::getVendorName() const {
StringRef Tmp = StringRef(Data).split('-').second; // Strip first component
return Tmp.split('-').first; // Isolate second component
diff --git a/llvm/test/tools/dsymutil/Inputs/bar-relink-variant.dylib.dSYM/Contents/Info.plist b/llvm/test/tools/dsymutil/Inputs/bar-relink-variant.dylib.dSYM/Contents/Info.plist
new file mode 100644
index 000000000000000..14d6272d3f8d97f
--- /dev/null
+++ b/llvm/test/tools/dsymutil/Inputs/bar-relink-variant.dylib.dSYM/Contents/Info.plist
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+ <dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.apple.xcode.dsym.bar-relink-variant.dylib</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>dSYM</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ </dict>
+</plist>
diff --git a/llvm/test/tools/dsymutil/Inputs/bar-relink-variant.dylib.dSYM/Contents/Resources/DWARF/bar-relink-variant.dylib b/llvm/test/tools/dsymutil/Inputs/bar-relink-variant.dylib.dSYM/Contents/Resources/DWARF/bar-relink-variant.dylib
new file mode 100644
index 000000000000000..ec2e06a231f8894
Binary files /dev/null and b/llvm/test/tools/dsymutil/Inputs/bar-relink-variant.dylib.dSYM/Contents/Resources/DWARF/bar-relink-variant.dylib differ
diff --git a/llvm/test/tools/dsymutil/Inputs/bar-relink-variant.dylib.dSYM/Contents/Resources/Relocations/aarch64/bar-relink-variant.dylib.yml b/llvm/test/tools/dsymutil/Inputs/bar-relink-variant.dylib.dSYM/Contents/Resources/Relocations/aarch64/bar-relink-variant.dylib.yml
new file mode 100644
index 000000000000000..68fd250cdf2a8a7
--- /dev/null
+++ b/llvm/test/tools/dsymutil/Inputs/bar-relink-variant.dylib.dSYM/Contents/Resources/Relocations/aarch64/bar-relink-variant.dylib.yml
@@ -0,0 +1,8 @@
+---
+triple: 'arm64-apple-darwin'
+binary-path: bar-relink-variant.dylib
+relocations:
+ - { offset: 0x26, size: 0x8, addend: 0x0, symName: _bar, symObjAddr: 0x0, symBinAddr: 0x3FA0, symSize: 0x8 }
+ - { offset: 0x3F, size: 0x8, addend: 0x0, symName: _baz, symObjAddr: 0x8, symBinAddr: 0x4000, symSize: 0x0 }
+ - { offset: 0x4F, size: 0x8, addend: 0x0, symName: _bar, symObjAddr: 0x0, symBinAddr: 0x3FA0, symSize: 0x8 }
+...
diff --git a/llvm/test/tools/dsymutil/Inputs/bar-relink.dylib.dSYM/Contents/Info.plist b/llvm/test/tools/dsymutil/Inputs/bar-relink.dylib.dSYM/Contents/Info.plist
new file mode 100644
index 000000000000000..37c2a8aebe4c6ff
--- /dev/null
+++ b/llvm/test/tools/dsymutil/Inputs/bar-relink.dylib.dSYM/Contents/Info.plist
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+ <dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.apple.xcode.dsym.bar-relink.dylib</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>dSYM</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ </dict>
+</plist>
diff --git a/llvm/test/tools/dsymutil/Inputs/bar-relink.dylib.dSYM/Contents/Resources/DWARF/bar-relink.dylib b/llvm/test/tools/dsymutil/Inputs/bar-relink.dylib.dSYM/Contents/Resources/DWARF/bar-relink.dylib
new file mode 100644
index 000000000000000..9ebd56ecb00a482
Binary files /dev/null and b/llvm/test/tools/dsymutil/Inputs/bar-relink.dylib.dSYM/Contents/Resources/DWARF/bar-relink.dylib differ
diff --git a/llvm/test/tools/dsymutil/Inputs/bar-relink.dylib.dSYM/Contents/Resources/Relocations/aarch64/bar-relink.dylib.yml b/llvm/test/tools/dsymutil/Inputs/bar-relink.dylib.dSYM/Contents/Resources/Relocations/aarch64/bar-relink.dylib.yml
new file mode 100644
index 000000000000000..d47e5f9e2e8d276
--- /dev/null
+++ b/llvm/test/tools/dsymutil/Inputs/bar-relink.dylib.dSYM/Contents/Resources/Relocations/aarch64/bar-relink.dylib.yml
@@ -0,0 +1,8 @@
+---
+triple: 'arm64-apple-darwin'
+binary-path: bar-relink.dylib
+relocations:
+ - { offset: 0x26, size: 0x8, addend: 0x0, symName: _bar, symObjAddr: 0x0, symBinAddr: 0x3FA0, symSize: 0x8 }
+ - { offset: 0x3F, size: 0x8, addend: 0x0, symName: _baz, symObjAddr: 0x8, symBinAddr: 0x4000, symSize: 0x0 }
+ - { offset: 0x4F, size: 0x8, addend: 0x0, symName: _bar, symObjAddr: 0x0, symBinAddr: 0x3FA0, symSize: 0x8 }
+...
diff --git a/llvm/test/tools/dsymutil/Inputs/basic-relink.macho.arm64.dylib b/llvm/test/tools/dsymutil/Inputs/basic-relink.macho.arm64.dylib
new file mode 100644
index 000000000000000..a813562d59671ca
Binary files /dev/null and b/llvm/test/tools/dsymutil/Inputs/basic-relink.macho.arm64.dylib differ
diff --git a/llvm/test/tools/dsymutil/Inputs/basic-relink.macho.arm64.o b/llvm/test/tools/dsymutil/Inputs/basic-relink.macho.arm64.o
new file mode 100644
index 000000000000000..b1b517d11172fd2
Binary files /dev/null and b/llvm/test/tools/dsymutil/Inputs/basic-relink.macho.arm64.o differ
diff --git a/llvm/test/tools/dsymutil/Inputs/foo-relink-variant.dylib.dSYM/Contents/Info.plist b/llvm/test/tools/dsymutil/Inputs/foo-relink-variant.dylib.dSYM/Contents/Info.plist
new file mode 100644
index 000000000000000..7e84e95bd3f48cc
--- /dev/null
+++ b/llvm/test/tools/dsymutil/Inputs/foo-relink-variant.dylib.dSYM/Contents/Info.plist
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+ <dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.apple.xcode.dsym.foo-relink-variant.dylib</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>dSYM</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ </dict>
+</plist>
diff --git a/llvm/test/tools...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/70256
More information about the llvm-commits
mailing list