Mercurial > hg > CbC > CbC_llvm
comparison lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCOFF.cpp @ 120:1172e4bd9c6f
update 4.0.0
author | mir3636 |
---|---|
date | Fri, 25 Nov 2016 19:14:25 +0900 |
parents | 7d135dc70f03 |
children | 803732b1fca8 |
comparison
equal
deleted
inserted
replaced
101:34baf5011add | 120:1172e4bd9c6f |
---|---|
11 // | 11 // |
12 //===----------------------------------------------------------------------===// | 12 //===----------------------------------------------------------------------===// |
13 | 13 |
14 #include "RuntimeDyldCOFF.h" | 14 #include "RuntimeDyldCOFF.h" |
15 #include "Targets/RuntimeDyldCOFFI386.h" | 15 #include "Targets/RuntimeDyldCOFFI386.h" |
16 #include "Targets/RuntimeDyldCOFFThumb.h" | |
16 #include "Targets/RuntimeDyldCOFFX86_64.h" | 17 #include "Targets/RuntimeDyldCOFFX86_64.h" |
17 #include "llvm/ADT/STLExtras.h" | 18 #include "llvm/ADT/STLExtras.h" |
18 #include "llvm/ADT/Triple.h" | 19 #include "llvm/ADT/Triple.h" |
19 #include "llvm/Object/ObjectFile.h" | 20 #include "llvm/Object/ObjectFile.h" |
20 | 21 |
41 namespace llvm { | 42 namespace llvm { |
42 | 43 |
43 std::unique_ptr<RuntimeDyldCOFF> | 44 std::unique_ptr<RuntimeDyldCOFF> |
44 llvm::RuntimeDyldCOFF::create(Triple::ArchType Arch, | 45 llvm::RuntimeDyldCOFF::create(Triple::ArchType Arch, |
45 RuntimeDyld::MemoryManager &MemMgr, | 46 RuntimeDyld::MemoryManager &MemMgr, |
46 RuntimeDyld::SymbolResolver &Resolver) { | 47 JITSymbolResolver &Resolver) { |
47 switch (Arch) { | 48 switch (Arch) { |
48 default: | 49 default: llvm_unreachable("Unsupported target for RuntimeDyldCOFF."); |
49 llvm_unreachable("Unsupported target for RuntimeDyldCOFF."); | |
50 break; | |
51 case Triple::x86: | 50 case Triple::x86: |
52 return make_unique<RuntimeDyldCOFFI386>(MemMgr, Resolver); | 51 return make_unique<RuntimeDyldCOFFI386>(MemMgr, Resolver); |
52 case Triple::thumb: | |
53 return make_unique<RuntimeDyldCOFFThumb>(MemMgr, Resolver); | |
53 case Triple::x86_64: | 54 case Triple::x86_64: |
54 return make_unique<RuntimeDyldCOFFX86_64>(MemMgr, Resolver); | 55 return make_unique<RuntimeDyldCOFFX86_64>(MemMgr, Resolver); |
55 } | 56 } |
56 } | 57 } |
57 | 58 |
58 std::unique_ptr<RuntimeDyld::LoadedObjectInfo> | 59 std::unique_ptr<RuntimeDyld::LoadedObjectInfo> |
59 RuntimeDyldCOFF::loadObject(const object::ObjectFile &O) { | 60 RuntimeDyldCOFF::loadObject(const object::ObjectFile &O) { |
60 return llvm::make_unique<LoadedCOFFObjectInfo>(*this, loadObjectImpl(O)); | 61 if (auto ObjSectionToIDOrErr = loadObjectImpl(O)) { |
62 return llvm::make_unique<LoadedCOFFObjectInfo>(*this, *ObjSectionToIDOrErr); | |
63 } else { | |
64 HasError = true; | |
65 raw_string_ostream ErrStream(ErrorStr); | |
66 logAllUnhandledErrors(ObjSectionToIDOrErr.takeError(), ErrStream, ""); | |
67 return nullptr; | |
68 } | |
61 } | 69 } |
62 | 70 |
63 uint64_t RuntimeDyldCOFF::getSymbolOffset(const SymbolRef &Sym) { | 71 uint64_t RuntimeDyldCOFF::getSymbolOffset(const SymbolRef &Sym) { |
64 // The value in a relocatable COFF object is the offset. | 72 // The value in a relocatable COFF object is the offset. |
65 return Sym.getValue(); | 73 return Sym.getValue(); |