From 2902a21ef327df697f23355271041bbc43f59ee7 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Thu, 8 Mar 2018 10:39:12 +0000 Subject: [PATCH] [dsymutil] Embed toolchain in dSYM bundle Allow us to embed the (Xcode) toolchain in the dSYM bundle's property list. Differential revision: https://reviews.llvm.org/D44151 llvm-svn: 326994 --- llvm/docs/CommandGuide/dsymutil.rst | 4 ++++ llvm/test/tools/dsymutil/X86/darwin-bundle.test | 7 ++++++- llvm/test/tools/dsymutil/cmdline.test | 1 + llvm/tools/dsymutil/dsymutil.cpp | 13 +++++++++++-- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/llvm/docs/CommandGuide/dsymutil.rst b/llvm/docs/CommandGuide/dsymutil.rst index 2782da3..a89ee18 100644 --- a/llvm/docs/CommandGuide/dsymutil.rst +++ b/llvm/docs/CommandGuide/dsymutil.rst @@ -74,6 +74,10 @@ OPTIONS Dumps the symbol table found in *executable* or object file(s) and exits. +.. option:: --toolchain + + Embed the toolchain in the dSYM bundle's property list. + .. option:: -u, --update Update an existing dSYM file to contain the latest accelerator tables and diff --git a/llvm/test/tools/dsymutil/X86/darwin-bundle.test b/llvm/test/tools/dsymutil/X86/darwin-bundle.test index b49cdea..59434c5 100644 --- a/llvm/test/tools/dsymutil/X86/darwin-bundle.test +++ b/llvm/test/tools/dsymutil/X86/darwin-bundle.test @@ -8,6 +8,9 @@ RUN: cat %p/../Inputs/Info.plist > %t/Info.plist RUN: llvm-dsymutil -oso-prepend-path=%p/.. %t/basic.macho.x86_64 -o %t/dsymdest/basic.macho.x86_64.dSYM RUN: FileCheck %s --input-file %t/dsymdest/basic.macho.x86_64.dSYM/Contents/Info.plist +RUN: llvm-dsymutil -oso-prepend-path=%p/.. %t/basic.macho.x86_64 -toolchain "toolchain" -o %t/dsymdest/basic.macho.x86_64.dSYM +RUN: FileCheck %s --input-file %t/dsymdest/basic.macho.x86_64.dSYM/Contents/Info.plist --check-prefix=CHECK --check-prefix=TOOLCHAIN + CHECK: CHECK-NEXT: CHECK-NEXT: @@ -26,5 +29,7 @@ CHECK-NEXT: CFBundleShortVersionString CHECK-NEXT: 2.0 CHECK-NEXT: CFBundleVersion CHECK-NEXT: 2 -CHECK-NEXT: +TOOLCHAIN: Toolchain +TOOLCHAIN-NEXT: toolchain +CHECK: CHECK-NEXT: diff --git a/llvm/test/tools/dsymutil/cmdline.test b/llvm/test/tools/dsymutil/cmdline.test index d246a14..c45aa67 100644 --- a/llvm/test/tools/dsymutil/cmdline.test +++ b/llvm/test/tools/dsymutil/cmdline.test @@ -14,6 +14,7 @@ HELP: -num-threads= HELP: -o= HELP: -oso-prepend-path= HELP: -symtab +HELP: -toolchain HELP: -update HELP: -verbose HELP: -verify diff --git a/llvm/tools/dsymutil/dsymutil.cpp b/llvm/tools/dsymutil/dsymutil.cpp index adc2e85..bbde209 100644 --- a/llvm/tools/dsymutil/dsymutil.cpp +++ b/llvm/tools/dsymutil/dsymutil.cpp @@ -142,6 +142,10 @@ static opt InputIsYAMLDebugMap( static opt Verify("verify", desc("Verify the linked DWARF debug info."), cat(DsymCategory)); +static opt + Toolchain("toolchain", desc("Embed toolchain information in dSYM bundle."), + cat(DsymCategory)); + static bool createPlistFile(llvm::StringRef Bin, llvm::StringRef BundleRoot) { if (NoOutput) return true; @@ -189,8 +193,13 @@ static bool createPlistFile(llvm::StringRef Bin, llvm::StringRef BundleRoot) { << "\t\t" << BI.ShortVersionStr << "\n"; PL << "\t\tCFBundleVersion\n" - << "\t\t" << BI.VersionStr << "\n" - << "\t\n" + << "\t\t" << BI.VersionStr << "\n"; + + if (!Toolchain.empty()) + PL << "\t\tToolchain\n" + << "\t\t" << Toolchain << "\n"; + + PL << "\t\n" << "\n"; PL.close(); -- 2.7.4