Skip to content

Commit 6128ff6

Browse files
committed
[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).
1 parent a461869 commit 6128ff6

File tree

10 files changed

+184
-121
lines changed

10 files changed

+184
-121
lines changed

llvm/include/llvm/ExecutionEngine/JITLink/MachO.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#define LLVM_EXECUTIONENGINE_JITLINK_MACHO_H
1515

1616
#include "llvm/ExecutionEngine/JITLink/JITLink.h"
17+
#include "llvm/ExecutionEngine/Orc/Shared/MachOObjectFormat.h"
1718

1819
namespace llvm {
1920
namespace jitlink {
@@ -33,6 +34,26 @@ createLinkGraphFromMachOObject(MemoryBufferRef ObjectBuffer);
3334
void link_MachO(std::unique_ptr<LinkGraph> G,
3435
std::unique_ptr<JITLinkContext> Ctx);
3536

37+
/// Get a pointer to the standard MachO data section (creates an empty
38+
/// section with RW- permissions and standard lifetime if one does not
39+
/// already exist).
40+
inline Section &getMachODefaultRWDataSection(LinkGraph &G) {
41+
if (auto *DataSec = G.findSectionByName(orc::MachODataDataSectionName))
42+
return *DataSec;
43+
return G.createSection(orc::MachODataDataSectionName,
44+
orc::MemProt::Read | orc::MemProt::Write);
45+
}
46+
47+
/// Get a pointer to the standard MachO text section (creates an empty
48+
/// section with R-X permissions and standard lifetime if one does not
49+
/// already exist).
50+
inline Section &getMachODefaultTextSection(LinkGraph &G) {
51+
if (auto *TextSec = G.findSectionByName(orc::MachOTextTextSectionName))
52+
return *TextSec;
53+
return G.createSection(orc::MachOTextTextSectionName,
54+
orc::MemProt::Read | orc::MemProt::Exec);
55+
}
56+
3657
} // end namespace jitlink
3758
} // end namespace llvm
3859

llvm/include/llvm/ExecutionEngine/Orc/Shared/MachOObjectFormat.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ extern StringRef MachOSwift5TypesSectionName;
4949
extern StringRef MachOSwift5TypeRefSectionName;
5050
extern StringRef MachOSwift5FieldMetadataSectionName;
5151
extern StringRef MachOSwift5EntrySectionName;
52+
extern StringRef MachOTextTextSectionName;
5253
extern StringRef MachOThreadBSSSectionName;
5354
extern StringRef MachOThreadDataSectionName;
5455
extern StringRef MachOThreadVarsSectionName;

llvm/lib/ExecutionEngine/Orc/Shared/MachOObjectFormat.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ StringRef MachOSwift5TypesSectionName = "__TEXT,__swift5_types";
4242
StringRef MachOSwift5TypeRefSectionName = "__TEXT,__swift5_typeref";
4343
StringRef MachOSwift5FieldMetadataSectionName = "__TEXT,__swift5_fieldmd";
4444
StringRef MachOSwift5EntrySectionName = "__TEXT,__swift5_entry";
45+
StringRef MachOTextTextSectionName = "__TEXT,__text";
4546
StringRef MachOThreadBSSSectionName = "__DATA,__thread_bss";
4647
StringRef MachOThreadDataSectionName = "__DATA,__thread_data";
4748
StringRef MachOThreadVarsSectionName = "__DATA,__thread_vars";

llvm/unittests/ExecutionEngine/JITLink/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ add_llvm_unittest(JITLinkTests
1111
AArch32Tests.cpp
1212
AArch32ErrorTests.cpp
1313
EHFrameSupportTests.cpp
14-
JITLinkMocks.cpp
14+
JITLinkTestUtils.cpp
1515
LinkGraphTests.cpp
16+
MachOLinkGraphTests.cpp
1617
MemoryManagerErrorTests.cpp
1718
StubsTests.cpp
1819
)

llvm/unittests/ExecutionEngine/JITLink/JITLinkMocks.cpp

