-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start renaming preview1 to p1 and preview2 to p2 (#478)
* Start renaming preview1 to p1 and preview2 to p2 This is an initial start at renaming the "preview" terminology in WASI targets to "pX". For example the `wasm32-wasi` target should transition to `wasm32-wasip1`, `wasm32-wasi-preview2` should transition to `wasm32-wasip2`, and `wasm32-wasi-threads` should transition to `wasm32-wasip1-threads`. This commit applies a few renames in the `Makefile` such as: * `WASI_SNAPSHOT` is now either "p1" or "p2" * The default p2 target triple is now `wasm32-wasip2` instead of `wasm32-wasi-preview2` (in the hopes that it's early enough to change the default). * Bindings for WASIp2 were renamed from "preview2" terminology to "wasip2". * The expected-defines files are renamed and the logic of which expectation was used has been updated slightly. With this commit the intention is that non-preview2 defaults do not change. For example the default build still produces a `wasm32-wasi` sysroot. If `TARGET_TRIPLE=wasm32-wasip1` is passed, however, then that sysroot is produced instead. Similarly a `THREAD_MODEL=posix` build produces a `wasm32-wasi-threads` sysroot target but you can now also pass `TARGET_TRIPLE=wasm32-wasip1-threads` to rename the sysroot. My hope is to integrate this into the wasi-sdk repository and build a dual sysroot for these new targets for a release or two so both are supported and then in the future the defaults can be switched away from `wasm32-wasi` to `wasm32-wasip1` as built-by-default. * Update builds in CI * Update test workflow * Fix test for wasm32-wasip1-threads * Make github actions rules a bit more readable
- Loading branch information
1 parent
09683b3
commit c9c7d06
Showing
19 changed files
with
191 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,20 +15,20 @@ SYSROOT ?= $(CURDIR)/sysroot | |
INSTALL_DIR ?= /usr/local | ||
# single or posix; note that pthread support is still a work-in-progress. | ||
THREAD_MODEL ?= single | ||
# preview1 or preview2; the latter is not (yet) compatible with multithreading | ||
WASI_SNAPSHOT ?= preview1 | ||
# p1 or p2; the latter is not (yet) compatible with multithreading | ||
WASI_SNAPSHOT ?= p1 | ||
# dlmalloc or none | ||
MALLOC_IMPL ?= dlmalloc | ||
# yes or no | ||
BUILD_LIBC_TOP_HALF ?= yes | ||
# The directory where we will store intermediate artifacts. | ||
OBJDIR ?= build/$(TARGET_TRIPLE) | ||
# The directory where we store files and tools for generating WASI Preview 2 bindings | ||
# The directory where we store files and tools for generating WASIp2 bindings | ||
BINDING_WORK_DIR ?= build/bindings | ||
# URL from which to retrieve the WIT files used to generate the WASI Preview 2 bindings | ||
# URL from which to retrieve the WIT files used to generate the WASIp2 bindings | ||
WASI_CLI_URL ?= https://github.com/WebAssembly/wasi-cli/archive/refs/tags/v0.2.0.tar.gz | ||
# URL from which to retrieve the `wit-bindgen` command used to generate the WASI | ||
# Preview 2 bindings. | ||
# URL from which to retrieve the `wit-bindgen` command used to generate the | ||
# WASIp2 bindings. | ||
WIT_BINDGEN_URL ?= https://github.com/bytecodealliance/wit-bindgen/releases/download/wit-bindgen-cli-0.17.0/wit-bindgen-v0.17.0-x86_64-linux.tar.gz | ||
|
||
# When the length is no larger than this threshold, we consider the | ||
|
@@ -50,8 +50,8 @@ ifeq ($(THREAD_MODEL), posix) | |
TARGET_TRIPLE = wasm32-wasi-threads | ||
endif | ||
|
||
ifeq ($(WASI_SNAPSHOT), preview2) | ||
TARGET_TRIPLE = wasm32-wasi-preview2 | ||
ifeq ($(WASI_SNAPSHOT), p2) | ||
TARGET_TRIPLE = wasm32-wasip2 | ||
endif | ||
|
||
BUILTINS_LIB ?= $(shell ${CC} --print-libgcc-file-name) | ||
|
@@ -75,16 +75,16 @@ LIBC_BOTTOM_HALF_ALL_SOURCES = \ | |
$(shell find $(LIBC_BOTTOM_HALF_CLOUDLIBC_SRC) -name \*.c) \ | ||
$(shell find $(LIBC_BOTTOM_HALF_SOURCES) -name \*.c)) | ||
|
||
ifeq ($(WASI_SNAPSHOT), preview1) | ||
# Omit source files not relevant to WASI Preview 1. As we introduce files | ||
# supporting `wasi-sockets` for `wasm32-wasi-preview2`, we'll add those files to | ||
ifeq ($(WASI_SNAPSHOT), p1) | ||
# Omit source files not relevant to WASIp1. As we introduce files | ||
# supporting `wasi-sockets` for `wasm32-wasip2`, we'll add those files to | ||
# this list. | ||
LIBC_BOTTOM_HALF_OMIT_SOURCES := \ | ||
$(LIBC_BOTTOM_HALF_SOURCES)/preview2.c \ | ||
$(LIBC_BOTTOM_HALF_SOURCES)/wasip2.c \ | ||
$(LIBC_BOTTOM_HALF_SOURCES)/descriptor_table.c | ||
LIBC_BOTTOM_HALF_ALL_SOURCES := $(filter-out $(LIBC_BOTTOM_HALF_OMIT_SOURCES),$(LIBC_BOTTOM_HALF_ALL_SOURCES)) | ||
# Omit preview2-specific headers from include-all.c test. | ||
INCLUDE_ALL_CLAUSES := -not -name preview2.h -not -name descriptor_table.h | ||
# Omit p2-specific headers from include-all.c test. | ||
INCLUDE_ALL_CLAUSES := -not -name wasip2.h -not -name descriptor_table.h | ||
endif | ||
|
||
# FIXME(https://reviews.llvm.org/D85567) - due to a bug in LLD the weak | ||
|
@@ -382,8 +382,8 @@ DLMALLOC_OBJS = $(call objs,$(DLMALLOC_SOURCES)) | |
EMMALLOC_OBJS = $(call objs,$(EMMALLOC_SOURCES)) | ||
LIBC_BOTTOM_HALF_ALL_OBJS = $(call objs,$(LIBC_BOTTOM_HALF_ALL_SOURCES)) | ||
LIBC_TOP_HALF_ALL_OBJS = $(call asmobjs,$(call objs,$(LIBC_TOP_HALF_ALL_SOURCES))) | ||
ifeq ($(WASI_SNAPSHOT), preview2) | ||
LIBC_OBJS += $(OBJDIR)/preview2_component_type.o | ||
ifeq ($(WASI_SNAPSHOT), p2) | ||
LIBC_OBJS += $(OBJDIR)/wasip2_component_type.o | ||
endif | ||
ifeq ($(MALLOC_IMPL),dlmalloc) | ||
LIBC_OBJS += $(DLMALLOC_OBJS) | ||
|
@@ -606,7 +606,7 @@ $(OBJDIR)/%.long-double.pic.o: %.c include_dirs | |
@mkdir -p "$(@D)" | ||
$(CC) $(CFLAGS) -MD -MP -o $@ -c $< | ||
|
||
$(OBJDIR)/preview2_component_type.pic.o $(OBJDIR)/preview2_component_type.o: $(LIBC_BOTTOM_HALF_SOURCES)/preview2_component_type.o | ||
$(OBJDIR)/wasip2_component_type.pic.o $(OBJDIR)/wasip2_component_type.o: $(LIBC_BOTTOM_HALF_SOURCES)/wasip2_component_type.o | ||
@mkdir -p "$(@D)" | ||
cp $< $@ | ||
|
||
|
@@ -741,6 +741,17 @@ endif | |
DEFINED_SYMBOLS = $(SYSROOT_SHARE)/defined-symbols.txt | ||
UNDEFINED_SYMBOLS = $(SYSROOT_SHARE)/undefined-symbols.txt | ||
|
||
ifeq ($(WASI_SNAPSHOT),p2) | ||
EXPECTED_TARGET_DIR = expected/wasm32-wasip2 | ||
else | ||
ifeq ($(THREAD_MODEL),posix) | ||
EXPECTED_TARGET_DIR = expected/wasm32-wasip1-threads | ||
else | ||
EXPECTED_TARGET_DIR = expected/wasm32-wasip1 | ||
endif | ||
endif | ||
|
||
|
||
check-symbols: startup_files libc | ||
# | ||
# Collect metadata on the sysroot and perform sanity checks. | ||
|
@@ -836,7 +847,7 @@ check-symbols: startup_files libc | |
|
||
# Check that the computed metadata matches the expected metadata. | ||
# This ignores whitespace because on Windows the output has CRLF line endings. | ||
diff -wur "expected/$(TARGET_TRIPLE)" "$(SYSROOT_SHARE)" | ||
diff -wur "$(EXPECTED_TARGET_DIR)" "$(SYSROOT_SHARE)" | ||
|
||
install: finish | ||
mkdir -p "$(INSTALL_DIR)" | ||
|
@@ -860,7 +871,7 @@ bindings: $(BINDING_WORK_DIR)/wasi-cli $(BINDING_WORK_DIR)/wit-bindgen | |
cd "$(BINDING_WORK_DIR)" && \ | ||
./wit-bindgen/wit-bindgen c \ | ||
--autodrop-borrows yes \ | ||
--rename-world preview2 \ | ||
--rename-world wasip2 \ | ||
--type-section-suffix __wasi_libc \ | ||
--world wasi:cli/[email protected] \ | ||
--rename wasi:clocks/[email protected]=monotonic_clock \ | ||
|
@@ -891,12 +902,12 @@ bindings: $(BINDING_WORK_DIR)/wasi-cli $(BINDING_WORK_DIR)/wit-bindgen | |
--rename wasi:cli/[email protected]=terminal_stdout \ | ||
--rename wasi:cli/[email protected]=terminal_stderr \ | ||
./wasi-cli/wit && \ | ||
mv preview2.h ../../libc-bottom-half/headers/public/wasi/ && \ | ||
mv preview2_component_type.o ../../libc-bottom-half/sources && \ | ||
sed 's_#include "preview2\.h"_#include "wasi/preview2.h"_' \ | ||
< preview2.c \ | ||
> ../../libc-bottom-half/sources/preview2.c && \ | ||
rm preview2.c | ||
mv wasip2.h ../../libc-bottom-half/headers/public/wasi/ && \ | ||
mv wasip2_component_type.o ../../libc-bottom-half/sources && \ | ||
sed 's_#include "wasip2\.h"_#include "wasi/wasip2.h"_' \ | ||
< wasip2.c \ | ||
> ../../libc-bottom-half/sources/wasip2.c && \ | ||
rm wasip2.c | ||
|
||
|
||
clean: | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.