1 //===-- RuntimeDyld.h - Run-time dynamic linker for MC-JIT ------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // Interface for the runtime dynamic linker facilities of the MC-JIT.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_EXECUTIONENGINE_RUNTIMEDYLD_H
15 #define LLVM_EXECUTIONENGINE_RUNTIMEDYLD_H
17 #include "llvm/ADT/StringRef.h"
18 #include "llvm/ExecutionEngine/ObjectBuffer.h"
19 #include "llvm/ExecutionEngine/RTDyldMemoryManager.h"
20 #include "llvm/Support/Memory.h"
24 class RuntimeDyldImpl;
28 RuntimeDyld(const RuntimeDyld &) LLVM_DELETED_FUNCTION;
29 void operator=(const RuntimeDyld &) LLVM_DELETED_FUNCTION;
31 // RuntimeDyldImpl is the actual class. RuntimeDyld is just the public
33 RuntimeDyldImpl *Dyld;
34 RTDyldMemoryManager *MM;
36 // Change the address associated with a section when resolving relocations.
37 // Any relocations already associated with the symbol will be re-resolved.
38 void reassignSectionAddress(unsigned SectionID, uint64_t Addr);
40 RuntimeDyld(RTDyldMemoryManager *);
43 /// Prepare the object contained in the input buffer for execution.
44 /// Ownership of the input buffer is transferred to the ObjectImage
45 /// instance returned from this function if successful. In the case of load
46 /// failure, the input buffer will be deleted.
47 ObjectImage *loadObject(ObjectBuffer *InputBuffer);
49 /// Get the address of our local copy of the symbol. This may or may not
50 /// be the address used for relocation (clients can copy the data around
51 /// and resolve relocatons based on where they put it).
52 void *getSymbolAddress(StringRef Name);
54 /// Get the address of the target copy of the symbol. This is the address
55 /// used for relocation.
56 uint64_t getSymbolLoadAddress(StringRef Name);
58 /// Resolve the relocations for all symbols we currently know about.
59 void resolveRelocations();
61 /// Map a section to its target address space value.
62 /// Map the address of a JIT section as returned from the memory manager
63 /// to the address in the target process as the running code will see it.
64 /// This is the address which will be used for relocation resolution.
65 void mapSectionAddress(const void *LocalAddress, uint64_t TargetAddress);
67 StringRef getErrorString();
69 StringRef getEHFrameSection();
72 } // end namespace llvm