Path: blob/main/contrib/llvm-project/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCheckerImpl.h
35266 views
//===-- RuntimeDyldCheckerImpl.h -- RuntimeDyld test framework --*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_RUNTIMEDYLDCHECKERIMPL_H9#define LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_RUNTIMEDYLDCHECKERIMPL_H1011#include "RuntimeDyldImpl.h"1213namespace llvm {1415/// Holds target-specific properties for a symbol.16using TargetFlagsType = uint8_t;1718class RuntimeDyldCheckerImpl {19friend class RuntimeDyldChecker;20friend class RuntimeDyldCheckerExprEval;2122using IsSymbolValidFunction =23RuntimeDyldChecker::IsSymbolValidFunction;24using GetSymbolInfoFunction = RuntimeDyldChecker::GetSymbolInfoFunction;25using GetSectionInfoFunction = RuntimeDyldChecker::GetSectionInfoFunction;26using GetStubInfoFunction = RuntimeDyldChecker::GetStubInfoFunction;27using GetGOTInfoFunction = RuntimeDyldChecker::GetGOTInfoFunction;2829public:30RuntimeDyldCheckerImpl(IsSymbolValidFunction IsSymbolValid,31GetSymbolInfoFunction GetSymbolInfo,32GetSectionInfoFunction GetSectionInfo,33GetStubInfoFunction GetStubInfo,34GetGOTInfoFunction GetGOTInfo,35llvm::endianness Endianness, Triple TT, StringRef CPU,36SubtargetFeatures TF, llvm::raw_ostream &ErrStream);3738bool check(StringRef CheckExpr) const;39bool checkAllRulesInBuffer(StringRef RulePrefix, MemoryBuffer *MemBuf) const;4041private:4243// StubMap typedefs.4445Expected<JITSymbolResolver::LookupResult>46lookup(const JITSymbolResolver::LookupSet &Symbols) const;4748bool isSymbolValid(StringRef Symbol) const;49uint64_t getSymbolLocalAddr(StringRef Symbol) const;50uint64_t getSymbolRemoteAddr(StringRef Symbol) const;51uint64_t readMemoryAtAddr(uint64_t Addr, unsigned Size) const;5253StringRef getSymbolContent(StringRef Symbol) const;5455TargetFlagsType getTargetFlag(StringRef Symbol) const;56Triple getTripleForSymbol(TargetFlagsType Flag) const;57StringRef getCPU() const { return CPU; }58SubtargetFeatures getFeatures() const { return TF; }5960std::pair<uint64_t, std::string> getSectionAddr(StringRef FileName,61StringRef SectionName,62bool IsInsideLoad) const;6364std::pair<uint64_t, std::string>65getStubOrGOTAddrFor(StringRef StubContainerName, StringRef Symbol,66StringRef StubKindFilter, bool IsInsideLoad,67bool IsStubAddr) const;6869std::optional<uint64_t> getSectionLoadAddress(void *LocalAddr) const;7071IsSymbolValidFunction IsSymbolValid;72GetSymbolInfoFunction GetSymbolInfo;73GetSectionInfoFunction GetSectionInfo;74GetStubInfoFunction GetStubInfo;75GetGOTInfoFunction GetGOTInfo;76llvm::endianness Endianness;77Triple TT;78std::string CPU;79SubtargetFeatures TF;80llvm::raw_ostream &ErrStream;81};82}8384#endif858687