[dsymutil] Add (unimplemented) --flat option
authorFrederic Riss <friss@apple.com>
Thu, 6 Aug 2015 21:05:01 +0000 (21:05 +0000)
committerFrederic Riss <friss@apple.com>
Thu, 6 Aug 2015 21:05:01 +0000 (21:05 +0000)
dsymutil should by default generate dSYM bundles which are filesystem
hierarchies containing the debug info and an additional Info.plist.
Currently llvm-dsymutil emits raw binaries containing the debug info.
This is what we call the 'flat mode'. Add a -f/-flat option that is
supposed to enable that flat mode, but don't wire it for now, only
pass it to the tests that will need it to stay functional once we
do bundle generation by default.
This basically makes this commit NFC and removes the noise from the
actual commit that adds support for bundle generation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244269 91177308-0d34-0410-b5e6-96231b3b80d8

13 files changed:
test/tools/dsymutil/ARM/fat-arch-not-found.test
test/tools/dsymutil/X86/basic-linking-x86.test
test/tools/dsymutil/X86/basic-lto-dw4-linking-x86.test
test/tools/dsymutil/X86/basic-lto-linking-x86.test
test/tools/dsymutil/X86/fat-archive-input-i386.test
test/tools/dsymutil/X86/fat-object-input-x86_64.test
test/tools/dsymutil/X86/fat-object-input-x86_64h.test
test/tools/dsymutil/X86/frame-1.test
test/tools/dsymutil/X86/frame-2.test
test/tools/dsymutil/X86/multiple-inputs.test
test/tools/dsymutil/X86/odr-1.test
test/tools/dsymutil/fat-binary-output.test
tools/dsymutil/dsymutil.cpp

index 89b518cd16f83fc07642930227e1db6b5b346865..e15d9b69b5fe6bad046206b701fd430b660ec3f6 100644 (file)
@@ -1,5 +1,5 @@
 # REQUIRES: object-emission
-# RUN: llvm-dsymutil -oso-prepend-path=%p/../Inputs -y %s -o - 2>&1 | FileCheck %s
+# RUN: llvm-dsymutil -f -oso-prepend-path=%p/../Inputs -y %s -o - 2>&1 | FileCheck %s
 
 ---
 triple:          'armv7-apple-darwin'
index 19b4e3bef6637bede964454d01055a7630bc6af7..b92faa4cf037980f6a55a3b6767ad82d91745c0e 100644 (file)
@@ -1,13 +1,13 @@
 REQUIRES: shell
 RUN: cat %p/../Inputs/basic.macho.x86_64 > %t1
-RUN: llvm-dsymutil -oso-prepend-path=%p/.. %t1
+RUN: llvm-dsymutil -f -oso-prepend-path=%p/.. %t1
 RUN: llvm-dwarfdump %t1.dwarf | FileCheck %s
-RUN: llvm-dsymutil -o %t2 -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64
+RUN: llvm-dsymutil -f -o %t2 -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64
 RUN: llvm-dwarfdump %t2 | FileCheck %s
-RUN: llvm-dsymutil -o - -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64 | llvm-dwarfdump - | FileCheck %s --check-prefix=CHECK --check-prefix=BASIC
-RUN: llvm-dsymutil -o - -oso-prepend-path=%p/.. %p/../Inputs/basic-archive.macho.x86_64 | llvm-dwarfdump - | FileCheck %s --check-prefix=CHECK --check-prefix=ARCHIVE
-RUN: llvm-dsymutil -dump-debug-map -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64 | llvm-dsymutil -y -o - - | llvm-dwarfdump - | FileCheck %s --check-prefix=CHECK --check-prefix=BASIC
-RUN: llvm-dsymutil -dump-debug-map -oso-prepend-path=%p/.. %p/../Inputs/basic-archive.macho.x86_64 | llvm-dsymutil -o - -y - | llvm-dwarfdump - | FileCheck %s --check-prefix=CHECK --check-prefix=ARCHIVE
+RUN: llvm-dsymutil -f -o - -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64 | llvm-dwarfdump - | FileCheck %s --check-prefix=CHECK --check-prefix=BASIC
+RUN: llvm-dsymutil -f -o - -oso-prepend-path=%p/.. %p/../Inputs/basic-archive.macho.x86_64 | llvm-dwarfdump - | FileCheck %s --check-prefix=CHECK --check-prefix=ARCHIVE
+RUN: llvm-dsymutil -dump-debug-map -oso-prepend-path=%p/.. %p/../Inputs/basic.macho.x86_64 | llvm-dsymutil -f -y -o - - | llvm-dwarfdump - | FileCheck %s --check-prefix=CHECK --check-prefix=BASIC
+RUN: llvm-dsymutil -dump-debug-map -oso-prepend-path=%p/.. %p/../Inputs/basic-archive.macho.x86_64 | llvm-dsymutil -f -o - -y - | llvm-dwarfdump - | FileCheck %s --check-prefix=CHECK --check-prefix=ARCHIVE
 
 CHECK: file format Mach-O 64-bit x86-64
 
