Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wasm2c: uvwasi support #2002

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ endif ()
option(BUILD_TESTS "Build GTest-based tests" ON)
option(USE_SYSTEM_GTEST "Use system GTest, instead of building" OFF)
option(BUILD_TOOLS "Build wabt commandline tools" ON)
option(BUILD_UVWASI "Build uvwasi for use by compiled applications" ON)
option(BUILD_FUZZ_TOOLS "Build tools that can repro fuzz bugs" OFF)
option(BUILD_LIBWASM "Build libwasm" ON)
option(USE_ASAN "Use address sanitizer" OFF)
Expand Down Expand Up @@ -336,6 +337,7 @@ set(WABT_LIBRARY_SRC ${WABT_LIBRARY_CC} ${WABT_LIBRARY_H})
add_library(wabt STATIC ${WABT_LIBRARY_SRC})
add_library(wabt::wabt ALIAS wabt)


target_compile_features(wabt PUBLIC cxx_std_17)
target_include_directories(
wabt
Expand Down Expand Up @@ -379,6 +381,10 @@ IF (NOT WIN32)
endif ()
endif ()

if (BUILD_UVWASI)
add_subdirectory("third_party/uvwasi" )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have a WITH_WASI flag .. is there some reason we can't use use that?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seemed to me like enabling the mostly not working wasi support in the interpreter, and allowing people to build their standalone apps with uvwasi were logically separate things. I'm not attached around the issue of wether this is enabled by default, so whatever makes sense just lmk.

endif ()

if (BUILD_FUZZ_TOOLS)
set(FUZZ_FLAGS "-fsanitize=fuzzer,address")
add_library(wabt-fuzz STATIC ${WABT_LIBRARY_SRC})
Expand Down
2 changes: 2 additions & 0 deletions src/c-writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1524,6 +1524,7 @@ void CWriter::WriteDataInitializers() {
}

Write(CloseBrace(), Newline());

}
}

Expand Down Expand Up @@ -2603,6 +2604,7 @@ void CWriter::Write(const ExprList& exprs) {
Table* dest_table =
module_->tables[module_->GetTableIndex(inst->dst_table)];
const Table* src_table = module_->GetTable(inst->src_table);

if (dest_table->elem_type != src_table->elem_type) {
WABT_UNREACHABLE;
}
Expand Down
Loading