9
9
#include " llvm/ExecutionEngine/Orc/EPCGenericJITLinkMemoryManager.h"
10
10
#include " llvm/ExecutionEngine/Orc/LookupAndRecordAddrs.h"
11
11
12
+ #include < limits>
13
+
12
14
namespace llvm {
13
15
namespace orc {
14
16
@@ -32,7 +34,8 @@ class EPCGenericJITLinkMemoryManager::Alloc
32
34
MutableArrayRef<char > getWorkingMemory (ProtectionFlags Seg) override {
33
35
auto I = Segs.find (Seg);
34
36
assert (I != Segs.end () && " No allocation for seg" );
35
- return {I->second .WorkingMem , I->second .ContentSize };
37
+ assert (I->second .ContentSize <= std::numeric_limits<size_t >::max ());
38
+ return {I->second .WorkingMem , static_cast <size_t >(I->second .ContentSize )};
36
39
}
37
40
38
41
JITTargetAddress getTargetMemory (ProtectionFlags Seg) override {
@@ -45,13 +48,14 @@ class EPCGenericJITLinkMemoryManager::Alloc
45
48
char *WorkingMem = WorkingBuffer.get ();
46
49
tpctypes::FinalizeRequest FR;
47
50
for (auto &KV : Segs) {
51
+ assert (KV.second .ContentSize <= std::numeric_limits<size_t >::max ());
48
52
FR.push_back (tpctypes::SegFinalizeRequest{
49
53
tpctypes::toWireProtectionFlags (
50
54
static_cast <sys::Memory::ProtectionFlags>(KV.first )),
51
55
KV.second .TargetAddr ,
52
56
alignTo (KV.second .ContentSize + KV.second .ZeroFillSize ,
53
57
Parent.EPC .getPageSize ()),
54
- {WorkingMem, KV.second .ContentSize }});
58
+ {WorkingMem, static_cast < size_t >( KV.second .ContentSize ) }});
55
59
WorkingMem += KV.second .ContentSize ;
56
60
}
57
61
Parent.EPC .callSPSWrapperAsync <shared::SPSOrcTargetProcessFinalize>(
0 commit comments