[JITLink][MachO] Add convenience functions for default text/data sections.

The getMachODefaultTextSection and getMachODefaultRWDataSection functions
return the "__TEXT,__text" and "__DATA,__data" sections respectively, creating
empty sections if the default sections are not already present in the graph.
These functions can be used by utilities that want to add code or data to these
standard sections (e.g. these functions can be used to supply the section
argument to the createAnonymousPointerJumpStub and
createPointerJumpStubBlock functions in the various targets).
This commit is contained in:
Lang Hames
2024-10-22 17:17:30 -07:00
parent a461869db3
commit 6128ff6630
10 changed files with 184 additions and 121 deletions

View File

@@ -14,6 +14,7 @@
#define LLVM_EXECUTIONENGINE_JITLINK_MACHO_H
#include "llvm/ExecutionEngine/JITLink/JITLink.h"
#include "llvm/ExecutionEngine/Orc/Shared/MachOObjectFormat.h"
namespace llvm {
namespace jitlink {
@@ -33,6 +34,26 @@ createLinkGraphFromMachOObject(MemoryBufferRef ObjectBuffer);
void link_MachO(std::unique_ptr<LinkGraph> G,
std::unique_ptr<JITLinkContext> Ctx);
/// Get a pointer to the standard MachO data section (creates an empty
/// section with RW- permissions and standard lifetime if one does not
/// already exist).
inline Section &getMachODefaultRWDataSection(LinkGraph &G) {
if (auto *DataSec = G.findSectionByName(orc::MachODataDataSectionName))
return *DataSec;
return G.createSection(orc::MachODataDataSectionName,
orc::MemProt::Read | orc::MemProt::Write);
}
/// Get a pointer to the standard MachO text section (creates an empty
/// section with R-X permissions and standard lifetime if one does not
/// already exist).
inline Section &getMachODefaultTextSection(LinkGraph &G) {
if (auto *TextSec = G.findSectionByName(orc::MachOTextTextSectionName))
return *TextSec;
return G.createSection(orc::MachOTextTextSectionName,
orc::MemProt::Read | orc::MemProt::Exec);
}
} // end namespace jitlink
} // end namespace llvm

View File

@@ -49,6 +49,7 @@ extern StringRef MachOSwift5TypesSectionName;
extern StringRef MachOSwift5TypeRefSectionName;
extern StringRef MachOSwift5FieldMetadataSectionName;
extern StringRef MachOSwift5EntrySectionName;
extern StringRef MachOTextTextSectionName;
extern StringRef MachOThreadBSSSectionName;
extern StringRef MachOThreadDataSectionName;
extern StringRef MachOThreadVarsSectionName;

View File

@@ -42,6 +42,7 @@ StringRef MachOSwift5TypesSectionName = "__TEXT,__swift5_types";
StringRef MachOSwift5TypeRefSectionName = "__TEXT,__swift5_typeref";
StringRef MachOSwift5FieldMetadataSectionName = "__TEXT,__swift5_fieldmd";
StringRef MachOSwift5EntrySectionName = "__TEXT,__swift5_entry";
StringRef MachOTextTextSectionName = "__TEXT,__text";
StringRef MachOThreadBSSSectionName = "__DATA,__thread_bss";
StringRef MachOThreadDataSectionName = "__DATA,__thread_data";
StringRef MachOThreadVarsSectionName = "__DATA,__thread_vars";

View File

@@ -11,8 +11,9 @@ add_llvm_unittest(JITLinkTests
AArch32Tests.cpp
AArch32ErrorTests.cpp
EHFrameSupportTests.cpp
JITLinkMocks.cpp
JITLinkTestUtils.cpp
LinkGraphTests.cpp
MachOLinkGraphTests.cpp
MemoryManagerErrorTests.cpp
StubsTests.cpp
)

View File

