[llvm] 5d07dc8 - [dsymutil] Don't emit .debug_pubnames and .debug_pubtypes
Jonas Devlieghere via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 6 19:01:52 PDT 2021
Author: Jonas Devlieghere
Date: 2021-04-06T19:01:45-07:00
New Revision: 5d07dc897707f877c45cab6c7e4b65dad7d3ff6d
URL: https://github.com/llvm/llvm-project/commit/5d07dc897707f877c45cab6c7e4b65dad7d3ff6d
DIFF: https://github.com/llvm/llvm-project/commit/5d07dc897707f877c45cab6c7e4b65dad7d3ff6d.diff
LOG: [dsymutil] Don't emit .debug_pubnames and .debug_pubtypes
Consider the .debug_pubnames and .debug_pubtypes their own kind of
accelerator and stop emitting them together with the Apple-style
accelerator tables. The only reason we were still emitting both was for
(byte-for-byte) compatibility with dsymutil-classic.
- This patch adds a new accelerator table kind "Pub" which can be
specified with --accelerator=Pub.
- This patch removes the ability to emit both pubnames/types and apple
style accelerator tables. I don't think anyone is relying on that but
it's worth pointing out.
- This patch removes the --minimize option and makes this behavior the
default. Specifying the flag will result in a warning but won't abort
the program.
Differential revision: https://reviews.llvm.org/D99907
Added:
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/obfuscated.test
llvm/test/tools/dsymutil/X86/basic-linking-bundle.test
llvm/test/tools/dsymutil/X86/basic-linking-x86.test
llvm/test/tools/dsymutil/X86/basic-lto-dw4-linking-x86.test
llvm/test/tools/dsymutil/X86/basic-lto-linking-x86.test
llvm/test/tools/dsymutil/X86/dsym-companion.test
llvm/test/tools/dsymutil/X86/update.test
llvm/test/tools/dsymutil/cmdline.test
llvm/tools/dsymutil/DwarfLinkerForBinary.cpp
llvm/tools/dsymutil/LinkUtils.h
llvm/tools/dsymutil/Options.td
llvm/tools/dsymutil/dsymutil.cpp
Removed:
llvm/test/tools/dsymutil/X86/minimize.test
################################################################################
diff --git a/llvm/include/llvm/DWARFLinker/DWARFLinker.h b/llvm/include/llvm/DWARFLinker/DWARFLinker.h
index 02fb97b58a076..1e35b9b717b6f 100644
--- a/llvm/include/llvm/DWARFLinker/DWARFLinker.h
+++ b/llvm/include/llvm/DWARFLinker/DWARFLinker.h
@@ -26,6 +26,7 @@ enum class AccelTableKind {
Apple, ///< .apple_names, .apple_namespaces, .apple_types, .apple_objc.
Dwarf, ///< DWARF v5 .debug_names.
Default, ///< Dwarf for DWARF5 or later, Apple otherwise.
+ Pub, ///< .debug_pubnames, .debug_pubtypes
};
/// Partial address range. Besides an offset, only the
@@ -708,6 +709,7 @@ class DWARFLinker {
void emitAcceleratorEntriesForUnit(CompileUnit &Unit);
void emitDwarfAcceleratorEntriesForUnit(CompileUnit &Unit);
void emitAppleAcceleratorEntriesForUnit(CompileUnit &Unit);
+ void emitPubAcceleratorEntriesForUnit(CompileUnit &Unit);
/// Patch the frame info for an object file and emit it.
void patchFrameInfoForObject(const DWARFFile &, RangesTy &Ranges,
diff --git a/llvm/include/llvm/DWARFLinker/DWARFStreamer.h b/llvm/include/llvm/DWARFLinker/DWARFStreamer.h
index 7b08511592523..9a5c6bcaf83f3 100644
--- a/llvm/include/llvm/DWARFLinker/DWARFStreamer.h
+++ b/llvm/include/llvm/DWARFLinker/DWARFStreamer.h
@@ -44,9 +44,9 @@ class DwarfStreamer : public DwarfEmitter {
public:
DwarfStreamer(OutputFileType OutFileType, raw_pwrite_stream &OutFile,
std::function<StringRef(StringRef Input)> Translator,
- bool Minimize, messageHandler Error, messageHandler Warning)
+ messageHandler Error, messageHandler Warning)
: OutFile(OutFile), OutFileType(OutFileType), Translator(Translator),
- Minimize(Minimize), ErrorHandler(Error), WarningHandler(Warning) {}
+ ErrorHandler(Error), WarningHandler(Warning) {}
bool init(Triple TheTriple);
@@ -189,7 +189,6 @@ class DwarfStreamer : public DwarfEmitter {
raw_pwrite_stream &OutFile;
OutputFileType OutFileType = OutputFileType::Object;
std::function<StringRef(StringRef Input)> Translator;
- bool Minimize = true;
uint64_t RangesSectionSize = 0;
uint64_t LocSectionSize = 0;
diff --git a/llvm/lib/DWARFLinker/DWARFLinker.cpp b/llvm/lib/DWARFLinker/DWARFLinker.cpp
index 453b746949900..6428598334c45 100644
--- a/llvm/lib/DWARFLinker/DWARFLinker.cpp
+++ b/llvm/lib/DWARFLinker/DWARFLinker.cpp
@@ -1794,6 +1794,9 @@ void DWARFLinker::emitAcceleratorEntriesForUnit(CompileUnit &Unit) {
case AccelTableKind::Dwarf:
emitDwarfAcceleratorEntriesForUnit(Unit);
break;
+ case AccelTableKind::Pub:
+ emitPubAcceleratorEntriesForUnit(Unit);
+ break;
case AccelTableKind::Default:
llvm_unreachable("The default must be updated to a concrete value.");
break;
@@ -1807,13 +1810,11 @@ void DWARFLinker::emitAppleAcceleratorEntriesForUnit(CompileUnit &Unit) {
Namespace.Die->getOffset() + Unit.getStartOffset());
/// Add names.
- TheDwarfEmitter->emitPubNamesForUnit(Unit);
for (const auto &Pubname : Unit.getPubnames())
AppleNames.addName(Pubname.Name,
Pubname.Die->getOffset() + Unit.getStartOffset());
/// Add types.
- TheDwarfEmitter->emitPubTypesForUnit(Unit);
for (const auto &Pubtype : Unit.getPubtypes())
AppleTypes.addName(
Pubtype.Name, Pubtype.Die->getOffset() + Unit.getStartOffset(),
@@ -1839,6 +1840,11 @@ void DWARFLinker::emitDwarfAcceleratorEntriesForUnit(CompileUnit &Unit) {
Pubtype.Die->getTag(), Unit.getUniqueID());
}
+void DWARFLinker::emitPubAcceleratorEntriesForUnit(CompileUnit &Unit) {
+ TheDwarfEmitter->emitPubNamesForUnit(Unit);
+ TheDwarfEmitter->emitPubTypesForUnit(Unit);
+}
+
/// Read the frame info stored in the object, and emit the
/// patched frame descriptions for the resulting file.
///
@@ -2545,6 +2551,9 @@ bool DWARFLinker::link() {
case AccelTableKind::Dwarf:
TheDwarfEmitter->emitDebugNames(DebugNames);
break;
+ case AccelTableKind::Pub:
+ // Already emitted by emitPubAcceleratorEntriesForUnit.
+ break;
case AccelTableKind::Default:
llvm_unreachable("Default should have already been resolved.");
break;
diff --git a/llvm/lib/DWARFLinker/DWARFStreamer.cpp b/llvm/lib/DWARFLinker/DWARFStreamer.cpp
index c0043ae39efec..c3c575ea6d78c 100644
--- a/llvm/lib/DWARFLinker/DWARFStreamer.cpp
+++ b/llvm/lib/DWARFLinker/DWARFStreamer.cpp
@@ -761,16 +761,12 @@ void DwarfStreamer::emitPubSectionForUnit(
/// Emit .debug_pubnames for \p Unit.
void DwarfStreamer::emitPubNamesForUnit(const CompileUnit &Unit) {
- if (Minimize)
- return;
emitPubSectionForUnit(MC->getObjectFileInfo()->getDwarfPubNamesSection(),
"names", Unit, Unit.getPubnames());
}
/// Emit .debug_pubtypes for \p Unit.
void DwarfStreamer::emitPubTypesForUnit(const CompileUnit &Unit) {
- if (Minimize)
- return;
emitPubSectionForUnit(MC->getObjectFileInfo()->getDwarfPubTypesSection(),
"types", Unit, Unit.getPubtypes());
}
diff --git a/llvm/test/tools/dsymutil/ARM/obfuscated.test b/llvm/test/tools/dsymutil/ARM/obfuscated.test
index b0e3918b7ae67..a09adf73f13a9 100644
--- a/llvm/test/tools/dsymutil/ARM/obfuscated.test
+++ b/llvm/test/tools/dsymutil/ARM/obfuscated.test
@@ -4,6 +4,10 @@ RUN: dsymutil --symbol-map %p/../Inputs/obfuscated.map %p/../Inputs/obfuscated.a
RUN: | llvm-dwarfdump -v - \
RUN: | FileCheck %s
+RUN: dsymutil --accelerator=Pub --symbol-map %p/../Inputs/obfuscated.map %p/../Inputs/obfuscated.arm64 -f -o - \
+RUN: | llvm-dwarfdump -v - \
+RUN: | FileCheck --check-prefix=PUB %s
+
RUN: dsymutil --symbol-map %p/../Inputs/obfuscated.map %p/../Inputs/obfuscated.arm64 -f -o - \
RUN: | llvm-dwarfdump -v - \
RUN: | FileCheck --check-prefix=NOHIDDEN %s
@@ -118,21 +122,21 @@ CHECK: dir_index: 0
CHECK: mod_time: 0x00000000
CHECK: length: 0x00000000
-CHECK: .debug_pubnames contents:
-CHECK: length = 0x00000017, format = DWARF32, version = 0x0002, unit_offset = 0x00000000, unit_size = 0x00000044
-CHECK: 0x0000002e "main"
-CHECK: length = 0x00000016, format = DWARF32, version = 0x0002, unit_offset = 0x00000044, unit_size = 0x00000044
-CHECK: 0x0000002e "one"
-CHECK: length = 0x00000016, format = DWARF32, version = 0x0002, unit_offset = 0x00000088, unit_size = 0x00000044
-CHECK: 0x0000002e "two"
-CHECK: length = 0x00000018, format = DWARF32, version = 0x0002, unit_offset = 0x000000cc, unit_size = 0x00000044
-CHECK: 0x0000002e "three"
-CHECK: length = 0x00000017, format = DWARF32, version = 0x0002, unit_offset = 0x00000110, unit_size = 0x00000044
-CHECK: 0x0000002e "four"
-CHECK: length = 0x00000017, format = DWARF32, version = 0x0002, unit_offset = 0x00000154, unit_size = 0x00000044
-CHECK: 0x0000002e "five"
-CHECK: length = 0x00000016, format = DWARF32, version = 0x0002, unit_offset = 0x00000198, unit_size = 0x00000044
-CHECK: 0x0000002e "six"
+PUB: .debug_pubnames contents:
+PUB: length = 0x00000017, format = DWARF32, version = 0x0002, unit_offset = 0x00000000, unit_size = 0x00000044
+PUB: 0x0000002e "main"
+PUB: length = 0x00000016, format = DWARF32, version = 0x0002, unit_offset = 0x00000044, unit_size = 0x00000044
+PUB: 0x0000002e "one"
+PUB: length = 0x00000016, format = DWARF32, version = 0x0002, unit_offset = 0x00000088, unit_size = 0x00000044
+PUB: 0x0000002e "two"
+PUB: length = 0x00000018, format = DWARF32, version = 0x0002, unit_offset = 0x000000cc, unit_size = 0x00000044
+PUB: 0x0000002e "three"
+PUB: length = 0x00000017, format = DWARF32, version = 0x0002, unit_offset = 0x00000110, unit_size = 0x00000044
+PUB: 0x0000002e "four"
+PUB: length = 0x00000017, format = DWARF32, version = 0x0002, unit_offset = 0x00000154, unit_size = 0x00000044
+PUB: 0x0000002e "five"
+PUB: length = 0x00000016, format = DWARF32, version = 0x0002, unit_offset = 0x00000198, unit_size = 0x00000044
+PUB: 0x0000002e "six"
CHECK: .apple_names contents:
diff --git a/llvm/test/tools/dsymutil/X86/basic-linking-bundle.test b/llvm/test/tools/dsymutil/X86/basic-linking-bundle.test
index 650ed1a8484c3..0e8cc2e61dadd 100644
--- a/llvm/test/tools/dsymutil/X86/basic-linking-bundle.test
+++ b/llvm/test/tools/dsymutil/X86/basic-linking-bundle.test
@@ -2,7 +2,7 @@ RUN: rm -rf %t
RUN: mkdir -p %t/dsymdest
RUN: cat %p/../Inputs/basic.macho.x86_64 > %t/basic.macho.x86_64
-RUN: dsymutil -oso-prepend-path=%p/.. %t/basic.macho.x86_64
+RUN: dsymutil -accelerator=Pub -oso-prepend-path=%p/.. %t/basic.macho.x86_64
Check that the object file in the bundle exists and is sane:
RUN: llvm-dwarfdump -a %t/basic.macho.x86_64.dSYM/Contents/Resources/DWARF/basic.macho.x86_64 | FileCheck %S/basic-linking-x86.test
diff --git a/llvm/test/tools/dsymutil/X86/basic-linking-x86.test b/llvm/test/tools/dsymutil/X86/basic-linking-x86.test
index 754aaf3d4e89c..13ea0858437fc 100644
--- a/llvm/test/tools/dsymutil/X86/basic-linking-x86.test
+++ b/llvm/test/tools/dsymutil/X86/basic-linking-x86.test
@@ -1,12 +1,12 @@
RUN: cat %p/../Inputs/basic.macho.x86_64 > %t1
-RUN: dsymutil -f -oso-prepend-path=%p/.. %t1
+RUN: dsymutil -accelerator=Pub -f -oso-prepend-path=%p/.. %t1
RUN: llvm-dwarfdump -a %t1.dwarf | FileCheck %s
-RUN: dsymutil -f -o %t2 -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64
+RUN: dsymutil -accelerator=Pub -f -o %t2 -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64
RUN: llvm-dwarfdump -a %t2 | FileCheck %s
-RUN: dsymutil -f -o - -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64 | llvm-dwarfdump -a - | FileCheck %s --check-prefixes=CHECK,BASIC
-RUN: dsymutil -f -o - -oso-prepend-path=%p/.. %p/../Inputs/basic-archive.macho.x86_64 | llvm-dwarfdump -a - | FileCheck %s --check-prefixes=CHECK,ARCHIVE
-RUN: dsymutil -dump-debug-map -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64 | dsymutil -f -y -o - - | llvm-dwarfdump -a - | FileCheck %s --check-prefixes=CHECK,BASIC
-RUN: dsymutil -dump-debug-map -oso-prepend-path=%p/.. %p/../Inputs/basic-archive.macho.x86_64 | dsymutil -f -o - -y - | llvm-dwarfdump -a - | FileCheck %s --check-prefixes=CHECK,ARCHIVE
+RUN: dsymutil -accelerator=Pub -f -o - -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64 | llvm-dwarfdump -a - | FileCheck %s --check-prefixes=CHECK,BASIC,PUB
+RUN: dsymutil -accelerator=Pub -f -o - -oso-prepend-path=%p/.. %p/../Inputs/basic-archive.macho.x86_64 | llvm-dwarfdump -a - | FileCheck %s --check-prefixes=CHECK,ARCHIVE,PUB
+RUN: dsymutil -accelerator=Pub -dump-debug-map -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64 | dsymutil -accelerator=Pub -f -y -o - - | llvm-dwarfdump -a - | FileCheck %s --check-prefixes=CHECK,BASIC,PUB
+RUN: dsymutil -accelerator=Pub -dump-debug-map -oso-prepend-path=%p/.. %p/../Inputs/basic-archive.macho.x86_64 | dsymutil -accelerator=Pub -f -o - -y - | llvm-dwarfdump -a - | FileCheck %s --check-prefixes=CHECK,ARCHIVE,PUB
CHECK: file format Mach-O 64-bit x86-64
@@ -189,30 +189,30 @@ CHECK-NEXT: 0x0000000100000f90 11 0 1 0 0 is_stmt
CHECK-NEXT: 0x0000000100000f9b 12 0 1 0 0 is_stmt prologue_end
CHECK-NEXT: 0x0000000100000fa9 12 0 1 0 0 is_stmt end_sequence
-CHECK: .debug_pubnames contents:
-CHECK-NEXT: length = 0x00000017, format = DWARF32, version = 0x0002, unit_offset = 0x00000000, unit_size = 0x00000081
-CHECK-NEXT: Offset Name
-CHECK-NEXT: 0x00000026 "main"
-CHECK-NEXT: length = 0x00000036, format = DWARF32, version = 0x0002, unit_offset = 0x00000081, unit_size = 0x000000a5
-CHECK-NEXT: Offset Name
-CHECK-NEXT: 0x0000002d "private_int"
-CHECK-NEXT: 0x00000042 "baz"
-CHECK-NEXT: 0x00000057 "foo"
-CHECK-NEXT: 0x00000086 "inc"
-CHECK-NEXT: length = 0x00000026, format = DWARF32, version = 0x0002, unit_offset = 0x00000126, unit_size = 0x00000096
-CHECK-NEXT: Offset Name
-CHECK-NEXT: 0x00000026 "val"
-CHECK-NEXT: 0x00000048 "bar"
-CHECK-NEXT: 0x00000077 "inc"
-
-CHECK: .debug_pubtypes contents:
-CHECK-NEXT: length = 0x0000001f, format = DWARF32, version = 0x0002, unit_offset = 0x00000000, unit_size = 0x00000081
-CHECK-NEXT: Offset Name
-CHECK-NEXT: 0x00000063 "int"
-CHECK-NEXT: 0x00000079 "char"
-CHECK-NEXT: length = 0x00000016, format = DWARF32, version = 0x0002, unit_offset = 0x00000081, unit_size = 0x000000a5
-CHECK-NEXT: Offset Name
-CHECK-NEXT: 0x00000026 "int"
-CHECK-NEXT: length = 0x00000016, format = DWARF32, version = 0x0002, unit_offset = 0x00000126, unit_size = 0x00000096
-CHECK-NEXT: Offset Name
-CHECK-NEXT: 0x00000041 "int"
+PUB: .debug_pubnames contents:
+PUB-NEXT: length = 0x00000017, format = DWARF32, version = 0x0002, unit_offset = 0x00000000, unit_size = 0x00000081
+PUB-NEXT: Offset Name
+PUB-NEXT: 0x00000026 "main"
+PUB-NEXT: length = 0x00000036, format = DWARF32, version = 0x0002, unit_offset = 0x00000081, unit_size = 0x000000a5
+PUB-NEXT: Offset Name
+PUB-NEXT: 0x0000002d "private_int"
+PUB-NEXT: 0x00000042 "baz"
+PUB-NEXT: 0x00000057 "foo"
+PUB-NEXT: 0x00000086 "inc"
+PUB-NEXT: length = 0x00000026, format = DWARF32, version = 0x0002, unit_offset = 0x00000126, unit_size = 0x00000096
+PUB-NEXT: Offset Name
+PUB-NEXT: 0x00000026 "val"
+PUB-NEXT: 0x00000048 "bar"
+PUB-NEXT: 0x00000077 "inc"
+
+PUB: .debug_pubtypes contents:
+PUB-NEXT: length = 0x0000001f, format = DWARF32, version = 0x0002, unit_offset = 0x00000000, unit_size = 0x00000081
+PUB-NEXT: Offset Name
+PUB-NEXT: 0x00000063 "int"
+PUB-NEXT: 0x00000079 "char"
+PUB-NEXT: length = 0x00000016, format = DWARF32, version = 0x0002, unit_offset = 0x00000081, unit_size = 0x000000a5
+PUB-NEXT: Offset Name
+PUB-NEXT: 0x00000026 "int"
+PUB-NEXT: length = 0x00000016, format = DWARF32, version = 0x0002, unit_offset = 0x00000126, unit_size = 0x00000096
+PUB-NEXT: Offset Name
+PUB-NEXT: 0x00000041 "int"
diff --git a/llvm/test/tools/dsymutil/X86/basic-lto-dw4-linking-x86.test b/llvm/test/tools/dsymutil/X86/basic-lto-dw4-linking-x86.test
index e1dc3f411cb44..867d822a9d9b8 100644
--- a/llvm/test/tools/dsymutil/X86/basic-lto-dw4-linking-x86.test
+++ b/llvm/test/tools/dsymutil/X86/basic-lto-dw4-linking-x86.test
@@ -179,24 +179,196 @@ CHECK-NEXT: 0x0000000100000fab 19 10 1 0 0
CHECK-NEXT: 0x0000000100000fb2 20 1 1 0 0 is_stmt
CHECK-NEXT: 0x0000000100000fb4 20 1 1 0 0 is_stmt end_sequence
-CHECK: .debug_pubnames contents:
-CHECK-NEXT: length = 0x00000017, format = DWARF32, version = 0x0002, unit_offset = 0x00000000, unit_size = 0x00000077
-CHECK-NEXT: Offset Name
-CHECK-NEXT: 0x0000002a "main"
-CHECK-NEXT: length = 0x0000002e, format = DWARF32, version = 0x0002, unit_offset = 0x00000077, unit_size = 0x000000a4
-CHECK-NEXT: Offset Name
-CHECK-NEXT: 0x00000031 "baz"
-CHECK-NEXT: 0x00000046 "private_int"
-CHECK-NEXT: 0x00000067 "foo"
-CHECK-NEXT: length = 0x0000001e, format = DWARF32, version = 0x0002, unit_offset = 0x0000011b, unit_size = 0x00000085
-CHECK-NEXT: Offset Name
-CHECK-NEXT: 0x0000002a "val"
-CHECK-NEXT: 0x00000050 "bar"
-
-CHECK: .debug_pubtypes contents:
-CHECK-NEXT: length = 0x00000017, format = DWARF32, version = 0x0002, unit_offset = 0x00000000, unit_size = 0x00000077
-CHECK-NEXT: Offset Name
-CHECK-NEXT: 0x0000006f "char"
-CHECK-NEXT: length = 0x00000016, format = DWARF32, version = 0x0002, unit_offset = 0x00000077, unit_size = 0x000000a4
-CHECK-NEXT: Offset Name
-CHECK-NEXT: 0x0000002a "int"
+CHECK-NOT: .debug_pubnames contents:
+CHECK-NOT: .debug_pubtypes contents:
+
+CHECK: .apple_names contents:
+CHECK-NEXT: Header {
+CHECK-NEXT: Magic: 0x48415348
+CHECK-NEXT: Version: 0x1
+CHECK-NEXT: Hash function: 0x0
+CHECK-NEXT: Bucket count: 7
+CHECK-NEXT: Hashes count: 7
+CHECK-NEXT: HeaderData length: 12
+CHECK-NEXT: }
+CHECK-NEXT: DIE offset base: 0
+CHECK-NEXT: Number of atoms: 1
+CHECK-NEXT: Atoms [
+CHECK-NEXT: Atom 0 {
+CHECK-NEXT: Type: DW_ATOM_die_offset
+CHECK-NEXT: Form: DW_FORM_data4
+CHECK-NEXT: }
+CHECK-NEXT: ]
+CHECK-NEXT: Bucket 0 [
+CHECK-NEXT: Hash 0xb8860c2 [
+CHECK-NEXT: Name at 0x74 {
+CHECK-NEXT: String: 0x00000048 "baz"
+CHECK-NEXT: Data 0 [
+CHECK-NEXT: Atom[0]: 0x000000a8
+CHECK-NEXT: ]
+CHECK-NEXT: }
+CHECK-NEXT: ]
+CHECK-NEXT: Hash 0xb88801f [
+CHECK-NEXT: Name at 0x84 {
+CHECK-NEXT: String: 0x00000058 "inc"
+CHECK-NEXT: Data 0 [
+CHECK-NEXT: Atom[0]: 0x00000106
+CHECK-NEXT: ]
+CHECK-NEXT: Data 1 [
+CHECK-NEXT: Atom[0]: 0x00000193
+CHECK-NEXT: ]
+CHECK-NEXT: }
+CHECK-NEXT: ]
+CHECK-NEXT: ]
+CHECK-NEXT: Bucket 1 [
+CHECK-NEXT: EMPTY
+CHECK-NEXT: ]
+CHECK-NEXT: Bucket 2 [
+CHECK-NEXT: Hash 0xfed12c6a [
+CHECK-NEXT: Name at 0x98 {
+CHECK-NEXT: String: 0x0000004c "private_int"
+CHECK-NEXT: Data 0 [
+CHECK-NEXT: Atom[0]: 0x000000bd
+CHECK-NEXT: ]
+CHECK-NEXT: }
+CHECK-NEXT: ]
+CHECK-NEXT: ]
+CHECK-NEXT: Bucket 3 [
+CHECK-NEXT: Hash 0xb88b5c8 [
+CHECK-NEXT: Name at 0xa8 {
+CHECK-NEXT: String: 0x0000006d "val"
+CHECK-NEXT: Data 0 [
+CHECK-NEXT: Atom[0]: 0x00000145
+CHECK-NEXT: ]
+CHECK-NEXT: }
+CHECK-NEXT: ]
+CHECK-NEXT: Hash 0x7c9a7f6a [
+CHECK-NEXT: Name at 0xb8 {
+CHECK-NEXT: String: 0x00000027 "main"
+CHECK-NEXT: Data 0 [
+CHECK-NEXT: Atom[0]: 0x0000002a
+CHECK-NEXT: ]
+CHECK-NEXT: }
+CHECK-NEXT: ]
+CHECK-NEXT: ]
+CHECK-NEXT: Bucket 4 [
+CHECK-NEXT: EMPTY
+CHECK-NEXT: ]
+CHECK-NEXT: Bucket 5 [
+CHECK-NEXT: Hash 0xb887389 [
+CHECK-NEXT: Name at 0xc8 {
+CHECK-NEXT: String: 0x0000005c "foo"
+CHECK-NEXT: Data 0 [
+CHECK-NEXT: Atom[0]: 0x000000de
+CHECK-NEXT: ]
+CHECK-NEXT: }
+CHECK-NEXT: ]
+CHECK-NEXT: ]
+CHECK-NEXT: Bucket 6 [
+CHECK-NEXT: Hash 0xb8860ba [
+CHECK-NEXT: Name at 0xd8 {
+CHECK-NEXT: String: 0x00000071 "bar"
+CHECK-NEXT: Data 0 [
+CHECK-NEXT: Atom[0]: 0x0000016b
+CHECK-NEXT: ]
+CHECK-NEXT: }
+CHECK-NEXT: ]
+CHECK-NEXT: ]
+
+CHECK: .apple_types contents:
+CHECK-NEXT: Header {
+CHECK-NEXT: Magic: 0x48415348
+CHECK-NEXT: Version: 0x1
+CHECK-NEXT: Hash function: 0x0
+CHECK-NEXT: Bucket count: 2
+CHECK-NEXT: Hashes count: 2
+CHECK-NEXT: HeaderData length: 24
+CHECK-NEXT: }
+CHECK-NEXT: DIE offset base: 0
+CHECK-NEXT: Number of atoms: 4
+CHECK-NEXT: Atoms [
+CHECK-NEXT: Atom 0 {
+CHECK-NEXT: Type: DW_ATOM_die_offset
+CHECK-NEXT: Form: DW_FORM_data4
+CHECK-NEXT: }
+CHECK-NEXT: Atom 1 {
+CHECK-NEXT: Type: DW_ATOM_die_tag
+CHECK-NEXT: Form: DW_FORM_data2
+CHECK-NEXT: }
+CHECK-NEXT: Atom 2 {
+CHECK-NEXT: Type: DW_ATOM_type_flags
+CHECK-NEXT: Form: DW_FORM_data1
+CHECK-NEXT: }
+CHECK-NEXT: Atom 3 {
+CHECK-NEXT: Type: DW_ATOM_qual_name_hash
+CHECK-NEXT: Form: DW_FORM_data4
+CHECK-NEXT: }
+CHECK-NEXT: ]
+CHECK-NEXT: Bucket 0 [
+CHECK-NEXT: Hash 0xb888030 [
+CHECK-NEXT: Name at 0x44 {
+CHECK-NEXT: String: 0x00000044 "int"
+CHECK-NEXT: Data 0 [
+CHECK-NEXT: Atom[0]: 0x000000a1
+CHECK-NEXT: Atom[1]: 0x0024 (DW_TAG_base_type)
+CHECK-NEXT: Atom[2]: 0x00
+CHECK-NEXT: Atom[3]: 0x0c3a28a4
+CHECK-NEXT: ]
+CHECK-NEXT: }
+CHECK-NEXT: ]
+CHECK-NEXT: ]
+CHECK-NEXT: Bucket 1 [
+CHECK-NEXT: Hash 0x7c952063 [
+CHECK-NEXT: Name at 0x5b {
+CHECK-NEXT: String: 0x00000036 "char"
+CHECK-NEXT: Data 0 [
+CHECK-NEXT: Atom[0]: 0x0000006f
+CHECK-NEXT: Atom[1]: 0x0024 (DW_TAG_base_type)
+CHECK-NEXT: Atom[2]: 0x00
+CHECK-NEXT: Atom[3]: 0x937bd757
+CHECK-NEXT: ]
+CHECK-NEXT: }
+CHECK-NEXT: ]
+CHECK-NEXT: ]
+
+CHECK: .apple_namespaces contents:
+CHECK-NEXT: Header {
+CHECK-NEXT: Magic: 0x48415348
+CHECK-NEXT: Version: 0x1
+CHECK-NEXT: Hash function: 0x0
+CHECK-NEXT: Bucket count: 1
+CHECK-NEXT: Hashes count: 0
+CHECK-NEXT: HeaderData length: 12
+CHECK-NEXT: }
+CHECK-NEXT: DIE offset base: 0
+CHECK-NEXT: Number of atoms: 1
+CHECK-NEXT: Atoms [
+CHECK-NEXT: Atom 0 {
+CHECK-NEXT: Type: DW_ATOM_die_offset
+CHECK-NEXT: Form: DW_FORM_data4
+CHECK-NEXT: }
+CHECK-NEXT: ]
+CHECK-NEXT: Bucket 0 [
+CHECK-NEXT: EMPTY
+CHECK-NEXT: ]
+
+CHECK: .apple_objc contents:
+CHECK-NEXT: Header {
+CHECK-NEXT: Magic: 0x48415348
+CHECK-NEXT: Version: 0x1
+CHECK-NEXT: Hash function: 0x0
+CHECK-NEXT: Bucket count: 1
+CHECK-NEXT: Hashes count: 0
+CHECK-NEXT: HeaderData length: 12
+CHECK-NEXT: }
+CHECK-NEXT: DIE offset base: 0
+CHECK-NEXT: Number of atoms: 1
+CHECK-NEXT: Atoms [
+CHECK-NEXT: Atom 0 {
+CHECK-NEXT: Type: DW_ATOM_die_offset
+CHECK-NEXT: Form: DW_FORM_data4
+CHECK-NEXT: }
+CHECK-NEXT: ]
+CHECK-NEXT: Bucket 0 [
+CHECK-NEXT: EMPTY
+CHECK-NEXT: ]
diff --git a/llvm/test/tools/dsymutil/X86/basic-lto-linking-x86.test b/llvm/test/tools/dsymutil/X86/basic-lto-linking-x86.test
index 509755a521551..4e5d142315f13 100644
--- a/llvm/test/tools/dsymutil/X86/basic-lto-linking-x86.test
+++ b/llvm/test/tools/dsymutil/X86/basic-lto-linking-x86.test
@@ -178,25 +178,8 @@ CHECK: 0x0000000100000fa9 19 0 1 0 0 is_stmt
CHECK: 0x0000000100000fb2 20 0 1 0 0 is_stmt
CHECK: 0x0000000100000fb4 20 0 1 0 0 is_stmt end_sequence
-CHECK: .debug_pubnames contents:
-CHECK-NEXT: length = 0x00000017, format = DWARF32, version = 0x0002, unit_offset = 0x00000000, unit_size = 0x00000081
-CHECK-NEXT: Offset Name
-CHECK-NEXT: 0x00000026 "main"
-CHECK-NEXT: length = 0x0000002e, format = DWARF32, version = 0x0002, unit_offset = 0x00000081, unit_size = 0x000000b9
-CHECK-NEXT: Offset Name
-CHECK-NEXT: 0x00000026 "private_int"
-CHECK-NEXT: 0x0000003f "baz"
-CHECK-NEXT: 0x00000058 "foo"
-CHECK-NEXT: length = 0x0000001e, format = DWARF32, version = 0x0002, unit_offset = 0x0000013a, unit_size = 0x000000ac
-CHECK-NEXT: Offset Name
-CHECK-NEXT: 0x00000026 "val"
-CHECK-NEXT: 0x00000045 "bar"
-
-CHECK: .debug_pubtypes contents:
-CHECK-NEXT: length = 0x0000001f, format = DWARF32, version = 0x0002, unit_offset = 0x00000000, unit_size = 0x00000081
-CHECK-NEXT: Offset Name
-CHECK-NEXT: 0x00000063 "int"
-CHECK-NEXT: 0x00000079 "char"
+CHECK-NOT: .debug_pubnames contents:
+CHECK-NOT: .debug_pubtypes contents:
CHECK: .apple_names contents:
CHECK-NEXT: Header {
diff --git a/llvm/test/tools/dsymutil/X86/dsym-companion.test b/llvm/test/tools/dsymutil/X86/dsym-companion.test
index c9b0a1aa4f8d4..d81ad7dc92446 100644
--- a/llvm/test/tools/dsymutil/X86/dsym-companion.test
+++ b/llvm/test/tools/dsymutil/X86/dsym-companion.test
@@ -1,5 +1,5 @@
-RUN: dsymutil -o - %p/../Inputs/basic.macho.i386 -f | llvm-readobj --file-headers -l -S --symbols - | FileCheck %s -check-prefixes=CHECK,CHECK32
-RUN: dsymutil -o - -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64 -f | llvm-readobj --file-headers -l -S --symbols - | FileCheck %s -check-prefixes=CHECK,CHECK64
+RUN: dsymutil -accelerator=Pub -o - %p/../Inputs/basic.macho.i386 -f | llvm-readobj --file-headers -l -S --symbols - | FileCheck %s -check-prefixes=CHECK,CHECK32
+RUN: dsymutil -accelerator=Pub -o - -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64 -f | llvm-readobj --file-headers -l -S --symbols - | FileCheck %s -check-prefixes=CHECK,CHECK64
This test checks that the dSYM companion binaries generated in 32 and 64 bits
are correct. The check are pretty strict (we check even the offsets and sizes
diff --git a/llvm/test/tools/dsymutil/X86/minimize.test b/llvm/test/tools/dsymutil/X86/minimize.test
deleted file mode 100644
index 4e2d5b568396e..0000000000000
--- a/llvm/test/tools/dsymutil/X86/minimize.test
+++ /dev/null
@@ -1,9 +0,0 @@
-RUN: dsymutil -f -o - -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64 | llvm-readobj --sections - | FileCheck %s --check-prefix=FULL
-RUN: dsymutil --minimize -f -o - -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64 | llvm-readobj --sections - | FileCheck %s
-RUN: dsymutil -z -f -o - -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64 | llvm-readobj --sections - | FileCheck %s
-
-FULL: Name: __debug_pubnames
-FULL: Name: __debug_pubtypes
-
-CHECK-NOT: Name: __debug_pubnames
-CHECK-NOT: Name: __debug_pubtypes
diff --git a/llvm/test/tools/dsymutil/X86/update.test b/llvm/test/tools/dsymutil/X86/update.test
index 804091ab29430..d6c900911f52a 100644
--- a/llvm/test/tools/dsymutil/X86/update.test
+++ b/llvm/test/tools/dsymutil/X86/update.test
@@ -1,15 +1,15 @@
RUN: rm -rf %t.dir
RUN: mkdir -p %t.dir
RUN: cat %p/../Inputs/basic.macho.x86_64 > %t.dir/basic
-RUN: dsymutil -oso-prepend-path=%p/.. %t.dir/basic
+RUN: dsymutil -accelerator=Pub -oso-prepend-path=%p/.. %t.dir/basic
RUN: llvm-dwarfdump -a %t.dir/basic.dSYM | FileCheck %S/basic-linking-x86.test
-RUN: dsymutil --update %t.dir/basic.dSYM
+RUN: dsymutil -accelerator=Pub --update %t.dir/basic.dSYM
RUN: llvm-dwarfdump -a %t.dir/basic.dSYM | FileCheck %S/basic-linking-x86.test
-RUN: dsymutil -u %t.dir/basic.dSYM
+RUN: dsymutil -accelerator=Pub -u %t.dir/basic.dSYM
RUN: llvm-dwarfdump -a %t.dir/basic.dSYM | FileCheck %S/basic-linking-x86.test
-RUN: dsymutil --update %t.dir/basic.dSYM -o %t.dir/updated.dSYM
+RUN: dsymutil -accelerator=Pub --update %t.dir/basic.dSYM -o %t.dir/updated.dSYM
RUN: llvm-dwarfdump -a %t.dir/updated.dSYM | FileCheck %S/basic-linking-x86.test
-RUN: dsymutil -f -o %t2 -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64
-RUN: dsymutil -f -u %t2 -o %t3
+RUN: dsymutil -accelerator=Pub -f -o %t2 -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64
+RUN: dsymutil -accelerator=Pub -f -u %t2 -o %t3
RUN: llvm-dwarfdump -a %t3 | FileCheck %S/basic-linking-x86.test
diff --git a/llvm/test/tools/dsymutil/cmdline.test b/llvm/test/tools/dsymutil/cmdline.test
index e3f8bbdf7503a..ec8c52ed596f1 100644
--- a/llvm/test/tools/dsymutil/cmdline.test
+++ b/llvm/test/tools/dsymutil/cmdline.test
@@ -11,7 +11,6 @@ CHECK: -dump-debug-map
CHECK: -flat
CHECK: -gen-reproducer
CHECK: -help
-CHECK: -minimize
CHECK: -no-odr
CHECK: -no-output
CHECK: -no-swiftmodule-timestamp
diff --git a/llvm/tools/dsymutil/DwarfLinkerForBinary.cpp b/llvm/tools/dsymutil/DwarfLinkerForBinary.cpp
index b2eaa067a3d9b..c597b696394d5 100644
--- a/llvm/tools/dsymutil/DwarfLinkerForBinary.cpp
+++ b/llvm/tools/dsymutil/DwarfLinkerForBinary.cpp
@@ -167,7 +167,7 @@ bool DwarfLinkerForBinary::createStreamer(const Triple &TheTriple,
return true;
Streamer = std::make_unique<DwarfStreamer>(
- Options.FileType, OutFile, Options.Translator, Options.Minimize,
+ Options.FileType, OutFile, Options.Translator,
[&](const Twine &Error, StringRef Context, const DWARFDie *) {
error(Error, Context);
},
diff --git a/llvm/tools/dsymutil/LinkUtils.h b/llvm/tools/dsymutil/LinkUtils.h
index 52b36353c6b6a..58623af19cdba 100644
--- a/llvm/tools/dsymutil/LinkUtils.h
+++ b/llvm/tools/dsymutil/LinkUtils.h
@@ -39,9 +39,6 @@ struct LinkOptions {
/// Update
bool Update = false;
- /// Minimize
- bool Minimize = false;
-
/// Do not check swiftmodule timestamp
bool NoTimestamp = false;
diff --git a/llvm/tools/dsymutil/Options.td b/llvm/tools/dsymutil/Options.td
index 7bd21b0d43462..b3d07531b81c7 100644
--- a/llvm/tools/dsymutil/Options.td
+++ b/llvm/tools/dsymutil/Options.td
@@ -81,19 +81,6 @@ def: Flag<["-"], "f">,
HelpText<"Alias for --flat">,
Group<grp_general>;
-def minimize: F<"minimize">,
- HelpText<"When used when creating a dSYM file with Apple accelerator tables, "
- "this option will suppress the emission of the .debug_inlines, "
- ".debug_pubnames, and .debug_pubtypes sections since dsymutil "
- "has better equivalents: .apple_names and .apple_types. When used in "
- "conjunction with --update option, this option will cause redundant "
- "accelerator tables to be removed.">,
- Group<grp_general>;
-def: Flag<["-"], "z">,
- Alias<minimize>,
- HelpText<"Alias for --minimize">,
- Group<grp_general>;
-
def update: F<"update">,
HelpText<"Updates existing dSYM files to contain the latest accelerator tables and other DWARF optimizations.">,
Group<grp_general>;
@@ -146,7 +133,7 @@ def: Joined<["--", "-"], "arch=">, Alias<arch>;
def accelerator: Separate<["--", "-"], "accelerator">,
MetaVarName<"<accelerator type>">,
- HelpText<"Specify the desired type of accelerator table. Valid options are 'Apple', 'Dwarf' and 'Default'">,
+ HelpText<"Specify the desired type of accelerator table. Valid options are 'Apple' (.apple_names, .apple_namespaces, .apple_types, .apple_objc), 'Dwarf' (.debug_names), 'Pub' (.debug_pubnames, .debug_pubtypes) and 'Default'">,
Group<grp_general>;
def: Joined<["--", "-"], "accelerator=">, Alias<accelerator>;
diff --git a/llvm/tools/dsymutil/dsymutil.cpp b/llvm/tools/dsymutil/dsymutil.cpp
index 27681fae3ca7a..830855e74e9ff 100644
--- a/llvm/tools/dsymutil/dsymutil.cpp
+++ b/llvm/tools/dsymutil/dsymutil.cpp
@@ -200,11 +200,13 @@ static Expected<AccelTableKind> getAccelTableKind(opt::InputArgList &Args) {
return AccelTableKind::Apple;
if (S == "Dwarf")
return AccelTableKind::Dwarf;
+ if (S == "Pub")
+ return AccelTableKind::Pub;
if (S == "Default")
return AccelTableKind::Default;
return make_error<StringError>(
"invalid accelerator type specified: '" + S +
- "'. Support values are 'Apple', 'Dwarf' and 'Default'.",
+ "'. Support values are 'Apple', 'Dwarf', 'Pub' and 'Default'.",
inconvertibleErrorCode());
}
return AccelTableKind::Default;
@@ -222,7 +224,6 @@ static Expected<DsymutilOptions> getOptions(opt::InputArgList &Args) {
Options.PaperTrailWarnings = Args.hasArg(OPT_papertrail);
Options.Verify = Args.hasArg(OPT_verify);
- Options.LinkOpts.Minimize = Args.hasArg(OPT_minimize);
Options.LinkOpts.NoODR = Args.hasArg(OPT_no_odr);
Options.LinkOpts.NoOutput = Args.hasArg(OPT_no_output);
Options.LinkOpts.NoTimestamp = Args.hasArg(OPT_no_swiftmodule_timestamp);
More information about the llvm-commits
mailing list