mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-20 03:23:01 +02:00
9b94fee202
This relieves ObjectLinkingLayer clients of the responsibility of holding the memory manager. This makes it easier to select between RTDyldObjectLinkingLayer (which already owned its memory manager factory) and ObjectLinkingLayer at runtime as clients aren't required to hold a jitlink::MemoryManager field just in case ObjectLinkingLayer is selected.
73 lines
2.4 KiB
C++
73 lines
2.4 KiB
C++
//===---- llvm-jitlink.h - Session and format-specific decls ----*- C++ -*-===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// Utilities for remote-JITing with LLI.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLVM_TOOLS_LLVM_JITLINK_LLVM_JITLINK_H
|
|
#define LLVM_TOOLS_LLVM_JITLINK_LLVM_JITLINK_H
|
|
|
|
#include "llvm/ADT/Triple.h"
|
|
#include "llvm/ExecutionEngine/Orc/Core.h"
|
|
#include "llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h"
|
|
#include "llvm/ExecutionEngine/RuntimeDyldChecker.h"
|
|
#include "llvm/Support/Error.h"
|
|
#include "llvm/Support/raw_ostream.h"
|
|
|
|
#include <vector>
|
|
|
|
namespace llvm {
|
|
|
|
struct Session {
|
|
orc::ExecutionSession ES;
|
|
orc::JITDylib &MainJD;
|
|
orc::ObjectLinkingLayer ObjLayer;
|
|
std::vector<orc::JITDylib *> JDSearchOrder;
|
|
Triple TT;
|
|
|
|
Session(Triple TT);
|
|
void dumpSessionInfo(raw_ostream &OS);
|
|
void modifyPassConfig(const Triple &FTT,
|
|
jitlink::PassConfiguration &PassConfig);
|
|
|
|
using MemoryRegionInfo = RuntimeDyldChecker::MemoryRegionInfo;
|
|
|
|
struct FileInfo {
|
|
StringMap<MemoryRegionInfo> SectionInfos;
|
|
StringMap<MemoryRegionInfo> StubInfos;
|
|
StringMap<MemoryRegionInfo> GOTEntryInfos;
|
|
};
|
|
|
|
using SymbolInfoMap = StringMap<MemoryRegionInfo>;
|
|
using FileInfoMap = StringMap<FileInfo>;
|
|
|
|
Expected<FileInfo &> findFileInfo(StringRef FileName);
|
|
Expected<MemoryRegionInfo &> findSectionInfo(StringRef FileName,
|
|
StringRef SectionName);
|
|
Expected<MemoryRegionInfo &> findStubInfo(StringRef FileName,
|
|
StringRef TargetName);
|
|
Expected<MemoryRegionInfo &> findGOTEntryInfo(StringRef FileName,
|
|
StringRef TargetName);
|
|
|
|
bool isSymbolRegistered(StringRef Name);
|
|
Expected<MemoryRegionInfo &> findSymbolInfo(StringRef SymbolName,
|
|
Twine ErrorMsgStem);
|
|
|
|
SymbolInfoMap SymbolInfos;
|
|
FileInfoMap FileInfos;
|
|
uint64_t SizeBeforePruning = 0;
|
|
uint64_t SizeAfterFixups = 0;
|
|
};
|
|
|
|
Error registerMachOStubsAndGOT(Session &S, jitlink::LinkGraph &G);
|
|
|
|
} // end namespace llvm
|
|
|
|
#endif // LLVM_TOOLS_LLVM_JITLINK_LLVM_JITLINK_H
|