Skip to content

Commit c7c8e53

Browse files
authored
Fix compilation errors on esp-idf platform (bytecodealliance#3224)
The issue was reported in bytecodealliance#3208.
1 parent 269d5e1 commit c7c8e53

File tree

5 files changed

+17
-5
lines changed

5 files changed

+17
-5
lines changed

core/iwasm/interpreter/wasm_loader.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11421,7 +11421,7 @@ wasm_loader_prepare_bytecode(WASMModule *module, WASMFunction *func,
1142111421

1142211422
case WASM_OP_BR_TABLE:
1142311423
{
11424-
uint32 depth, default_arity, arity = 0;
11424+
uint32 depth = 0, default_arity, arity = 0;
1142511425
BranchBlock *target_block;
1142611426
BlockType *target_block_type;
1142711427
#if WASM_ENABLE_FAST_INTERP == 0

core/iwasm/libraries/libc-builtin/libc_builtin_wrapper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ sprintf_wrapper(wasm_exec_env_t exec_env, char *str, const char *format,
426426
if (!wasm_runtime_get_native_addr_range(module_inst, (uint8 *)str, NULL,
427427
&native_end_offset)) {
428428
wasm_runtime_set_exception(module_inst, "out of bounds memory access");
429-
return false;
429+
return 0;
430430
}
431431

432432
ctx.str = str;

core/shared/platform/esp-idf/espidf_memmap.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ os_mmap(void *hint, size_t size, int prot, int flags, os_file_handle file)
5959
}
6060
}
6161

62+
void *
63+
os_mremap(void *old_addr, size_t old_size, size_t new_size)
64+
{
65+
return os_mremap_slow(old_addr, old_size, new_size);
66+
}
67+
6268
void
6369
os_munmap(void *addr, size_t size)
6470
{

core/shared/platform/esp-idf/espidf_platform.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ unlinkat(int fd, const char *path, int flag)
234234
}
235235

236236
int
237-
utimensat(int fd, const char *path, const struct timespec *ts, int flag)
237+
utimensat(int fd, const char *path, const struct timespec ts[2], int flag)
238238
{
239239
errno = ENOSYS;
240240
return -1;
@@ -257,7 +257,7 @@ ftruncate(int fd, off_t length)
257257
#endif
258258

259259
int
260-
futimens(int fd, const struct timespec *times)
260+
futimens(int fd, const struct timespec times[2])
261261
{
262262
errno = ENOSYS;
263263
return -1;
@@ -268,4 +268,4 @@ nanosleep(const struct timespec *req, struct timespec *rem)
268268
{
269269
errno = ENOSYS;
270270
return -1;
271-
}
271+
}

core/shared/platform/esp-idf/platform_internal.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@ typedef unsigned int korp_sem;
109109
#define DT_LNK DTYPE_LINK
110110
#define DT_SOCK DTYPE_SOCK
111111

112+
static inline int
113+
os_getpagesize()
114+
{
115+
return 4096;
116+
}
117+
112118
typedef int os_file_handle;
113119
typedef DIR *os_dir_stream;
114120
typedef int os_raw_file_handle;

0 commit comments

Comments
 (0)