@@ -1,73 +0,0 @@
//===--------- JITLinkMocks.cpp - Mock APIs for JITLink unit tests --------===//
//
// 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
//
//===----------------------------------------------------------------------===//
#include "JITLinkMocks.h"
#include "llvm/ExecutionEngine/JITLink/MachO_x86_64.h"
#include "llvm/Testing/Support/Error.h"
#include "gtest/gtest.h"
using namespace llvm;
using namespace llvm::orc;
using namespace llvm::jitlink;
void lookupResolveEverythingToNull(
const llvm::jitlink::JITLinkContext::LookupMap &Symbols,
std::unique_ptr<llvm::jitlink::JITLinkAsyncLookupContinuation> LC) {
llvm::orc::ExecutorAddr Null;
llvm::jitlink::AsyncLookupResult Result;
for (auto &KV : Symbols)
Result[KV.first] = {Null, llvm::JITSymbolFlags::Exported};
LC->run(std::move(Result));
}
void lookupErrorOut(
const llvm::jitlink::JITLinkContext::LookupMap &Symbols,
std::unique_ptr<llvm::jitlink::JITLinkAsyncLookupContinuation> LC) {
LC->run(llvm::make_error<llvm::StringError>("Lookup failed",
llvm::inconvertibleErrorCode()));
}
std::unique_ptr<MockJITLinkContext> makeMockContext(
llvm::unique_function<void(llvm::Error)> HandleFailed,
llvm::unique_function<void(MockJITLinkMemoryManager &)> SetupMemMgr,
llvm::unique_function<void(MockJITLinkContext &)> SetupContext) {
auto MemMgr = std::make_unique<MockJITLinkMemoryManager>();
SetupMemMgr(*MemMgr);
auto Ctx = std::make_unique<MockJITLinkContext>(std::move(MemMgr),
std::move(HandleFailed));
SetupContext(*Ctx);
return Ctx;
}
void defaultMemMgrSetup(MockJITLinkMemoryManager &) {}
void defaultCtxSetup(MockJITLinkContext &) {}
TEST(JITLinkMocks, SmokeTest) {
// Check that the testing infrastructure defaults can "link" a graph
// successfully.
auto G = std::make_unique<LinkGraph>("foo", Triple("x86_64-apple-darwin"), 8,
llvm::endianness::little,
getGenericEdgeKindName);
ArrayRef<char> Content = "hello, world!";
auto &Sec =
G->createSection("__data", orc::MemProt::Read | orc::MemProt::Write);
orc::ExecutorAddr B1Addr(0x1000);
auto &B = G->createContentBlock(Sec, Content, B1Addr, 8, 0);
G->addDefinedSymbol(B, 4, "S", 4, Linkage::Strong, Scope::Default, false,
false);
Error Err = Error::success();
auto Ctx =
makeMockContext(JoinErrorsInto(Err), defaultMemMgrSetup, defaultCtxSetup);
link_MachO_x86_64(std::move(G), std::move(Ctx));
EXPECT_THAT_ERROR(std::move(Err), Succeeded());
}

View File