index ad3ba5a15b6b754bd2438128acf2776d9f9baa38..3c44cb6f5e0d36c7a8031578c59a4a83d3e69db4 100644 (file)
@@ -1,5 +1,5 @@
 REQUIRES: shell
-RUN: llvm-dsymutil -o - -oso-prepend-path=%p/.. %p/../Inputs/basic-lto-dw4.macho.x86_64 | llvm-dwarfdump - | FileCheck %s
+RUN: llvm-dsymutil -f -o - -oso-prepend-path=%p/.. %p/../Inputs/basic-lto-dw4.macho.x86_64 | llvm-dwarfdump - | FileCheck %s
 
 CHECK: file format Mach-O 64-bit x86-64
 
index 395234e96166aaf618eb4a939dc9c2604bec8e2c..81744273c6bcc2c1de38fe6a68c4d9132f087309 100644 (file)
@@ -1,6 +1,6 @@
 REQUIRES: shell
-RUN: llvm-dsymutil -o - -oso-prepend-path=%p/.. %p/../Inputs/basic-lto.macho.x86_64 | llvm-dwarfdump - | FileCheck %s
-RUN: llvm-dsymutil -oso-prepend-path=%p/.. -dump-debug-map %p/../Inputs/basic-lto.macho.x86_64 | llvm-dsymutil -o - -y - | llvm-dwarfdump - | FileCheck %s
+RUN: llvm-dsymutil -f -o - -oso-prepend-path=%p/.. %p/../Inputs/basic-lto.macho.x86_64 | llvm-dwarfdump - | FileCheck %s
+RUN: llvm-dsymutil -oso-prepend-path=%p/.. -dump-debug-map %p/../Inputs/basic-lto.macho.x86_64 | llvm-dsymutil -f -o - -y - | llvm-dwarfdump - | FileCheck %s
 
 CHECK: file format Mach-O 64-bit x86-64
 
index 7f17ff4837228b338a8c952c1ce103f4977f57be..f4ea288768c82b643f0ee13e529da84e9748f3da 100644 (file)
@@ -1,5 +1,5 @@
 # REQUIRES: object-emission
-# RUN: llvm-dsymutil -oso-prepend-path=%p/../Inputs -y %s -o - | llvm-dwarfdump -debug-dump=info - | FileCheck %s
+# RUN: llvm-dsymutil -f -oso-prepend-path=%p/../Inputs -y %s -o - | llvm-dwarfdump -debug-dump=info - | FileCheck %s
 
 ---
 triple:          'i386-apple-darwin'
index 489afece1207eac8196454c0d3b49b484b6d4003..cdd5a4c08d9c242d40d38844e82b0ff6272de429 100644 (file)
@@ -1,5 +1,5 @@
 # REQUIRES: object-emission
-# RUN: llvm-dsymutil -oso-prepend-path=%p/../Inputs -y %s -o - | llvm-dwarfdump -debug-dump=info - | FileCheck %s
+# RUN: llvm-dsymutil -f -oso-prepend-path=%p/../Inputs -y %s -o - | llvm-dwarfdump -debug-dump=info - | FileCheck %s
 
 ---
 triple:          'x86_64-apple-darwin'
index f611f5516f5e70e89e39a45f50cd6cdf537007f3..53aed1ec4443974e1a412473848960c207919282 100644 (file)
@@ -1,5 +1,5 @@
 # REQUIRES: object-emission
-# RUN: llvm-dsymutil -oso-prepend-path=%p/../Inputs -y %s -o - | llvm-dwarfdump -debug-dump=info - | FileCheck %s
+# RUN: llvm-dsymutil -f -oso-prepend-path=%p/../Inputs -y %s -o - | llvm-dwarfdump -debug-dump=info - | FileCheck %s
 
 ---
 triple:          'x86_64h-apple-darwin'
index fed18122d008e3d9a8c2be477997a6a5e647382d..27bc17d7598432c1ad08f1fd652e8f315d360e58 100644 (file)
@@ -2,7 +2,7 @@
 # RUN: rm -rf %t
 # RUN: mkdir -p %t
 # RUN: llc -filetype=obj %p/../Inputs/frame-dw2.ll -o %t/frame-dw2.o
-# RUN: llvm-dsymutil -oso-prepend-path=%t -y %s -o - | llvm-dwarfdump -debug-dump=frames - | FileCheck %s
+# RUN: llvm-dsymutil -f -oso-prepend-path=%t -y %s -o - | llvm-dwarfdump -debug-dump=frames - | FileCheck %s
 
 # This test is meant to verify that identical CIEs will get reused
 # in the same file but also inbetween files. For this to happen, we
index 92520290dad57035c9324b4ae0da18d8500a6d62..89a7670f86f08fe784faeb2058dd5214a1d2e045 100644 (file)
@@ -3,7 +3,7 @@
 # RUN: mkdir -p %t
 # RUN: llc -filetype=obj %p/../Inputs/frame-dw2.ll -o %t/frame-dw2.o
 # RUN: llc -filetype=obj %p/../Inputs/frame-dw4.ll -o %t/frame-dw4.o
