LLVM  14.0.0git
RuntimeDyldCOFF.h
Go to the documentation of this file.
1 //===-- RuntimeDyldCOFF.h - Run-time dynamic linker for MC-JIT ---*- C++ -*-==//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // COFF support for MC-JIT runtime dynamic linker.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_RUNTIME_DYLD_COFF_H
14 #define LLVM_RUNTIME_DYLD_COFF_H
15 
16 #include "RuntimeDyldImpl.h"
17 
18 #define DEBUG_TYPE "dyld"
19 
20 using namespace llvm;
21 
22 namespace llvm {
23 
24 // Common base class for COFF dynamic linker support.
25 // Concrete subclasses for each target can be found in ./Targets.
27 
28 public:
29  std::unique_ptr<RuntimeDyld::LoadedObjectInfo>
30  loadObject(const object::ObjectFile &Obj) override;
31  bool isCompatibleFile(const object::ObjectFile &Obj) const override;
32 
33  static std::unique_ptr<RuntimeDyldCOFF>
36 
37 protected:
39  JITSymbolResolver &Resolver, unsigned PointerSize,
40  uint32_t PointerReloc)
41  : RuntimeDyldImpl(MemMgr, Resolver), PointerSize(PointerSize),
42  PointerReloc(PointerReloc) {
43  assert((PointerSize == 4 || PointerSize == 8) && "Unexpected pointer size");
44  }
45 
47  uint64_t getDLLImportOffset(unsigned SectionID, StubMap &Stubs,
48  StringRef Name, bool SetSectionIDMinus1 = false);
49 
50  static constexpr StringRef getImportSymbolPrefix() { return "__imp_"; }
51 
52 private:
53  unsigned PointerSize;
54  uint32_t PointerReloc;
55 };
56 
57 } // end namespace llvm
58 
59 #undef DEBUG_TYPE
60 
61 #endif
RuntimeDyldImpl.h
llvm::RuntimeDyldCOFF::loadObject
std::unique_ptr< RuntimeDyld::LoadedObjectInfo > loadObject(const object::ObjectFile &Obj) override
Definition: RuntimeDyldCOFF.cpp:66
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
llvm::RuntimeDyldImpl::MemMgr
RuntimeDyld::MemoryManager & MemMgr
Definition: RuntimeDyldImpl.h:244
llvm::RuntimeDyldImpl
Definition: RuntimeDyldImpl.h:238
llvm::Resolver
Interface for looking up the initializer for a variable name, used by Init::resolveReferences.
Definition: Record.h:2013
llvm::Triple::ArchType
ArchType
Definition: Triple.h:47
llvm::RuntimeDyldCOFF::isCompatibleFile
bool isCompatibleFile(const object::ObjectFile &Obj) const override
Definition: RuntimeDyldCOFF.cpp:117
uint64_t
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::RuntimeDyldCOFF::getDLLImportOffset
uint64_t getDLLImportOffset(unsigned SectionID, StubMap &Stubs, StringRef Name, bool SetSectionIDMinus1=false)
Definition: RuntimeDyldCOFF.cpp:82
llvm::RuntimeDyldCOFF::getImportSymbolPrefix
static constexpr StringRef getImportSymbolPrefix()
Definition: RuntimeDyldCOFF.h:50
llvm::RuntimeDyldCOFF::getSymbolOffset
uint64_t getSymbolOffset(const SymbolRef &Sym)
Definition: RuntimeDyldCOFF.cpp:77
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
llvm::object::ObjectFile
This class is the base class for all object file types.
Definition: ObjectFile.h:228
uint32_t
llvm::JITSymbolResolver
Symbol resolution interface.
Definition: JITSymbol.h:371
llvm::RuntimeDyldCOFF
Definition: RuntimeDyldCOFF.h:26
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
llvm::RuntimeDyldImpl::Arch
Triple::ArchType Arch
Definition: RuntimeDyldImpl.h:288
llvm::RuntimeDyldCOFF::RuntimeDyldCOFF
RuntimeDyldCOFF(RuntimeDyld::MemoryManager &MemMgr, JITSymbolResolver &Resolver, unsigned PointerSize, uint32_t PointerReloc)
Definition: RuntimeDyldCOFF.h:38
llvm::object::SymbolRef
This is a value type class that represents a single symbol in the list of symbols in the object file.
Definition: ObjectFile.h:167
llvm::RuntimeDyldImpl::StubMap
std::map< RelocationValueRef, uintptr_t > StubMap
Definition: RuntimeDyldImpl.h:286
llvm::RuntimeDyldCOFF::create
static std::unique_ptr< RuntimeDyldCOFF > create(Triple::ArchType Arch, RuntimeDyld::MemoryManager &MemMgr, JITSymbolResolver &Resolver)
Definition: RuntimeDyldCOFF.cpp:49
llvm::RuntimeDyld::MemoryManager
Memory Management.
Definition: RuntimeDyld.h:92