@@ -0,0 +1,114 @@
//===------- JITLinkTestUtils.cpp - Utilities for JITLink unit tests ------===//
//
// 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
//
//===----------------------------------------------------------------------===//
#include "JITLinkTestUtils.h"
#include "llvm/ExecutionEngine/JITLink/MachO_x86_64.h"
#include "llvm/Testing/Support/Error.h"
#include "gtest/gtest.h"
using namespace llvm;
using namespace llvm::orc;
using namespace llvm::jitlink;
static const char BlockContentBytes[] = {
0x54, 0x68, 0x65, 0x72, 0x65, 0x20, 0x77, 0x61, 0x73, 0x20, 0x6d, 0x6f,
0x76, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x61, 0x74, 0x20, 0x74, 0x68,
0x65, 0x20, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x66,
0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x77, 0x6f, 0x72, 0x64, 0x20,
0x68, 0x61, 0x64, 0x20, 0x70, 0x61, 0x73, 0x73, 0x65, 0x64, 0x20, 0x61,
0x72, 0x6f, 0x75, 0x6e, 0x64, 0x0a, 0x54, 0x68, 0x61, 0x74, 0x20, 0x74,
0x68, 0x65, 0x20, 0x63, 0x6f, 0x6c, 0x74, 0x20, 0x66, 0x72, 0x6f, 0x6d,
0x20, 0x4f, 0x6c, 0x64, 0x20, 0x52, 0x65, 0x67, 0x72, 0x65, 0x74, 0x20,
0x68, 0x61, 0x64, 0x20, 0x67, 0x6f, 0x74, 0x20, 0x61, 0x77, 0x61, 0x79,
0x2c, 0x0a, 0x41, 0x6e, 0x64, 0x20, 0x68, 0x61, 0x64, 0x20, 0x6a, 0x6f,
0x69, 0x6e, 0x65, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x77, 0x69, 0x6c,
0x64, 0x20, 0x62, 0x75, 0x73, 0x68, 0x20, 0x68, 0x6f, 0x72, 0x73, 0x65,
0x73, 0x20, 0x2d, 0x2d, 0x20, 0x68, 0x65, 0x20, 0x77, 0x61, 0x73, 0x20,
0x77, 0x6f, 0x72, 0x74, 0x68, 0x20, 0x61, 0x20, 0x74, 0x68, 0x6f, 0x75,
0x73, 0x61, 0x6e, 0x64, 0x20, 0x70, 0x6f, 0x75, 0x6e, 0x64, 0x2c, 0x0a,
0x53, 0x6f, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63,
0x72, 0x61, 0x63, 0x6b, 0x73, 0x20, 0x68, 0x61, 0x64, 0x20, 0x67, 0x61,
0x74, 0x68, 0x65, 0x72, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68,
0x65, 0x20, 0x66, 0x72, 0x61, 0x79, 0x2e, 0x0a, 0x41, 0x6c, 0x6c, 0x20,
0x74, 0x68, 0x65, 0x20, 0x74, 0x72, 0x69, 0x65, 0x64, 0x20, 0x61, 0x6e,
0x64, 0x20, 0x6e, 0x6f, 0x74, 0x65, 0x64, 0x20, 0x72, 0x69, 0x64, 0x65,
0x72, 0x73, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x65, 0x20,
0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6e, 0x65, 0x61,
0x72, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x66, 0x61, 0x72, 0x0a, 0x48, 0x61,
0x64, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x65, 0x72, 0x65, 0x64, 0x20, 0x61,
0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x68, 0x6f, 0x6d, 0x65, 0x73, 0x74,
0x65, 0x61, 0x64, 0x20, 0x6f, 0x76, 0x65, 0x72, 0x6e, 0x69, 0x67, 0x68,
0x74, 0x2c, 0x0a, 0x46, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x62,
0x75, 0x73, 0x68, 0x6d, 0x65, 0x6e, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x20,
0x68, 0x61, 0x72, 0x64, 0x20, 0x72, 0x69, 0x64, 0x69, 0x6e, 0x67, 0x20,
0x77, 0x68, 0x65, 0x72, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x77, 0x69,
0x6c, 0x64, 0x20, 0x62, 0x75, 0x73, 0x68, 0x20, 0x68, 0x6f, 0x72, 0x73,
0x65, 0x73, 0x20, 0x61, 0x72, 0x65, 0x2c, 0x0a, 0x41, 0x6e, 0x64, 0x20,
0x74, 0x68, 0x65, 0x20, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x2d, 0x68, 0x6f,
0x72, 0x73, 0x65, 0x20, 0x73, 0x6e, 0x75, 0x66, 0x66, 0x73, 0x20, 0x74,
0x68, 0x65, 0x20, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x20, 0x77, 0x69,
0x74, 0x68, 0x20, 0x64, 0x65, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x2e, 0x00};
ArrayRef<char> BlockContent(BlockContentBytes);
void lookupResolveEverythingToNull(
const llvm::jitlink::JITLinkContext::LookupMap &Symbols,
std::unique_ptr<llvm::jitlink::JITLinkAsyncLookupContinuation> LC) {
llvm::orc::ExecutorAddr Null;
llvm::jitlink::AsyncLookupResult Result;
for (auto &KV : Symbols)
Result[KV.first] = {Null, llvm::JITSymbolFlags::Exported};
LC->run(std::move(Result));
}
void lookupErrorOut(
const llvm::jitlink::JITLinkContext::LookupMap &Symbols,
std::unique_ptr<llvm::jitlink::JITLinkAsyncLookupContinuation> LC) {
LC->run(llvm::make_error<llvm::StringError>("Lookup failed",
llvm::inconvertibleErrorCode()));
}
std::unique_ptr<MockJITLinkContext> makeMockContext(
llvm::unique_function<void(llvm::Error)> HandleFailed,
llvm::unique_function<void(MockJITLinkMemoryManager &)> SetupMemMgr,
llvm::unique_function<void(MockJITLinkContext &)> SetupContext) {
auto MemMgr = std::make_unique<MockJITLinkMemoryManager>();
SetupMemMgr(*MemMgr);
auto Ctx = std::make_unique<MockJITLinkContext>(std::move(MemMgr),
std::move(HandleFailed));
SetupContext(*Ctx);
return Ctx;
}
void defaultMemMgrSetup(MockJITLinkMemoryManager &) {}
void defaultCtxSetup(MockJITLinkContext &) {}
TEST(JITLinkMocks, SmokeTest) {
// Check that the testing infrastructure defaults can "link" a graph
// successfully.
auto G = std::make_unique<LinkGraph>("foo", Triple("x86_64-apple-darwin"), 8,
llvm::endianness::little,
getGenericEdgeKindName);
ArrayRef<char> Content = "hello, world!";
auto &Sec =
G->createSection("__data", orc::MemProt::Read | orc::MemProt::Write);
orc::ExecutorAddr B1Addr(0x1000);
auto &B = G->createContentBlock(Sec, Content, B1Addr, 8, 0);
G->addDefinedSymbol(B, 4, "S", 4, Linkage::Strong, Scope::Default, false,
false);
Error Err = Error::success();
auto Ctx =
makeMockContext(JoinErrorsInto(Err), defaultMemMgrSetup, defaultCtxSetup);
link_MachO_x86_64(std::move(G), std::move(Ctx));
EXPECT_THAT_ERROR(std::move(Err), Succeeded());
}

