--- /dev/null
+REQUIRES: shell
+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-dwarfdump %t1.dwarf \
+ | FileCheck %S/basic-linking-x86.test --check-prefix=CHECK --check-prefix=BASIC
+RUN: llvm-dwarfdump %t2.dwarf \
+ | FileCheck %S/basic-linking-x86.test --check-prefix=CHECK --check-prefix=ARCHIVE
+RUN: llvm-dwarfdump %t3.dwarf | FileCheck %S/basic-lto-linking-x86.test
+RUN: llvm-dwarfdump %t4.dwarf | FileCheck %S/basic-lto-dw4-linking-x86.test
static opt<bool> Help("h", desc("Alias for -help"), Hidden);
static opt<bool> Version("v", desc("Alias for -version"), Hidden);
-static opt<std::string> InputFile(Positional, desc("<input file>"),
- init("a.out"), cat(DsymCategory));
+static list<std::string> InputFiles(Positional, OneOrMore,
+ desc("<input files>"), cat(DsymCategory));
static opt<std::string>
OutputFileOpt("o",
return 0;
}
- auto DebugMapPtrOrErr =
- parseDebugMap(InputFile, OsoPrependPath, Verbose, InputIsYAMLDebugMap);
-
Options.Verbose = Verbose;
Options.NoOutput = NoOutput;
Options.NoODR = NoODR;
llvm::InitializeAllTargets();
llvm::InitializeAllAsmPrinters();
- if (auto EC = DebugMapPtrOrErr.getError()) {
- llvm::errs() << "error: cannot parse the debug map for \"" << InputFile
- << "\": " << EC.message() << '\n';
+ if (InputFiles.size() > 1 && !OutputFileOpt.empty()) {
+ llvm::errs() << "error: cannot use -o with multiple inputs\n";
return 1;
}
- if (Verbose || DumpDebugMap)
- (*DebugMapPtrOrErr)->print(llvm::outs());
-
- if (DumpDebugMap)
- return 0;
-
- std::string OutputFile;
- if (OutputFileOpt.empty()) {
- if (InputFile == "-")
- OutputFile = "a.out.dwarf";
- else
- OutputFile = InputFile + ".dwarf";
- } else {
- OutputFile = OutputFileOpt;
+ for (auto &InputFile : InputFiles) {
+ auto DebugMapPtrOrErr =
+ parseDebugMap(InputFile, OsoPrependPath, Verbose, InputIsYAMLDebugMap);
+
+ if (auto EC = DebugMapPtrOrErr.getError()) {
+ llvm::errs() << "error: cannot parse the debug map for \"" << InputFile
+ << "\": " << EC.message() << '\n';
+ return 1;
+ }
+
+ if (Verbose || DumpDebugMap)
+ (*DebugMapPtrOrErr)->print(llvm::outs());
+
+ if (DumpDebugMap)
+ continue;
+
+ std::string OutputFile;
+ if (OutputFileOpt.empty()) {
+ if (InputFile == "-")
+ OutputFile = "a.out.dwarf";
+ else
+ OutputFile = InputFile + ".dwarf";
+ } else {
+ OutputFile = OutputFileOpt;
+ }
+
+ if (!linkDwarf(OutputFile, **DebugMapPtrOrErr, Options))
+ return 1;
}
- return !linkDwarf(OutputFile, **DebugMapPtrOrErr, Options);
+ return 0;
}