Add control for the native stack check with hardware trap (#1682)
Add a new options to control the native stack hw bound check feature: - Besides the original option `cmake -DWAMR_DISABLE_HW_BOUND_CHECK=1/0`, add a new option `cmake -DWAMR_DISABLE_STACK_HW_BOUND_CHECK=1/0` - When the linear memory hw bound check is disabled, the stack hw bound check will be disabled automatically, no matter what the input option is - When the linear memory hw bound check is enabled, the stack hw bound check is enabled/disabled according to the value of input option - Besides the original option `--bounds-checks=1/0`, add a new option `--stack-bounds-checks=1/0` for wamrc Refer to: https://github.com/bytecodealliance/wasm-micro-runtime/issues/1677
This commit is contained in:
@ -37,6 +37,11 @@ print_help()
|
||||
printf(" by default it is disabled in all 64-bit platforms except SGX and\n");
|
||||
printf(" in these platforms runtime does bounds checks with hardware trap,\n");
|
||||
printf(" and by default it is enabled in all 32-bit platforms\n");
|
||||
printf(" --stack-bounds-checks=1/0 Enable or disable the bounds checks for native stack:\n");
|
||||
printf(" if the option isn't set, the status is same as `--bounds-check`,\n");
|
||||
printf(" if the option is set:\n");
|
||||
printf(" (1) it is always enabled when `--bounds-checks` is enabled,\n");
|
||||
printf(" (2) else it is enabled/disabled according to the option value\n");
|
||||
printf(" --format=<format> Specifies the format of the output file\n");
|
||||
printf(" The format supported:\n");
|
||||
printf(" aot (default) AoT file\n");
|
||||
@ -139,6 +144,8 @@ main(int argc, char *argv[])
|
||||
option.output_format = AOT_FORMAT_FILE;
|
||||
/* default value, enable or disable depends on the platform */
|
||||
option.bounds_checks = 2;
|
||||
/* default value, enable or disable depends on the platform */
|
||||
option.stack_bounds_checks = 2;
|
||||
option.enable_simd = true;
|
||||
option.enable_aux_stack_check = true;
|
||||
option.enable_bulk_memory = true;
|
||||
@ -193,6 +200,9 @@ main(int argc, char *argv[])
|
||||
else if (!strncmp(argv[0], "--bounds-checks=", 16)) {
|
||||
option.bounds_checks = (atoi(argv[0] + 16) == 1) ? 1 : 0;
|
||||
}
|
||||
else if (!strncmp(argv[0], "--stack-bounds-checks=", 22)) {
|
||||
option.stack_bounds_checks = (atoi(argv[0] + 22) == 1) ? 1 : 0;
|
||||
}
|
||||
else if (!strncmp(argv[0], "--format=", 9)) {
|
||||
if (argv[0][9] == '\0')
|
||||
PRINT_HELP_AND_EXIT();
|
||||
|
||||
Reference in New Issue
Block a user