-# RUN: llvm-dsymutil -oso-prepend-path=%t -y %s -o - | llvm-dwarfdump -debug-dump=frames - | FileCheck %s
+# RUN: llvm-dsymutil -f -oso-prepend-path=%t -y %s -o - | llvm-dwarfdump -debug-dump=frames - | FileCheck %s
 
 # Check the handling of multiple different CIEs. To have CIEs that
 # appear to be different, use a dwarf2 version of the file along with
index a4055740e4d9ec5d6cd2bae91d2ae0389551a580..97f6d6d155e417e695a06e7442920a6859b8b0c6 100644 (file)
@@ -3,7 +3,7 @@ RUN: cat %p/../Inputs/basic.macho.x86_64 > %t1
 RUN: cat %p/../Inputs/basic-archive.macho.x86_64 > %t2
 RUN: cat %p/../Inputs/basic-lto.macho.x86_64 > %t3
 RUN: cat %p/../Inputs/basic-lto-dw4.macho.x86_64 > %t4
-RUN: llvm-dsymutil -oso-prepend-path=%p/.. %t1 %t2 %t3 %t4
+RUN: llvm-dsymutil -f -oso-prepend-path=%p/.. %t1 %t2 %t3 %t4
 RUN: llvm-dwarfdump %t1.dwarf \
 RUN:   | FileCheck %S/basic-linking-x86.test --check-prefix=CHECK --check-prefix=BASIC
 RUN: llvm-dwarfdump %t2.dwarf \
index 607cd054b19ea951017afb041a66d1f882b80a60..f39c5cef1221daf609a9954335c56f41089438a9 100644 (file)
@@ -8,8 +8,8 @@
 # RUN: llc -filetype=obj %p/../Inputs/odr5.ll -o %t/odr5.o
 # RUN: llc -filetype=obj %p/../Inputs/odr6.ll -o %t/odr6.o
 # RUN: llc -filetype=obj %p/../Inputs/odr7.ll -o %t/odr7.o
-# RUN: llvm-dsymutil -oso-prepend-path=%t -y %s -o - | llvm-dwarfdump -debug-dump=info - | FileCheck -check-prefix=ODR -check-prefix=CHECK %s
-# RUN: llvm-dsymutil -oso-prepend-path=%t -y %s -no-odr -o - | llvm-dwarfdump -debug-dump=info - | FileCheck -check-prefix=NOODR -check-prefix=CHECK %s
+# RUN: llvm-dsymutil -f -oso-prepend-path=%t -y %s -o - | llvm-dwarfdump -debug-dump=info - | FileCheck -check-prefix=ODR -check-prefix=CHECK %s
+# RUN: llvm-dsymutil -f -oso-prepend-path=%t -y %s -no-odr -o - | llvm-dwarfdump -debug-dump=info - | FileCheck -check-prefix=NOODR -check-prefix=CHECK %s
 
 # Totally made up debug map to test ODR uniquing
 
index 29d49041453e029043870320a94b3b7a985e128d..fafef14ebe9b2ed8b3cc460b6ae52589d963042c 100644 (file)
@@ -1,4 +1,4 @@
-RUN: llvm-dsymutil -verbose -no-output %p/Inputs/fat-test.dylib -oso-prepend-path %p | FileCheck %s
+RUN: llvm-dsymutil -f -verbose -no-output %p/Inputs/fat-test.dylib -oso-prepend-path %p | FileCheck %s
 
 This test doesn't produce any filesytstem output, we just look at the verbose
 log output.
index cf5e6ed99a5f71da58984676288de74d6aa0b7c4..a609d1933de98446912106523369ef9d394c9a21 100644 (file)
@@ -47,6 +47,11 @@ static opt<std::string> OsoPrependPath(
     desc("Specify a directory to prepend to the paths of object files."),
     value_desc("path"), cat(DsymCategory));
 
+static opt<bool> FlatOut("flat",
+                         desc("Produce a flat dSYM file (not a bundle)."),
+                         init(false), cat(DsymCategory));
+static alias FlatOutA("f", desc("Alias for --flat"), aliasopt(FlatOut));
+
 static opt<bool> Verbose("verbose", desc("Verbosity level"), init(false),
                          cat(DsymCategory));
 
@@ -156,8 +161,13 @@ int main(int argc, char **argv) {
   llvm::InitializeAllTargets();
   llvm::InitializeAllAsmPrinters();
 
-  if (InputFiles.size() > 1 && !OutputFileOpt.empty()) {
-    llvm::errs() << "error: cannot use -o with multiple inputs\n";
+  if (!FlatOut && OutputFileOpt == "-") {
+    llvm::errs() << "error: cannot emit to standard output without --flat\n";
+    return 1;
+  }
+
+  if (InputFiles.size() > 1 && FlatOut && !OutputFileOpt.empty()) {
+    llvm::errs() << "error: cannot use -o with multiple inputs in flat mode\n";
     return 1;
   }