Lines changed: 0 additions & 73 deletions
This file was deleted.
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
//===------- JITLinkTestUtils.cpp - Utilities for JITLink unit tests ------===//
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+
#include "JITLinkTestUtils.h"
10+
#include "llvm/ExecutionEngine/JITLink/MachO_x86_64.h"
11+
12+
#include "llvm/Testing/Support/Error.h"
13+
#include "gtest/gtest.h"
14+
15+
using namespace llvm;
16+
using namespace llvm::orc;
17+
using namespace llvm::jitlink;
18+
19+
static const char BlockContentBytes[] = {
20+
0x54, 0x68, 0x65, 0x72, 0x65, 0x20, 0x77, 0x61, 0x73, 0x20, 0x6d, 0x6f,
21+
0x76, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x61, 0x74, 0x20, 0x74, 0x68,
22+
0x65, 0x20, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x66,
23+
0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x77, 0x6f, 0x72, 0x64, 0x20,
24+
0x68, 0x61, 0x64, 0x20, 0x70, 0x61, 0x73, 0x73, 0x65, 0x64, 0x20, 0x61,
25+
0x72, 0x6f, 0x75, 0x6e, 0x64, 0x0a, 0x54, 0x68, 0x61, 0x74, 0x20, 0x74,
26+
0x68, 0x65, 0x20, 0x63, 0x6f, 0x6c, 0x74, 0x20, 0x66, 0x72, 0x6f, 0x6d,
27+
0x20, 0x4f, 0x6c, 0x64, 0x20, 0x52, 0x65, 0x67, 0x72, 0x65, 0x74, 0x20,
28+
0x68, 0x61, 0x64, 0x20, 0x67, 0x6f, 0x74, 0x20, 0x61, 0x77, 0x61, 0x79,
29+
0x2c, 0x0a, 0x41, 0x6e, 0x64, 0x20, 0x68, 0x61, 0x64, 0x20, 0x6a, 0x6f,
30+
0x69, 0x6e, 0x65, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x77, 0x69, 0x6c,
31+
0x64, 0x20, 0x62, 0x75, 0x73, 0x68, 0x20, 0x68, 0x6f, 0x72, 0x73, 0x65,
32+
0x73, 0x20, 0x2d, 0x2d, 0x20, 0x68, 0x65, 0x20, 0x77, 0x61, 0x73, 0x20,
33+
0x77, 0x6f, 0x72, 0x74, 0x68, 0x20, 0x61, 0x20, 0x74, 0x68, 0x6f, 0x75,
34+
0x73, 0x61, 0x6e, 0x64, 0x20, 0x70, 0x6f, 0x75, 0x6e, 0x64, 0x2c, 0x0a,
35+
0x53, 0x6f, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63,
36+
0x72, 0x61, 0x63, 0x6b, 0x73, 0x20, 0x68, 0x61, 0x64, 0x20, 0x67, 0x61,
37+
0x74, 0x68, 0x65, 0x72, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68,
38+
0x65, 0x20, 0x66, 0x72, 0x61, 0x79, 0x2e, 0x0a, 0x41, 0x6c, 0x6c, 0x20,
39+
0x74, 0x68, 0x65, 0x20, 0x74, 0x72, 0x69, 0x65, 0x64, 0x20, 0x61, 0x6e,
40+
0x64, 0x20, 0x6e, 0x6f, 0x74, 0x65, 0x64, 0x20, 0x72, 0x69, 0x64, 0x65,
41+
0x72, 0x73, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x65, 0x20,
42+
0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6e, 0x65, 0x61,
43+
0x72, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x66, 0x61, 0x72, 0x0a, 0x48, 0x61,
44+
0x64, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x65, 0x72, 0x65, 0x64, 0x20, 0x61,
45+
0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x68, 0x6f, 0x6d, 0x65, 0x73, 0x74,
46+
0x65, 0x61, 0x64, 0x20, 0x6f, 0x76, 0x65, 0x72, 0x6e, 0x69, 0x67, 0x68,
47+
0x74, 0x2c, 0x0a, 0x46, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x62,
48+
0x75, 0x73, 0x68, 0x6d, 0x65, 0x6e, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x20,
49+
0x68, 0x61, 0x72, 0x64, 0x20, 0x72, 0x69, 0x64, 0x69, 0x6e, 0x67, 0x20,
50+
0x77, 0x68, 0x65, 0x72, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x77, 0x69,
51+
0x6c, 0x64, 0x20, 0x62, 0x75, 0x73, 0x68, 0x20, 0x68, 0x6f, 0x72, 0x73,
52+
0x65, 0x73, 0x20, 0x61, 0x72, 0x65, 0x2c, 0x0a, 0x41, 0x6e, 0x64, 0x20,
53+
0x74, 0x68, 0x65, 0x20, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x2d, 0x68, 0x6f,
54+
0x72, 0x73, 0x65, 0x20, 0x73, 0x6e, 0x75, 0x66, 0x66, 0x73, 0x20, 0x74,
55+
0x68, 0x65, 0x20, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x20, 0x77, 0x69,
56+
0x74, 0x68, 0x20, 0x64, 0x65, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x2e, 0x00};
57+
58+
ArrayRef<char> BlockContent(BlockContentBytes);
59+
60+
void lookupResolveEverythingToNull(
61+
const llvm::jitlink::JITLinkContext::LookupMap &Symbols,
62+
std::unique_ptr<llvm::jitlink::JITLinkAsyncLookupContinuation> LC) {
63+
llvm::orc::ExecutorAddr Null;
64+
llvm::jitlink::AsyncLookupResult Result;
65+
for (auto &KV : Symbols)
66+
Result[KV.first] = {Null, llvm::JITSymbolFlags::Exported};
67+
LC->run(std::move(Result));
68+
}
69+
70+
void lookupErrorOut(
71+
const llvm::jitlink::JITLinkContext::LookupMap &Symbols,
72+
std::unique_ptr<llvm::jitlink::JITLinkAsyncLookupContinuation> LC) {
73+
LC->run(llvm::make_error<llvm::StringError>("Lookup failed",
74+
llvm::inconvertibleErrorCode()));
75+
}
76+
77+
std::unique_ptr<MockJITLinkContext> makeMockContext(
78+
llvm::unique_function<void(llvm::Error)> HandleFailed,
79+
llvm::unique_function<void(MockJITLinkMemoryManager &)> SetupMemMgr,
80+
llvm::unique_function<void(MockJITLinkContext &)> SetupContext) {
81+
auto MemMgr = std::make_unique<MockJITLinkMemoryManager>();
82+
SetupMemMgr(*MemMgr);
83+
auto Ctx = std::make_unique<MockJITLinkContext>(std::move(MemMgr),
84+
std::move(HandleFailed));
85+
SetupContext(*Ctx);
86+
return Ctx;
87+
}
88+
89+
void defaultMemMgrSetup(MockJITLinkMemoryManager &) {}
90+
void defaultCtxSetup(MockJITLinkContext &) {}
91+
92+
TEST(JITLinkMocks, SmokeTest) {
93+
// Check that the testing infrastructure defaults can "link" a graph
94+
// successfully.
95+
auto G = std::make_unique<LinkGraph>("foo", Triple("x86_64-apple-darwin"), 8,
96+
llvm::endianness::little,
97+
getGenericEdgeKindName);
98+
99+
ArrayRef<char> Content = "hello, world!";
100+
auto &Sec =
101+
G->createSection("__data", orc::MemProt::Read | orc::MemProt::Write);
102+
orc::ExecutorAddr B1Addr(0x1000);
103+
auto &B = G->createContentBlock(Sec, Content, B1Addr, 8, 0);
104+
G->addDefinedSymbol(B, 4, "S", 4, Linkage::Strong, Scope::Default, false,
105+
false);
106+
107+
Error Err = Error::success();
108+
auto Ctx =
109+
makeMockContext(JoinErrorsInto(Err), defaultMemMgrSetup, defaultCtxSetup);
110+
111+
link_MachO_x86_64(std::move(G), std::move(Ctx));
112+
113+
EXPECT_THAT_ERROR(std::move(Err), Succeeded());
114+
}

