From cca341bb4e71561769c1f74d183ed8ecde559328 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Tue, 30 Jan 2018 19:54:16 +0000 Subject: [PATCH] [dsymutil] Enable -minimize feature. Passing -minimize to dsymutil prevents the emission of .debug_inlines, .debug_pubnames, and .debug_pubtypes in favor of the Apple accelerator tables. The actual check in the DWARF linker was added in r323655. This patch simply enables it. Differential revision: https://reviews.llvm.org/D42688 llvm-svn: 323812 --- llvm/docs/CommandGuide/dsymutil.rst | 7 +++++++ llvm/test/tools/dsymutil/X86/minimize.test | 9 +++++++++ llvm/test/tools/dsymutil/cmdline.test | 1 + llvm/tools/dsymutil/dsymutil.cpp | 10 ++++++++++ 4 files changed, 27 insertions(+) create mode 100644 llvm/test/tools/dsymutil/X86/minimize.test diff --git a/llvm/docs/CommandGuide/dsymutil.rst b/llvm/docs/CommandGuide/dsymutil.rst index a29bc3c295c7a..7813204ef7c68 100644 --- a/llvm/docs/CommandGuide/dsymutil.rst +++ b/llvm/docs/CommandGuide/dsymutil.rst @@ -35,6 +35,13 @@ OPTIONS Produce a flat dSYM file. A ``.dwarf`` extension will be appended to the executable name unless the output file is specified using the -o option. + +.. option:: -z, --minimize + + When used when creating a dSYM file, this option will suppress the emission of + the .debug_inlines, .debug_pubnames, and .debug_pubtypes sections since + dsymutil currently has better equivalents: .apple_names and .apple_types. + .. option:: --no-odr Do not use ODR (One Definition Rule) for uniquing C++ types. diff --git a/llvm/test/tools/dsymutil/X86/minimize.test b/llvm/test/tools/dsymutil/X86/minimize.test new file mode 100644 index 0000000000000..7005926aa3fad --- /dev/null +++ b/llvm/test/tools/dsymutil/X86/minimize.test @@ -0,0 +1,9 @@ +RUN: llvm-dsymutil -f -o - -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64 | llvm-readobj -sections - | FileCheck %s --check-prefix=FULL +RUN: llvm-dsymutil --minimize -f -o - -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64 | llvm-readobj -sections - | FileCheck %s +RUN: llvm-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/cmdline.test b/llvm/test/tools/dsymutil/cmdline.test index 89c296e1a9b58..561f3718ef2bb 100644 --- a/llvm/test/tools/dsymutil/cmdline.test +++ b/llvm/test/tools/dsymutil/cmdline.test @@ -6,6 +6,7 @@ HELP: Specific Options: HELP: -arch= HELP: -dump-debug-map HELP: -flat +HELP: -minimize HELP: -no-odr HELP: -no-output HELP: -no-swiftmodule-timestamp diff --git a/llvm/tools/dsymutil/dsymutil.cpp b/llvm/tools/dsymutil/dsymutil.cpp index 1f882abd18110..4a01b1d9db447 100644 --- a/llvm/tools/dsymutil/dsymutil.cpp +++ b/llvm/tools/dsymutil/dsymutil.cpp @@ -75,6 +75,15 @@ static opt FlatOut("flat", init(false), cat(DsymCategory)); static alias FlatOutA("f", desc("Alias for --flat"), aliasopt(FlatOut)); +static opt Minimize( + "minimize", + desc("When used when creating a dSYM file, this option will suppress\n" + "the emission of the .debug_inlines, .debug_pubnames, and\n" + ".debug_pubtypes sections since dsymutil currently has better\n" + "equivalents: .apple_names and .apple_types."), + init(false), cat(DsymCategory)); +static alias MinimizeA("z", desc("Alias for --minimize"), aliasopt(Minimize)); + static opt NumThreads( "num-threads", desc("Specifies the maximum number (n) of simultaneous threads to use\n" @@ -302,6 +311,7 @@ int main(int argc, char **argv) { Options.Verbose = Verbose; Options.NoOutput = NoOutput; Options.NoODR = NoODR; + Options.Minimize = Minimize; Options.NoTimestamp = NoTimestamp; Options.PrependPath = OsoPrependPath;