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/NativeWriter.cpp b/lld/lib/Core/NativeWriter.cpp
index 26112f8..09e0d9a 100644
--- a/lld/lib/Core/NativeWriter.cpp
+++ b/lld/lib/Core/NativeWriter.cpp
@@ -430,11 +430,13 @@
   }
 
   uint32_t getTargetIndex(const Atom* target) {
+    if ( target == nullptr )
+      return NativeReferenceIvarsV1::noTarget;
     TargetToIndex::const_iterator pos = _targetsTableIndex.find(target);
     if ( pos != _targetsTableIndex.end() ) {
       return pos->second;
     }
-    uint32_t result = _targetsTableIndex.size();
+    uint32_t result = _targetsTableIndex.size(); 
     _targetsTableIndex[target] = result;
     return result;
   }