View File

@@ -1,4 +1,4 @@
//===----- JITLinkMocks.h - Mock APIs for JITLink unit tests ----*- C++ -*-===//
//===--- JITLinkTestUtils.h - Utilities for JITLink unit tests --*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -6,12 +6,12 @@
//
//===----------------------------------------------------------------------===//
//
// Mock APIs for JITLink unit tests.
// Utilities for JITLink unit tests.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_UNITTESTS_EXECUTIONENGINE_JITLINK_JITLINKMOCKS_H
#define LLVM_UNITTESTS_EXECUTIONENGINE_JITLINK_JITLINKMOCKS_H
#ifndef LLVM_UNITTESTS_EXECUTIONENGINE_JITLINK_JITLINKTESTUTILS_H
#define LLVM_UNITTESTS_EXECUTIONENGINE_JITLINK_JITLINKTESTUTILS_H
#include "llvm/ExecutionEngine/JITLink/JITLink.h"
@@ -225,4 +225,6 @@ private:
llvm::Error &Err;
};
#endif // LLVM_UNITTESTS_EXECUTIONENGINE_JITLINK_JITLINKMOCKS_H
extern llvm::ArrayRef<char> BlockContent;
#endif // LLVM_UNITTESTS_EXECUTIONENGINE_JITLINK_JITLINKTESTUTILS_H

View File

