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/NativeReader.cpp b/lld/lib/Core/NativeReader.cpp
index 67084dc..01466d3 100644
--- a/lld/lib/Core/NativeReader.cpp
+++ b/lld/lib/Core/NativeReader.cpp
@@ -20,6 +20,7 @@
#include "llvm/Support/MemoryBuffer.h"
#include <vector>
+#include <memory>
namespace lld {
@@ -202,6 +203,7 @@
virtual const Atom* target() const;
virtual Addend addend() const;
virtual void setTarget(const Atom* newAtom);
+ virtual void setAddend(Addend a);
private:
// Used in rare cases when Reference is modified,
@@ -606,15 +608,19 @@
return reinterpret_cast<const NativeReferenceV1*>(p);
}
- const Atom* target(uint32_t index) const {
+ const Atom* target(uint16_t index) const {
+ if ( index == NativeReferenceIvarsV1::noTarget )
+ return nullptr;
assert(index < _targetsTableCount);
return _targetsTable[index];
}
- void setTarget(uint32_t index, const Atom* newAtom) const {
+ void setTarget(uint16_t index, const Atom* newAtom) const {
+ assert(index != NativeReferenceIvarsV1::noTarget);
assert(index > _targetsTableCount);
_targetsTable[index] = newAtom;
}
+
// private constructor, only called by make()
@@ -799,6 +805,10 @@
return _file->setTarget(_ivarData->targetIndex, newAtom);
}
+inline void NativeReferenceV1::setAddend(Addend a) {
+ assert(0 && "setAddend() not supported");
+}
+
//
// Instantiate an lld::File from the given native object file buffer