brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.1 KiB · bda554e Raw
86 lines · c
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-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_RUNTIMEDYLDCHECKERIMPL_H10#define LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_RUNTIMEDYLDCHECKERIMPL_H11 12#include "RuntimeDyldImpl.h"13 14namespace llvm {15 16/// Holds target-specific properties for a symbol.17using TargetFlagsType = uint8_t;18 19class RuntimeDyldCheckerImpl {20  friend class RuntimeDyldChecker;21  friend class RuntimeDyldCheckerExprEval;22 23  using IsSymbolValidFunction =24    RuntimeDyldChecker::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,37                         SubtargetFeatures TF, llvm::raw_ostream &ErrStream);38 39  bool check(StringRef CheckExpr) const;40  bool checkAllRulesInBuffer(StringRef RulePrefix, MemoryBuffer *MemBuf) const;41 42private:43 44  // StubMap typedefs.45 46  Expected<JITSymbolResolver::LookupResult>47  lookup(const JITSymbolResolver::LookupSet &Symbols) const;48 49  bool isSymbolValid(StringRef Symbol) const;50  uint64_t getSymbolLocalAddr(StringRef Symbol) const;51  uint64_t getSymbolRemoteAddr(StringRef Symbol) const;52  uint64_t readMemoryAtAddr(uint64_t Addr, unsigned Size) const;53 54  StringRef getSymbolContent(StringRef Symbol) const;55 56  TargetFlagsType getTargetFlag(StringRef Symbol) const;57  Triple getTripleForSymbol(TargetFlagsType Flag) const;58  StringRef getCPU() const { return CPU; }59  SubtargetFeatures getFeatures() const { return TF; }60 61  std::pair<uint64_t, std::string> getSectionAddr(StringRef FileName,62                                                  StringRef SectionName,63                                                  bool IsInsideLoad) const;64 65  std::pair<uint64_t, std::string>66  getStubOrGOTAddrFor(StringRef StubContainerName, StringRef Symbol,67                      StringRef StubKindFilter, bool IsInsideLoad,68                      bool IsStubAddr) const;69 70  std::optional<uint64_t> getSectionLoadAddress(void *LocalAddr) const;71 72  IsSymbolValidFunction IsSymbolValid;73  GetSymbolInfoFunction GetSymbolInfo;74  GetSectionInfoFunction GetSectionInfo;75  GetStubInfoFunction GetStubInfo;76  GetGOTInfoFunction GetGOTInfo;77  llvm::endianness Endianness;78  Triple TT;79  std::string CPU;80  SubtargetFeatures TF;81  llvm::raw_ostream &ErrStream;82};83}84 85#endif86