<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Jul 31, 2015 at 10:22 PM, Frederic Riss <span dir="ltr"><<a href="mailto:friss@apple.com" target="_blank">friss@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: friss<br>
Date: Fri Jul 31 15:22:20 2015<br>
New Revision: 243777<br>
<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D243777-26view-3Drev&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=h03ZKl9nPTKCBsuqwJSfDrGVJxBG3VuKyGqSFarKVKc&s=eTnA8Rj5lv4dp9ON0eZSlJWyliYq_XnPXMshPTginG0&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=243777&view=rev</a><br>
Log:<br>
[dsymutil] Support multiple input files on the command line<br>
<br>
Added:<br>
    llvm/trunk/test/tools/dsymutil/X86/multiple-inputs.test<br>
Modified:<br>
    llvm/trunk/test/tools/dsymutil/basic-linking.test<br>
    llvm/trunk/tools/dsymutil/dsymutil.cpp<br>
<br>
Added: llvm/trunk/test/tools/dsymutil/X86/multiple-inputs.test<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_tools_dsymutil_X86_multiple-2Dinputs.test-3Frev-3D243777-26view-3Dauto&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=h03ZKl9nPTKCBsuqwJSfDrGVJxBG3VuKyGqSFarKVKc&s=Um6qapLoBjOkWOGMHorveZQfOSZOSNpVKDFzWI4U9hU&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/X86/multiple-inputs.test?rev=243777&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/tools/dsymutil/X86/multiple-inputs.test (added)<br>
+++ llvm/trunk/test/tools/dsymutil/X86/multiple-inputs.test Fri Jul 31 15:22:20 2015<br>
@@ -0,0 +1,12 @@<br>
+REQUIRES: shell<br>
+RUN: cat %p/../Inputs/basic.macho.x86_64 > %t1<br>
+RUN: cat %p/../Inputs/basic-archive.macho.x86_64 > %t2<br>
+RUN: cat %p/../Inputs/basic-lto.macho.x86_64 > %t3<br>
+RUN: cat %p/../Inputs/basic-lto-dw4.macho.x86_64 > %t4<br>
+RUN: llvm-dsymutil -oso-prepend-path=%p/.. %t1 %t2 %t3 %t4<br>
+RUN: llvm-dwarfdump %t1.dwarf \<br>
+ | FileCheck %S/basic-linking-x86.test --check-prefix=CHECK --check-prefix=BASIC<br></blockquote><div><br></div><div>FYI, this line must be also prefixed with RUN:. Fixed in r243868.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+RUN: llvm-dwarfdump %t2.dwarf \<br>
+ | FileCheck %S/basic-linking-x86.test --check-prefix=CHECK --check-prefix=ARCHIVE<br></blockquote><div><br></div><div>ditto</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+RUN: llvm-dwarfdump %t3.dwarf | FileCheck %S/basic-lto-linking-x86.test<br>
+RUN: llvm-dwarfdump %t4.dwarf | FileCheck %S/basic-lto-dw4-linking-x86.test<br>
<br>
Modified: llvm/trunk/test/tools/dsymutil/basic-linking.test<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_tools_dsymutil_basic-2Dlinking.test-3Frev-3D243777-26r1-3D243776-26r2-3D243777-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=h03ZKl9nPTKCBsuqwJSfDrGVJxBG3VuKyGqSFarKVKc&s=WP7H_HOgUc54LEEQd1IV221ofvbEXGYjqrd_8NG-MLQ&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/basic-linking.test?rev=243777&r1=243776&r2=243777&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/test/tools/dsymutil/basic-linking.test (original)<br>
+++ llvm/trunk/test/tools/dsymutil/basic-linking.test Fri Jul 31 15:22:20 2015<br>
@@ -1,6 +1,7 @@<br>
 RUN: llvm-dsymutil -no-output -verbose -oso-prepend-path=%p %p/Inputs/basic.macho.x86_64 | FileCheck %s<br>
 RUN: llvm-dsymutil -no-output -verbose -oso-prepend-path=%p %p/Inputs/basic-lto.macho.x86_64 | FileCheck %s --check-prefix=CHECK-LTO<br>
 RUN: llvm-dsymutil -no-output -verbose -oso-prepend-path=%p %p/Inputs/basic-archive.macho.x86_64 | FileCheck %s --check-prefix=CHECK-ARCHIVE<br>
+RUN: llvm-dsymutil -no-output -verbose -oso-prepend-path=%p %p/Inputs/basic.macho.x86_64 %p/Inputs/basic-lto.macho.x86_64 %p/Inputs/basic-archive.macho.x86_64 | FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-LTO --check-prefix=CHECK-ARCHIVE<br>
<br>
 This test check the basic Dwarf linking process through the debug dumps.<br>
