From 7803a3183b4ed3ab975311eeb014365e56a85950 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 3 Sep 2025 10:33:53 +0200 Subject: [PATCH 1/4] fix: add missing exports --- include/wasi_serdes.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/wasi_serdes.h b/include/wasi_serdes.h index 90db7cd..b482918 100644 --- a/include/wasi_serdes.h +++ b/include/wasi_serdes.h @@ -6,7 +6,9 @@ /* Basic uint{8,16,32,64}_t read/write functions. */ #define BASIC_TYPE(name, type) \ + UVWASI_EXPORT \ void uvwasi_serdes_write_##name(void* ptr, size_t offset, type value); \ + UVWASI_EXPORT \ type uvwasi_serdes_read_##name(const void* ptr, size_t offset); \ #define BASIC_TYPE_UVWASI(type) BASIC_TYPE(type, uvwasi_##type) @@ -83,15 +85,18 @@ BASIC_TYPE_UVWASI(whence_t) /* WASI structure read/write functions. */ #define STRUCT(name) \ + UVWASI_EXPORT \ void uvwasi_serdes_write_##name(void* ptr, \ size_t offset, \ const uvwasi_##name* value); \ + UVWASI_EXPORT \ void uvwasi_serdes_read_##name(const void* ptr, \ size_t offset, \ uvwasi_##name* value); /* iovs currently only need to be read from WASM memory. */ #define IOVS_STRUCT(name) \ + UVWASI_EXPORT \ uvwasi_errno_t uvwasi_serdes_read_##name(const void* ptr, \ size_t end, \ size_t offset, \ From bab94a4c0286afea0cb267445acbffed9349009a Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 3 Sep 2025 14:30:13 +0200 Subject: [PATCH 2/4] fixup! fix: add missing exports --- CMakeLists.txt | 4 ++++ include/wasi_types.h | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a4b33e..5071c8c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,10 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/out) if(CMAKE_C_COMPILER_ID MATCHES "AppleClang|Clang|GNU") list(APPEND uvwasi_cflags -fvisibility=hidden --std=gnu89) + # Since we are setting default visibility as "hidden", we need to set `UVWASI_EXPORT` + # so symbols we want to export do end up in the dynamic library. + add_compile_definitions(UVWASI_EXPORT="__attribute__((visibility(\"default\")))") + list(APPEND uvwasi_cflags -Wall -Wsign-compare -Wextra -Wstrict-prototypes) list(APPEND uvwasi_cflags -Wno-unused-parameter) endif() diff --git a/include/wasi_types.h b/include/wasi_types.h index 295c93e..27b55cc 100644 --- a/include/wasi_types.h +++ b/include/wasi_types.h @@ -322,10 +322,10 @@ typedef uint8_t uvwasi_whence_t; #define UVWASI_WHENCE_CUR 1 #define UVWASI_WHENCE_END 2 -#if defined(_WIN32) || defined(__CYGWIN__) +#ifndef UVWASI_EXPORT + // Actual value should be passed by the build system if -fvisibility=hidden is passed. + // Otherwise, default to empty string, since by default all symbols are exported. #define UVWASI_EXPORT -#else - #define UVWASI_EXPORT __attribute__((visibility("default"))) #endif #endif /* __UVWASI_WASI_TYPES_H__ */ From 1903fa652fd64893f684eabdb3231ada9f0b3b52 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 3 Sep 2025 14:45:14 +0200 Subject: [PATCH 3/4] fixup! fixup! fix: add missing exports --- CMakeLists.txt | 6 ++---- include/wasi_types.h | 8 ++++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5071c8c..5fac694 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,10 +21,8 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/out) if(CMAKE_C_COMPILER_ID MATCHES "AppleClang|Clang|GNU") list(APPEND uvwasi_cflags -fvisibility=hidden --std=gnu89) - # Since we are setting default visibility as "hidden", we need to set `UVWASI_EXPORT` - # so symbols we want to export do end up in the dynamic library. - add_compile_definitions(UVWASI_EXPORT="__attribute__((visibility(\"default\")))") - + add_compile_definitions(NEED_UVWASI_EXPORT) + list(APPEND uvwasi_cflags -Wall -Wsign-compare -Wextra -Wstrict-prototypes) list(APPEND uvwasi_cflags -Wno-unused-parameter) endif() diff --git a/include/wasi_types.h b/include/wasi_types.h index 27b55cc..84ba249 100644 --- a/include/wasi_types.h +++ b/include/wasi_types.h @@ -322,10 +322,10 @@ typedef uint8_t uvwasi_whence_t; #define UVWASI_WHENCE_CUR 1 #define UVWASI_WHENCE_END 2 -#ifndef UVWASI_EXPORT - // Actual value should be passed by the build system if -fvisibility=hidden is passed. - // Otherwise, default to empty string, since by default all symbols are exported. +#if NEED_UVWASI_EXPORT + #define UVWASI_EXPORT __attribute__((visibility("default"))) +#else #define UVWASI_EXPORT -#endif +#endif /* NEED_UVWASI_EXPORT */ #endif /* __UVWASI_WASI_TYPES_H__ */ From 2e58e36ca744e6a5432b188eef16b238834b1d17 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 3 Sep 2025 14:47:00 +0200 Subject: [PATCH 4/4] fixup! fixup! fixup! fix: add missing exports --- include/wasi_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/wasi_types.h b/include/wasi_types.h index 84ba249..85eadd7 100644 --- a/include/wasi_types.h +++ b/include/wasi_types.h @@ -322,7 +322,7 @@ typedef uint8_t uvwasi_whence_t; #define UVWASI_WHENCE_CUR 1 #define UVWASI_WHENCE_END 2 -#if NEED_UVWASI_EXPORT +#ifdef NEED_UVWASI_EXPORT #define UVWASI_EXPORT __attribute__((visibility("default"))) #else #define UVWASI_EXPORT