Skip to content

Commit 7962c47

Browse files
qdaomingdaomingqwenyongh
authored
Diasble AOT in SGX build by default, as it requires SGX SDKv2.8 or la… (#180)
* Diasble AOT in SGX build by default, as it requires SGX SDKv2.8 or later. * Update bh_platform.c Co-authored-by: daomingq <[email protected]> Co-authored-by: wenyongh <[email protected]>
1 parent 76eea80 commit 7962c47

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

core/shared/platform/linux-sgx/bh_platform.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
#include "bh_platform.h"
88

99
#include <unistd.h>
10+
#if WASM_ENABLE_AOT != 0
1011
#include "sgx_rsrv_mem_mngr.h"
12+
#endif
1113

1214
#define FIXED_BUFFER_SIZE (1<<9)
1315
static bh_print_function_t print_function = NULL;
@@ -72,6 +74,7 @@ int bh_vprintf_sgx(const char * format, va_list arg)
7274

7375
void* bh_mmap(void *hint, unsigned int size, int prot, int flags)
7476
{
77+
#if WASM_ENABLE_AOT != 0
7578
int mprot = 0;
7679
unsigned alignedSize = (size+4095) & (unsigned)~4095; //Page aligned
7780
void* ret = NULL;
@@ -96,15 +99,21 @@ void* bh_mmap(void *hint, unsigned int size, int prot, int flags)
9699
}
97100

98101
return ret;
102+
#else
103+
return NULL;
104+
#endif
99105
}
100106

101107
void bh_munmap(void *addr, uint32 size)
102108
{
109+
#if WASM_ENABLE_AOT != 0
103110
sgx_free_rsrv_mem(addr, size);
111+
#endif
104112
}
105113

106114
int bh_mprotect(void *addr, uint32 size, int prot)
107115
{
116+
#if WASM_ENABLE_AOT != 0
108117
int mprot = 0;
109118
sgx_status_t st = 0;
110119

@@ -118,4 +127,7 @@ int bh_mprotect(void *addr, uint32 size, int prot)
118127
if (st != SGX_SUCCESS) bh_printf_sgx("bh_mprotect(addr=0x%lx,size=%d,prot=0x%x) failed.", addr, size, prot);
119128

120129
return (st == SGX_SUCCESS? 0:-1);
130+
#else
131+
return -1;
132+
#endif
121133
}

product-mini/platforms/linux-sgx/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ if (NOT DEFINED WAMR_BUILD_INTERP)
3232
endif ()
3333

3434
if (NOT DEFINED WAMR_BUILD_AOT)
35-
# Enable AOT by default.
36-
set (WAMR_BUILD_AOT 1)
35+
# Disable AOT by default.
36+
# If enabling AOT, please install Intel SGX SDKv2.8 or later.
37+
set (WAMR_BUILD_AOT 0)
3738
endif ()
3839

3940
if (NOT DEFINED WAMR_BUILD_JIT)

0 commit comments

Comments
 (0)