LLVM 24.0.0git
RuntimeDyldCheckerImpl.h
Go to the documentation of this file.
1//===-- RuntimeDyldCheckerImpl.h -- RuntimeDyld test framework --*- 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#ifndef LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_RUNTIMEDYLDCHECKERIMPL_H
10#define LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_RUNTIMEDYLDCHECKERIMPL_H
11
12#include "RuntimeDyldImpl.h"
13
14namespace llvm {
15
16/// Holds target-specific properties for a symbol.
17using TargetFlagsType = uint8_t;
18
20 friend class RuntimeDyldChecker;
22
23 using IsSymbolValidFunction =
25 using GetSymbolInfoFunction = RuntimeDyldChecker::GetSymbolInfoFunction;
26 using GetSectionInfoFunction = RuntimeDyldChecker::GetSectionInfoFunction;
27 using GetStubInfoFunction = RuntimeDyldChecker::GetStubInfoFunction;
28 using GetGOTInfoFunction = RuntimeDyldChecker::GetGOTInfoFunction;
29
30public:
31 RuntimeDyldCheckerImpl(IsSymbolValidFunction IsSymbolValid,
32 GetSymbolInfoFunction GetSymbolInfo,
33 GetSectionInfoFunction GetSectionInfo,
34 GetStubInfoFunction GetStubInfo,
35 GetGOTInfoFunction GetGOTInfo,
36 llvm::endianness Endianness, Triple TT, StringRef CPU,
38
39 bool check(StringRef CheckExpr) const;
40 bool checkAllRulesInBuffer(StringRef RulePrefix, MemoryBuffer *MemBuf) const;
41
42private:
43
44 // StubMap typedefs.
45
46 bool isSymbolValid(StringRef Symbol) const;
47 uint64_t getSymbolLocalAddr(StringRef Symbol) const;
48 uint64_t getSymbolRemoteAddr(StringRef Symbol) const;
49 uint64_t readMemoryAtAddr(uint64_t Addr, unsigned Size) const;
50
51 StringRef getSymbolContent(StringRef Symbol) const;
52
53 TargetFlagsType getTargetFlag(StringRef Symbol) const;
54 Triple getTripleForSymbol(TargetFlagsType Flag) const;
55 StringRef getCPU() const { return CPU; }
56 SubtargetFeatures getFeatures() const { return TF; }
57
58 std::pair<uint64_t, std::string> getSectionAddr(StringRef FileName,
60 bool IsInsideLoad) const;
61
62 std::pair<uint64_t, std::string>
63 getStubOrGOTAddrFor(StringRef StubContainerName, StringRef Symbol,
64 StringRef StubKindFilter, bool IsInsideLoad,
65 bool IsStubAddr) const;
66
67 IsSymbolValidFunction IsSymbolValid;
68 GetSymbolInfoFunction GetSymbolInfo;
69 GetSectionInfoFunction GetSectionInfo;
70 GetStubInfoFunction GetStubInfo;
71 GetGOTInfoFunction GetGOTInfo;
72 llvm::endianness Endianness;
73 Triple TT;
74 std::string CPU;
76 llvm::raw_ostream &ErrStream;
77};
78}
79
80#endif
static FeatureBitset getFeatures(MCSubtargetInfo &STI, StringRef CPU, StringRef TuneCPU, StringRef FS, StringTable ProcNames, ArrayRef< SubtargetSubTypeKV > ProcDesc, ArrayRef< SubtargetFeatureKV > ProcFeatures)
This interface provides simple read-only access to a block of memory, and provides simple methods for...
bool checkAllRulesInBuffer(StringRef RulePrefix, MemoryBuffer *MemBuf) const
bool check(StringRef CheckExpr) const
RuntimeDyldCheckerImpl(IsSymbolValidFunction IsSymbolValid, GetSymbolInfoFunction GetSymbolInfo, GetSectionInfoFunction GetSectionInfo, GetStubInfoFunction GetStubInfo, GetGOTInfoFunction GetGOTInfo, llvm::endianness Endianness, Triple TT, StringRef CPU, SubtargetFeatures TF, llvm::raw_ostream &ErrStream)
std::function< bool(StringRef Symbol)> IsSymbolValidFunction
std::function< Expected< MemoryRegionInfo >( StringRef FileName, StringRef SectionName)> GetSectionInfoFunction
std::function< Expected< MemoryRegionInfo >( StringRef GOTContainer, StringRef TargetName)> GetGOTInfoFunction
std::function< Expected< MemoryRegionInfo >(StringRef SymbolName)> GetSymbolInfoFunction
std::function< Expected< MemoryRegionInfo >( StringRef StubContainer, StringRef TargetName, StringRef StubKindFilter)> GetStubInfoFunction
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
Manages the enabling and disabling of subtarget specific features.
Triple - Helper class for working with autoconf configuration names.
Definition Triple.h:48
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
This is an optimization pass for GlobalISel generic memory operations.
static StringRef getCPU(StringRef CPU)
Processes a CPU name.
endianness
Definition bit.h:71
uint8_t TargetFlagsType
Holds target-specific properties for a symbol.