llvm/unittests/ExecutionEngine/JITLink/JITLinkMocks.h renamed to llvm/unittests/ExecutionEngine/JITLink/JITLinkTestUtils.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
//===----- JITLinkMocks.h - Mock APIs for JITLink unit tests ----*- C++ -*-===//
1+
//===--- JITLinkTestUtils.h - Utilities for JITLink unit tests --*- C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
88
//
9-
// Mock APIs for JITLink unit tests.
9+
// Utilities for JITLink unit tests.
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
#ifndef LLVM_UNITTESTS_EXECUTIONENGINE_JITLINK_JITLINKMOCKS_H
14-
#define LLVM_UNITTESTS_EXECUTIONENGINE_JITLINK_JITLINKMOCKS_H
13+
#ifndef LLVM_UNITTESTS_EXECUTIONENGINE_JITLINK_JITLINKTESTUTILS_H
14+
#define LLVM_UNITTESTS_EXECUTIONENGINE_JITLINK_JITLINKTESTUTILS_H
1515

1616
#include "llvm/ExecutionEngine/JITLink/JITLink.h"
1717

@@ -225,4 +225,6 @@ class JoinErrorsInto {
225225
llvm::Error &Err;
226226
};
227227

228-
#endif // LLVM_UNITTESTS_EXECUTIONENGINE_JITLINK_JITLINKMOCKS_H
228+
extern llvm::ArrayRef<char> BlockContent;
229+
230+
#endif // LLVM_UNITTESTS_EXECUTIONENGINE_JITLINK_JITLINKTESTUTILS_H

