diff options
Diffstat (limited to 'lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCheckerImpl.h')
-rw-r--r-- | lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCheckerImpl.h | 59 |
1 files changed, 26 insertions, 33 deletions
diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCheckerImpl.h b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCheckerImpl.h index 6da1a68d06d6..ac9d4d460217 100644 --- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCheckerImpl.h +++ b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCheckerImpl.h @@ -1,9 +1,8 @@ //===-- RuntimeDyldCheckerImpl.h -- RuntimeDyld test framework --*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -16,14 +15,22 @@ namespace llvm { class RuntimeDyldCheckerImpl { friend class RuntimeDyldChecker; - friend class RuntimeDyldImpl; friend class RuntimeDyldCheckerExprEval; - friend class RuntimeDyldELF; + + using IsSymbolValidFunction = + RuntimeDyldChecker::IsSymbolValidFunction; + using GetSymbolInfoFunction = RuntimeDyldChecker::GetSymbolInfoFunction; + using GetSectionInfoFunction = RuntimeDyldChecker::GetSectionInfoFunction; + using GetStubInfoFunction = RuntimeDyldChecker::GetStubInfoFunction; + using GetGOTInfoFunction = RuntimeDyldChecker::GetGOTInfoFunction; public: - RuntimeDyldCheckerImpl(RuntimeDyld &RTDyld, MCDisassembler *Disassembler, - MCInstPrinter *InstPrinter, - llvm::raw_ostream &ErrStream); + RuntimeDyldCheckerImpl( + IsSymbolValidFunction IsSymbolValid, GetSymbolInfoFunction GetSymbolInfo, + GetSectionInfoFunction GetSectionInfo, GetStubInfoFunction GetStubInfo, + GetGOTInfoFunction GetGOTInfo, support::endianness Endianness, + MCDisassembler *Disassembler, MCInstPrinter *InstPrinter, + llvm::raw_ostream &ErrStream); bool check(StringRef CheckExpr) const; bool checkAllRulesInBuffer(StringRef RulePrefix, MemoryBuffer *MemBuf) const; @@ -31,15 +38,6 @@ public: private: // StubMap typedefs. - typedef std::map<std::string, uint64_t> StubOffsetsMap; - struct SectionAddressInfo { - uint64_t SectionID; - StubOffsetsMap StubOffsets; - }; - typedef std::map<std::string, SectionAddressInfo> SectionMap; - typedef std::map<std::string, SectionMap> StubMap; - - RuntimeDyldImpl &getRTDyld() const { return *RTDyld.Dyld; } Expected<JITSymbolResolver::LookupResult> lookup(const JITSymbolResolver::LookupSet &Symbols) const; @@ -49,32 +47,27 @@ private: uint64_t getSymbolRemoteAddr(StringRef Symbol) const; uint64_t readMemoryAtAddr(uint64_t Addr, unsigned Size) const; - std::pair<const SectionAddressInfo*, std::string> findSectionAddrInfo( - StringRef FileName, - StringRef SectionName) const; + StringRef getSymbolContent(StringRef Symbol) const; std::pair<uint64_t, std::string> getSectionAddr(StringRef FileName, StringRef SectionName, bool IsInsideLoad) const; - std::pair<uint64_t, std::string> getStubAddrFor(StringRef FileName, - StringRef SectionName, - StringRef Symbol, - bool IsInsideLoad) const; - StringRef getSubsectionStartingAt(StringRef Name) const; + std::pair<uint64_t, std::string> + getStubOrGOTAddrFor(StringRef StubContainerName, StringRef Symbol, + bool IsInsideLoad, bool IsStubAddr) const; Optional<uint64_t> getSectionLoadAddress(void *LocalAddr) const; - void registerSection(StringRef FilePath, unsigned SectionID); - void registerStubMap(StringRef FilePath, unsigned SectionID, - const RuntimeDyldImpl::StubMap &RTDyldStubs); - - RuntimeDyld &RTDyld; + IsSymbolValidFunction IsSymbolValid; + GetSymbolInfoFunction GetSymbolInfo; + GetSectionInfoFunction GetSectionInfo; + GetStubInfoFunction GetStubInfo; + GetGOTInfoFunction GetGOTInfo; + support::endianness Endianness; MCDisassembler *Disassembler; MCInstPrinter *InstPrinter; llvm::raw_ostream &ErrStream; - - StubMap Stubs; }; } |