Support emit specified custom sections into AoT file (#1207)

And add API to get the content of custom section with
section name for both wasm file and aot file.
This commit is contained in:
Xu Jun
2022-06-10 21:51:13 +08:00
committed by GitHub
parent d404107d85
commit 77595c9560
22 changed files with 420 additions and 31 deletions

View File

@ -98,7 +98,7 @@ app_instance_func(wasm_module_inst_t module_inst, const char *func_name)
static char **
split_string(char *str, int *count)
{
char **res = NULL;
char **res = NULL, **res1;
char *p;
int idx = 0;
@ -106,16 +106,18 @@ split_string(char *str, int *count)
do {
p = strtok(str, " ");
str = NULL;
res = (char **)realloc(res, sizeof(char *) * (uint32)(idx + 1));
res1 = res;
res = (char **)realloc(res1, sizeof(char *) * (uint32)(idx + 1));
if (res == NULL) {
free(res1);
return NULL;
}
res[idx++] = p;
} while (p);
/**
* since the function name,
* res[0] might be contains a '\' to indicate a space
* Due to the function name,
* res[0] might contain a '\' to indicate a space
* func\name -> func name
*/
p = strchr(res[0], '\\');

View File

@ -84,7 +84,7 @@ app_instance_func(wasm_module_inst_t module_inst, const char *func_name)
static char **
split_string(char *str, int *count)
{
char **res = NULL;
char **res = NULL, **res1;
char *p, *next_token;
int idx = 0;
@ -92,16 +92,18 @@ split_string(char *str, int *count)
do {
p = strtok_s(str, " ", &next_token);
str = NULL;
res = (char **)realloc(res, sizeof(char *) * (uint32)(idx + 1));
res1 = res;
res = (char **)realloc(res1, sizeof(char *) * (uint32)(idx + 1));
if (res == NULL) {
free(res1);
return NULL;
}
res[idx++] = p;
} while (p);
/**
* since the function name,
* res[0] might be contains a '\' to indicate a space
* Due to the function name,
* res[0] might contain a '\' to indicate a space
* func\name -> func name
*/
p = strchr(res[0], '\\');