Refine wasm loader and interpreter, enhance wamrc to support SGX (#167)
Former-commit-id: 76f4a121d3c2a67114414fc60e80eba4bf49aa8e [formerly b1ab47945a40e6b249c9aa205d61281301585ea6] Former-commit-id: 8e5c6e895eae22051a79a8d337a87cd2f431b6bc
This commit is contained in:
@ -11,7 +11,7 @@ set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
|
||||
set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
|
||||
|
||||
add_definitions(-DWASM_ENABLE_INTERP=1)
|
||||
add_definitions(-DBUILD_AOT_COMPILER=1)
|
||||
add_definitions(-DWASM_ENABLE_WAMR_COMPILER=1)
|
||||
|
||||
# Set WAMR_BUILD_TARGET, currently values supported:
|
||||
# "X86_64", "AMD_64", "X86_32", "ARM_32", "MIPS_32", "XTENSA_32"
|
||||
|
||||
@ -28,7 +28,9 @@ print_help()
|
||||
bh_printf(" Use +feature to enable a feature, or -feature to disable it\n");
|
||||
bh_printf(" For example, --cpu-features=+feature1,-feature2\n");
|
||||
bh_printf(" Use --cpu-features=+help to list all the features supported\n");
|
||||
bh_printf(" --opt-level=n Set the optimization level (0 to 3, default: 3)\n");
|
||||
bh_printf(" --opt-level=n Set the optimization level (0 to 3, default: 3, which is fastest)\n");
|
||||
bh_printf(" --size-level=n Set the code size level (0 to 3, default: 3, which is smallest)\n");
|
||||
bh_printf(" -sgx Generate code for SGX platform (Intel Software Guard Extention)\n");
|
||||
bh_printf(" --format=<format> Specifies the format of the output file\n");
|
||||
bh_printf(" The format supported:\n");
|
||||
bh_printf(" aot (default) AoT file\n");
|
||||
@ -53,8 +55,10 @@ main(int argc, char *argv[])
|
||||
AOTCompOption option = { 0 };
|
||||
char error_buf[128];
|
||||
int log_verbose_level = 2;
|
||||
bool sgx_mode = false;
|
||||
|
||||
option.opt_level = 3;
|
||||
option.size_level = 3;
|
||||
option.output_format = AOT_FORMAT_FILE;
|
||||
|
||||
/* Process options. */
|
||||
@ -92,6 +96,16 @@ main(int argc, char *argv[])
|
||||
if (option.opt_level > 3)
|
||||
option.opt_level = 3;
|
||||
}
|
||||
else if (!strncmp(argv[0], "--size-level=", 13)) {
|
||||
if (argv[0][13] == '\0')
|
||||
return print_help();
|
||||
option.size_level = (uint32)atoi(argv[0] + 13);
|
||||
if (option.size_level > 3)
|
||||
option.size_level = 3;
|
||||
}
|
||||
else if (!strcmp(argv[0], "-sgx")) {
|
||||
sgx_mode = true;
|
||||
}
|
||||
else if (!strncmp(argv[0], "--format=", 9)) {
|
||||
if (argv[0][9] == '\0')
|
||||
return print_help();
|
||||
@ -115,6 +129,9 @@ main(int argc, char *argv[])
|
||||
if (argc == 0)
|
||||
return print_help();
|
||||
|
||||
if (sgx_mode)
|
||||
option.size_level = 1;
|
||||
|
||||
wasm_file_name = argv[0];
|
||||
|
||||
if (bh_memory_init_with_allocator(malloc, free)) {
|
||||
|
||||
Reference in New Issue
Block a user