summaryrefslogtreecommitdiff
path: root/tools/lld/lld.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/lld/lld.cpp')
-rw-r--r--tools/lld/lld.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/tools/lld/lld.cpp b/tools/lld/lld.cpp
new file mode 100644
index 000000000000..24c3a66a3ac3
--- /dev/null
+++ b/tools/lld/lld.cpp
@@ -0,0 +1,36 @@
+//===- tools/lld/lld.cpp - Linker Driver Dispatcher -----------------------===//
+//
+// The LLVM Linker
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+///
+/// This is the entry point to the lld driver. This is a thin wrapper which
+/// dispatches to the given platform specific driver.
+///
+//===----------------------------------------------------------------------===//
+
+#include "lld/Core/LLVM.h"
+#include "lld/Driver/Driver.h"
+#include "llvm/Support/ManagedStatic.h"
+#include "llvm/Support/PrettyStackTrace.h"
+#include "llvm/Support/Signals.h"
+
+using namespace lld;
+
+
+/// Universal linker main(). This linker eumulates the gnu, darwin, or
+/// windows linker based on the tool name or if the first argument is
+/// -flavor.
+int main(int argc, const char *argv[]) {
+ // Standard set up, so program fails gracefully.
+ llvm::sys::PrintStackTraceOnErrorSignal();
+ llvm::PrettyStackTraceProgram stackPrinter(argc, argv);
+ llvm::llvm_shutdown_obj shutdown;
+
+ return UniversalDriver::link(argc, argv) ? 0 : 1;
+}