First implementation of Darwin Platform.  It is rich enough to generate
a hello world executable from atoms.  There is still much to be flushed out.
Added one test case, test/darwin/hello-world.objtxt, which exercises the
darwin platform.

Added -platform option to lld-core tool to dynamically select platform.

llvm-svn: 154242
diff --git a/lld/lib/Core/Resolver.cpp b/lld/lib/Core/Resolver.cpp
index 4afbe4b..f0742a2 100644
--- a/lld/lib/Core/Resolver.cpp
+++ b/lld/lib/Core/Resolver.cpp
@@ -7,6 +7,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "lld/Core/LLVM.h"
 #include "lld/Core/Resolver.h"
 #include "lld/Core/Atom.h"
 #include "lld/Core/File.h"
@@ -359,7 +360,7 @@
 // get "main" atom for linkage unit
 const Atom *Resolver::entryPoint() {
   StringRef symbolName = _platform.entryPointName();
-  if (symbolName != nullptr)
+  if ( !symbolName.empty() )
     return _symbolTable.findByName(symbolName);
 
   return nullptr;
@@ -387,6 +388,7 @@
   this->linkTimeOptimize();
   this->tweakAtoms();
   this->_result.addAtoms(_atoms);
+  this->_result._mainAtom = this->entryPoint();
 }
 
 void Resolver::MergedFile::addAtom(const Atom& atom) {