@@ -6,6 +6,8 @@
//
//===----------------------------------------------------------------------===//
#include "JITLinkTestUtils.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ExecutionEngine/JITLink/JITLink.h"
#include "llvm/ExecutionEngine/Orc/ObjectFileInterface.h"
@@ -17,47 +19,6 @@
using namespace llvm;
using namespace llvm::jitlink;
static const char BlockContentBytes[] = {
0x54, 0x68, 0x65, 0x72, 0x65, 0x20, 0x77, 0x61, 0x73, 0x20, 0x6d, 0x6f,
0x76, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x61, 0x74, 0x20, 0x74, 0x68,
0x65, 0x20, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x66,
0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x77, 0x6f, 0x72, 0x64, 0x20,
0x68, 0x61, 0x64, 0x20, 0x70, 0x61, 0x73, 0x73, 0x65, 0x64, 0x20, 0x61,
0x72, 0x6f, 0x75, 0x6e, 0x64, 0x0a, 0x54, 0x68, 0x61, 0x74, 0x20, 0x74,
0x68, 0x65, 0x20, 0x63, 0x6f, 0x6c, 0x74, 0x20, 0x66, 0x72, 0x6f, 0x6d,
0x20, 0x4f, 0x6c, 0x64, 0x20, 0x52, 0x65, 0x67, 0x72, 0x65, 0x74, 0x20,
0x68, 0x61, 0x64, 0x20, 0x67, 0x6f, 0x74, 0x20, 0x61, 0x77, 0x61, 0x79,
0x2c, 0x0a, 0x41, 0x6e, 0x64, 0x20, 0x68, 0x61, 0x64, 0x20, 0x6a, 0x6f,
0x69, 0x6e, 0x65, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x77, 0x69, 0x6c,
0x64, 0x20, 0x62, 0x75, 0x73, 0x68, 0x20, 0x68, 0x6f, 0x72, 0x73, 0x65,
0x73, 0x20, 0x2d, 0x2d, 0x20, 0x68, 0x65, 0x20, 0x77, 0x61, 0x73, 0x20,
0x77, 0x6f, 0x72, 0x74, 0x68, 0x20, 0x61, 0x20, 0x74, 0x68, 0x6f, 0x75,
0x73, 0x61, 0x6e, 0x64, 0x20, 0x70, 0x6f, 0x75, 0x6e, 0x64, 0x2c, 0x0a,
0x53, 0x6f, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63,
0x72, 0x61, 0x63, 0x6b, 0x73, 0x20, 0x68, 0x61, 0x64, 0x20, 0x67, 0x61,
0x74, 0x68, 0x65, 0x72, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68,
0x65, 0x20, 0x66, 0x72, 0x61, 0x79, 0x2e, 0x0a, 0x41, 0x6c, 0x6c, 0x20,
0x74, 0x68, 0x65, 0x20, 0x74, 0x72, 0x69, 0x65, 0x64, 0x20, 0x61, 0x6e,
0x64, 0x20, 0x6e, 0x6f, 0x74, 0x65, 0x64, 0x20, 0x72, 0x69, 0x64, 0x65,
0x72, 0x73, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x65, 0x20,
0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6e, 0x65, 0x61,
0x72, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x66, 0x61, 0x72, 0x0a, 0x48, 0x61,
0x64, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x65, 0x72, 0x65, 0x64, 0x20, 0x61,
0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x68, 0x6f, 0x6d, 0x65, 0x73, 0x74,
0x65, 0x61, 0x64, 0x20, 0x6f, 0x76, 0x65, 0x72, 0x6e, 0x69, 0x67, 0x68,
0x74, 0x2c, 0x0a, 0x46, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x62,
0x75, 0x73, 0x68, 0x6d, 0x65, 0x6e, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x20,
0x68, 0x61, 0x72, 0x64, 0x20, 0x72, 0x69, 0x64, 0x69, 0x6e, 0x67, 0x20,
0x77, 0x68, 0x65, 0x72, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x77, 0x69,
0x6c, 0x64, 0x20, 0x62, 0x75, 0x73, 0x68, 0x20, 0x68, 0x6f, 0x72, 0x73,
0x65, 0x73, 0x20, 0x61, 0x72, 0x65, 0x2c, 0x0a, 0x41, 0x6e, 0x64, 0x20,
0x74, 0x68, 0x65, 0x20, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x2d, 0x68, 0x6f,
0x72, 0x73, 0x65, 0x20, 0x73, 0x6e, 0x75, 0x66, 0x66, 0x73, 0x20, 0x74,
0x68, 0x65, 0x20, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x20, 0x77, 0x69,
0x74, 0x68, 0x20, 0x64, 0x65, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x2e, 0x00};
static ArrayRef<char> BlockContent(BlockContentBytes);
TEST(LinkGraphTest, Construction) {
// Check that LinkGraph construction works as expected.
LinkGraph G("foo", Triple("x86_64-apple-darwin"), 8, llvm::endianness::little,

View File

@@ -0,0 +1,35 @@
//===------ LinkGraphTests.cpp - Unit tests for core JITLink classes ------===//
//
// 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
//
//===----------------------------------------------------------------------===//
#include "JITLinkTestUtils.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ExecutionEngine/JITLink/JITLink.h"
#include "llvm/ExecutionEngine/JITLink/MachO.h"
#include "llvm/Testing/Support/Error.h"
#include "gtest/gtest.h"
using namespace llvm;
using namespace llvm::jitlink;
TEST(MachOLinkGraphTest, GetStandardSections) {
// Check that LinkGraph construction works as expected.
LinkGraph G("foo", Triple("arm64-apple-darwin"), 8, llvm::endianness::little,
getGenericEdgeKindName);
auto &Data = getMachODefaultRWDataSection(G);
EXPECT_TRUE(Data.empty());
EXPECT_EQ(Data.getName(), orc::MachODataDataSectionName);
EXPECT_EQ(Data.getMemProt(), orc::MemProt::Read | orc::MemProt::Write);
auto &Text = getMachODefaultTextSection(G);
EXPECT_TRUE(Text.empty());
EXPECT_EQ(Text.getName(), orc::MachOTextTextSectionName);
EXPECT_EQ(Text.getMemProt(), orc::MemProt::Read | orc::MemProt::Exec);
}

View File

@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
#include "JITLinkMocks.h"
#include "JITLinkTestUtils.h"
#include "llvm/ExecutionEngine/JITLink/MachO_x86_64.h"
#include "llvm/Testing/Support/Error.h"