<br>
<br>
Modified: llvm/trunk/tools/dsymutil/dsymutil.cpp<br>
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_tools_dsymutil_dsymutil.cpp-3Frev-3D243777-26r1-3D243776-26r2-3D243777-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=h03ZKl9nPTKCBsuqwJSfDrGVJxBG3VuKyGqSFarKVKc&s=IL3F13eg77nde8ZwJOyyJ6iONcuIAPOZhxb59yWiydc&e=" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/dsymutil.cpp?rev=243777&r1=243776&r2=243777&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/tools/dsymutil/dsymutil.cpp (original)<br>
+++ llvm/trunk/tools/dsymutil/dsymutil.cpp Fri Jul 31 15:22:20 2015<br>
@@ -31,8 +31,8 @@ OptionCategory DsymCategory("Specific Op<br>
 static opt<bool> Help("h", desc("Alias for -help"), Hidden);<br>
 static opt<bool> Version("v", desc("Alias for -version"), Hidden);<br>
<br>
-static opt<std::string> InputFile(Positional, desc("<input file>"),<br>
-                                  init("a.out"), cat(DsymCategory));<br>
+static list<std::string> InputFiles(Positional, OneOrMore,<br>
+                                    desc("<input files>"), cat(DsymCategory));<br>
<br>
 static opt<std::string><br>
     OutputFileOpt("o",<br>
@@ -90,9 +90,6 @@ int main(int argc, char **argv) {<br>
     return 0;<br>
   }<br>
<br>
-  auto DebugMapPtrOrErr =<br>
-      parseDebugMap(InputFile, OsoPrependPath, Verbose, InputIsYAMLDebugMap);<br>
-<br>
   Options.Verbose = Verbose;<br>
   Options.NoOutput = NoOutput;<br>
   Options.NoODR = NoODR;<br>
@@ -102,27 +99,40 @@ int main(int argc, char **argv) {<br>
   llvm::InitializeAllTargets();<br>
   llvm::InitializeAllAsmPrinters();<br>
<br>
-  if (auto EC = DebugMapPtrOrErr.getError()) {<br>
-    llvm::errs() << "error: cannot parse the debug map for \"" << InputFile<br>
-                 << "\": " << EC.message() << '\n';<br>
+  if (InputFiles.size() > 1 && !OutputFileOpt.empty()) {<br>
+    llvm::errs() << "error: cannot use -o with multiple inputs\n";<br>
     return 1;<br>
   }<br>
<br>
-  if (Verbose || DumpDebugMap)<br>
-    (*DebugMapPtrOrErr)->print(llvm::outs());<br>
-<br>
-  if (DumpDebugMap)<br>
-    return 0;<br>
+  for (auto &InputFile : InputFiles) {<br>
+    auto DebugMapPtrOrErr =<br>
+        parseDebugMap(InputFile, OsoPrependPath, Verbose, InputIsYAMLDebugMap);<br>
+<br>
+    if (auto EC = DebugMapPtrOrErr.getError()) {<br>
+      llvm::errs() << "error: cannot parse the debug map for \"" << InputFile<br>
+                   << "\": " << EC.message() << '\n';<br>
+      return 1;<br>
+    }<br>
+<br>
+    if (Verbose || DumpDebugMap)<br>
+      (*DebugMapPtrOrErr)->print(llvm::outs());<br>
+<br>
+    if (DumpDebugMap)<br>
+      continue;<br>
+<br>
+    std::string OutputFile;<br>
+    if (OutputFileOpt.empty()) {<br>
+      if (InputFile == "-")<br>
+        OutputFile = "a.out.dwarf";<br>
+      else<br>
+        OutputFile = InputFile + ".dwarf";<br>
+    } else {<br>
+      OutputFile = OutputFileOpt;<br>
+    }<br>
<br>
-  std::string OutputFile;<br>
-  if (OutputFileOpt.empty()) {<br>
-    if (InputFile == "-")<br>
-      OutputFile = "a.out.dwarf";<br>
-    else<br>
-      OutputFile = InputFile + ".dwarf";<br>
-  } else {<br>
-    OutputFile = OutputFileOpt;<br>
+    if (!linkDwarf(OutputFile, **DebugMapPtrOrErr, Options))<br>
+      return 1;<br>
   }<br>
<br>
-  return !linkDwarf(OutputFile, **DebugMapPtrOrErr, Options);<br>
+  return 0;<br>
 }<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><div><br></div>
</div></div>