llvm/unittests/ExecutionEngine/JITLink/LinkGraphTests.cpp

Lines changed: 2 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
#include "JITLinkTestUtils.h"
10+
911
#include "llvm/ADT/STLExtras.h"
1012
#include "llvm/ExecutionEngine/JITLink/JITLink.h"
1113
#include "llvm/ExecutionEngine/Orc/ObjectFileInterface.h"
@@ -17,47 +19,6 @@
1719
using namespace llvm;
1820
using namespace llvm::jitlink;
1921

20-
static const char BlockContentBytes[] = {
21-
0x54, 0x68, 0x65, 0x72, 0x65, 0x20, 0x77, 0x61, 0x73, 0x20, 0x6d, 0x6f,
22-
0x76, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x61, 0x74, 0x20, 0x74, 0x68,
23-
0x65, 0x20, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x20, 0x66,
24-
0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x77, 0x6f, 0x72, 0x64, 0x20,
25-
0x68, 0x61, 0x64, 0x20, 0x70, 0x61, 0x73, 0x73, 0x65, 0x64, 0x20, 0x61,
26-
0x72, 0x6f, 0x75, 0x6e, 0x64, 0x0a, 0x54, 0x68, 0x61, 0x74, 0x20, 0x74,
27-
0x68, 0x65, 0x20, 0x63, 0x6f, 0x6c, 0x74, 0x20, 0x66, 0x72, 0x6f, 0x6d,
28-
0x20, 0x4f, 0x6c, 0x64, 0x20, 0x52, 0x65, 0x67, 0x72, 0x65, 0x74, 0x20,
29-
0x68, 0x61, 0x64, 0x20, 0x67, 0x6f, 0x74, 0x20, 0x61, 0x77, 0x61, 0x79,
30-
0x2c, 0x0a, 0x41, 0x6e, 0x64, 0x20, 0x68, 0x61, 0x64, 0x20, 0x6a, 0x6f,
31-
0x69, 0x6e, 0x65, 0x64, 0x20, 0x74, 0x68, 0x65, 0x20, 0x77, 0x69, 0x6c,
32-
0x64, 0x20, 0x62, 0x75, 0x73, 0x68, 0x20, 0x68, 0x6f, 0x72, 0x73, 0x65,
33-
0x73, 0x20, 0x2d, 0x2d, 0x20, 0x68, 0x65, 0x20, 0x77, 0x61, 0x73, 0x20,
34-
0x77, 0x6f, 0x72, 0x74, 0x68, 0x20, 0x61, 0x20, 0x74, 0x68, 0x6f, 0x75,
35-
0x73, 0x61, 0x6e, 0x64, 0x20, 0x70, 0x6f, 0x75, 0x6e, 0x64, 0x2c, 0x0a,
36-
0x53, 0x6f, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x74, 0x68, 0x65, 0x20, 0x63,
37-
0x72, 0x61, 0x63, 0x6b, 0x73, 0x20, 0x68, 0x61, 0x64, 0x20, 0x67, 0x61,
38-
0x74, 0x68, 0x65, 0x72, 0x65, 0x64, 0x20, 0x74, 0x6f, 0x20, 0x74, 0x68,
39-
0x65, 0x20, 0x66, 0x72, 0x61, 0x79, 0x2e, 0x0a, 0x41, 0x6c, 0x6c, 0x20,
40-
0x74, 0x68, 0x65, 0x20, 0x74, 0x72, 0x69, 0x65, 0x64, 0x20, 0x61, 0x6e,
41-
0x64, 0x20, 0x6e, 0x6f, 0x74, 0x65, 0x64, 0x20, 0x72, 0x69, 0x64, 0x65,
42-
0x72, 0x73, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x65, 0x20,
43-
0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6e, 0x65, 0x61,
44-
0x72, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x66, 0x61, 0x72, 0x0a, 0x48, 0x61,
45-
0x64, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x65, 0x72, 0x65, 0x64, 0x20, 0x61,
46-
0x74, 0x20, 0x74, 0x68, 0x65, 0x20, 0x68, 0x6f, 0x6d, 0x65, 0x73, 0x74,
47-
0x65, 0x61, 0x64, 0x20, 0x6f, 0x76, 0x65, 0x72, 0x6e, 0x69, 0x67, 0x68,
48-
0x74, 0x2c, 0x0a, 0x46, 0x6f, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x62,
49-
0x75, 0x73, 0x68, 0x6d, 0x65, 0x6e, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x20,
50-
0x68, 0x61, 0x72, 0x64, 0x20, 0x72, 0x69, 0x64, 0x69, 0x6e, 0x67, 0x20,
51-
0x77, 0x68, 0x65, 0x72, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x77, 0x69,
52-
0x6c, 0x64, 0x20, 0x62, 0x75, 0x73, 0x68, 0x20, 0x68, 0x6f, 0x72, 0x73,
53-
0x65, 0x73, 0x20, 0x61, 0x72, 0x65, 0x2c, 0x0a, 0x41, 0x6e, 0x64, 0x20,
54-
0x74, 0x68, 0x65, 0x20, 0x73, 0x74, 0x6f, 0x63, 0x6b, 0x2d, 0x68, 0x6f,
55-
0x72, 0x73, 0x65, 0x20, 0x73, 0x6e, 0x75, 0x66, 0x66, 0x73, 0x20, 0x74,
56-
0x68, 0x65, 0x20, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x20, 0x77, 0x69,
57-
0x74, 0x68, 0x20, 0x64, 0x65, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x2e, 0x00};
58-
59-
static ArrayRef<char> BlockContent(BlockContentBytes);
60-
6122
TEST(LinkGraphTest, Construction) {
6223
// Check that LinkGraph construction works as expected.
6324
LinkGraph G("foo", Triple("x86_64-apple-darwin"), 8, llvm::endianness::little,
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//===------ LinkGraphTests.cpp - Unit tests for core JITLink classes ------===//
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+
#include "JITLinkTestUtils.h"
10+
11+
#include "llvm/ADT/STLExtras.h"
12+
#include "llvm/ExecutionEngine/JITLink/JITLink.h"
13+
#include "llvm/ExecutionEngine/JITLink/MachO.h"
14+
15+
#include "llvm/Testing/Support/Error.h"
16+
#include "gtest/gtest.h"
17+
18+
using namespace llvm;
19+
using namespace llvm::jitlink;
20+
21+
TEST(MachOLinkGraphTest, GetStandardSections) {
22+
// Check that LinkGraph construction works as expected.
23+
LinkGraph G("foo", Triple("arm64-apple-darwin"), 8, llvm::endianness::little,
24+
getGenericEdgeKindName);
25+
26+
auto &Data = getMachODefaultRWDataSection(G);
27+
EXPECT_TRUE(Data.empty());
28+
EXPECT_EQ(Data.getName(), orc::MachODataDataSectionName);
29+
EXPECT_EQ(Data.getMemProt(), orc::MemProt::Read | orc::MemProt::Write);
30+
31+
auto &Text = getMachODefaultTextSection(G);
32+
EXPECT_TRUE(Text.empty());
33+
EXPECT_EQ(Text.getName(), orc::MachOTextTextSectionName);
34+
EXPECT_EQ(Text.getMemProt(), orc::MemProt::Read | orc::MemProt::Exec);
35+
}

llvm/unittests/ExecutionEngine/JITLink/MemoryManagerErrorTests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#include "JITLinkMocks.h"
9+
#include "JITLinkTestUtils.h"
1010
#include "llvm/ExecutionEngine/JITLink/MachO_x86_64.h"
1111

1212
#include "llvm/Testing/Support/Error.h"

0 commit comments

Comments
 (0)