Enable Windows XIP (#944)
Enable running XIP file on Windows platform. And add more strict checks for wamrc to report error when the input file is same with output file, or the input file is AOT file but not wasm file.
This commit is contained in:
@ -235,6 +235,11 @@ main(int argc, char *argv[])
|
||||
|
||||
wasm_file_name = argv[0];
|
||||
|
||||
if (!strcmp(wasm_file_name, out_file_name)) {
|
||||
printf("Error: input file and output file are the same");
|
||||
return -1;
|
||||
}
|
||||
|
||||
memset(&init_args, 0, sizeof(RuntimeInitArgs));
|
||||
|
||||
init_args.mem_alloc_type = Alloc_With_Allocator;
|
||||
@ -257,6 +262,11 @@ main(int argc, char *argv[])
|
||||
(uint8 *)bh_read_file_to_buffer(wasm_file_name, &wasm_file_size)))
|
||||
goto fail1;
|
||||
|
||||
if (get_package_type(wasm_file, wasm_file_size) != Wasm_Module_Bytecode) {
|
||||
printf("Invalid file type: expected wasm file but got other\n");
|
||||
goto fail2;
|
||||
}
|
||||
|
||||
/* load WASM module */
|
||||
if (!(wasm_module = wasm_runtime_load(wasm_file, wasm_file_size, error_buf,
|
||||
sizeof(error_buf)))) {
|
||||
|
||||
Reference in New Issue
Block a user