aboutsummaryrefslogtreecommitdiffstats
path: root/tools/dsymutil/dsymutil.cpp
diff options
context:
space:
mode:
authorPirama Arumuga Nainar <pirama@google.com>2015-04-10 21:22:52 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-04-10 21:23:04 +0000
commit31195f0bdca6ee2a5e72d07edf13e1d81206d949 (patch)
tree1b2c9792582e12f5af0b1512e3094425f0dc0df9 /tools/dsymutil/dsymutil.cpp
parentc75239e6119d0f9a74c57099d91cbc9bde56bf33 (diff)
parent4c5e43da7792f75567b693105cc53e3f1992ad98 (diff)
downloadexternal_llvm-31195f0bdca6ee2a5e72d07edf13e1d81206d949.zip
external_llvm-31195f0bdca6ee2a5e72d07edf13e1d81206d949.tar.gz
external_llvm-31195f0bdca6ee2a5e72d07edf13e1d81206d949.tar.bz2
Merge "Update aosp/master llvm for rebase to r233350"
Diffstat (limited to 'tools/dsymutil/dsymutil.cpp')
-rw-r--r--tools/dsymutil/dsymutil.cpp32
1 files changed, 28 insertions, 4 deletions
diff --git a/tools/dsymutil/dsymutil.cpp b/tools/dsymutil/dsymutil.cpp
index 2b4fcfe..4fc91b0 100644
--- a/tools/dsymutil/dsymutil.cpp
+++ b/tools/dsymutil/dsymutil.cpp
@@ -19,6 +19,7 @@
#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/Signals.h"
#include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/TargetSelect.h"
#include <string>
using namespace llvm::dsymutil;
@@ -29,6 +30,10 @@ using namespace llvm::cl;
static opt<std::string> InputFile(Positional, desc("<input file>"),
init("a.out"));
+static opt<std::string> OutputFileOpt("o", desc("Specify the output file."
+ " default: <input file>.dwarf"),
+ value_desc("filename"));
+
static opt<std::string> OsoPrependPath("oso-prepend-path",
desc("Specify a directory to prepend "
"to the paths of object files."),
@@ -36,6 +41,10 @@ static opt<std::string> OsoPrependPath("oso-prepend-path",
static opt<bool> Verbose("v", desc("Verbosity level"), init(false));
+static opt<bool> NoOutput("no-output", desc("Do the link in memory, but do "
+ "not emit the result file."),
+ init(false));
+
static opt<bool>
ParseOnly("parse-only",
desc("Only parse the debug map, do not actaully link "
@@ -47,10 +56,19 @@ int main(int argc, char **argv) {
llvm::sys::PrintStackTraceOnErrorSignal();
llvm::PrettyStackTraceProgram StackPrinter(argc, argv);
llvm::llvm_shutdown_obj Shutdown;
+ LinkOptions Options;
llvm::cl::ParseCommandLineOptions(argc, argv, "llvm dsymutil\n");
auto DebugMapPtrOrErr = parseDebugMap(InputFile, OsoPrependPath, Verbose);
+ Options.Verbose = Verbose;
+ Options.NoOutput = NoOutput;
+
+ llvm::InitializeAllTargetInfos();
+ llvm::InitializeAllTargetMCs();
+ llvm::InitializeAllTargets();
+ llvm::InitializeAllAsmPrinters();
+
if (auto EC = DebugMapPtrOrErr.getError()) {
llvm::errs() << "error: cannot parse the debug map for \"" << InputFile
<< "\": " << EC.message() << '\n';
@@ -63,9 +81,15 @@ int main(int argc, char **argv) {
if (ParseOnly)
return 0;
- std::string OutputBasename(InputFile);
- if (OutputBasename == "-")
- OutputBasename = "a.out";
+ std::string OutputFile;
+ if (OutputFileOpt.empty()) {
+ if (InputFile == "-")
+ OutputFile = "a.out.dwarf";
+ else
+ OutputFile = InputFile + ".dwarf";
+ } else {
+ OutputFile = OutputFileOpt;
+ }
- return !linkDwarf(OutputBasename + ".dwarf", **DebugMapPtrOrErr, Verbose);
+ return !linkDwarf(OutputFile, **DebugMapPtrOrErr, Options);
}