Skip to content

Commit

Permalink
Bug 1732824 - Update wasi-sdk to the latest trunk. r=firefox-build-sy…
Browse files Browse the repository at this point in the history
…stem-reviewers,andi

Differential Revision: https://phabricator.services.mozilla.com/D126749
  • Loading branch information
glandium committed Oct 6, 2021
1 parent a0e0676 commit 30724e5
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 19 deletions.
7 changes: 7 additions & 0 deletions config/makefiles/rust.mk
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,13 @@ ifdef RUST_LIBRARY_FEATURES
rust_features_flag := --features '$(RUST_LIBRARY_FEATURES)'
endif

ifeq (WASI,$(OS_ARCH))
# The rust wasi target defaults to statically link the wasi crt, but when we
# build static libraries from rust and link them with C/C++ code, we also link
# a wasi crt, which may conflict with rust's.
force-cargo-library-build: CARGO_RUSTCFLAGS += -C target-feature=-crt-static
endif

# Assume any system libraries rustc links against are already in the target's LIBS.
#
# We need to run cargo unconditionally, because cargo is the only thing that
Expand Down
2 changes: 1 addition & 1 deletion config/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ $(LIBRARY): $(OBJS) $(STATIC_LIBS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
$(WASM_ARCHIVE): $(CWASMOBJS) $(CPPWASMOBJS) $(STATIC_LIBS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
$(REPORT_BUILD_VERBOSE)
$(RM) $(WASM_ARCHIVE)
$(WASM_CXX) -o $@ -Wl,--export-all -Wl,--stack-first -Wl,-z,stack-size=$(if $(MOZ_OPTIMIZE),262144,1048576) -Wl,--no-entry -Wl,--growable-table $(CWASMOBJS) $(CPPWASMOBJS)
$(WASM_CXX) -o $@ -Wl,--export-all -Wl,--stack-first -Wl,-z,stack-size=$(if $(MOZ_OPTIMIZE),262144,1048576) -Wl,--no-entry -Wl,--growable-table $(CWASMOBJS) $(CPPWASMOBJS) -lwasi-emulated-process-clocks

$(addsuffix .c,$(WASM_ARCHIVE)): $(WASM_ARCHIVE)
$(DIST)/host/bin/wasm2c -o $@ $<
Expand Down
6 changes: 6 additions & 0 deletions js/moz.configure
Original file line number Diff line number Diff line change
Expand Up @@ -1093,3 +1093,9 @@ set_config(
set_define(
"ENABLE_WASM_EXCEPTIONS", depends_if("--enable-wasm-exceptions")(lambda x: True)
)

set_define(
"_WASI_EMULATED_PROCESS_CLOCKS",
True,
when=depends(target)(lambda t: t.os == "WASI"),
)
1 change: 1 addition & 0 deletions js/src/shell/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,4 @@ OBJDIR_FILES.js.src += ["!/dist/bin/js%s" % CONFIG["BIN_SUFFIX"]]
# Also make the stack grow towards 0 so that if SpiderMonkey's stack limiter is buggy, overflow will likely trap.
if CONFIG["OS_ARCH"] == "WASI":
LDFLAGS += ["-Wl,-z,stack-size=1048576", "-Wl,--stack-first"]
OS_LIBS += ["wasi-emulated-process-clocks"]
1 change: 1 addition & 0 deletions security/rlbox/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ CFLAGS += [
]

WASM_DEFINES["MOZILLA_CLIENT"] = True
WASM_DEFINES["_WASI_EMULATED_PROCESS_CLOCKS"] = True

SANDBOXED_WASM_LIBRARY_NAME = "rlbox"

Expand Down
2 changes: 1 addition & 1 deletion taskcluster/ci/fetch/toolchains.yml
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ wasi-sdk:
fetch:
type: git
repo: https://github.com/WebAssembly/wasi-sdk
revision: b36c433738f0c29160a5ac1c1cee1b1b884bf4a0
revision: f0d40b6491efc1e2332f55eb22e6292abdce4335

ninja:
description: ninja 1.9.0
Expand Down
17 changes: 0 additions & 17 deletions taskcluster/scripts/misc/build-compiler-rt-wasi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,6 @@ dir=${artifact%.tar.*}
cd $MOZ_FETCHES_DIR/wasi-sdk
LLVM_PROJ_DIR=$MOZ_FETCHES_DIR/llvm-project

# https://github.com/WebAssembly/wasi-sdk/pull/189
patch -p1 <<'EOF'
diff --git a/Makefile b/Makefile
index bde9936..b1f24fe 100644
--- a/Makefile
+++ b/Makefile
@@ -91,7 +91,7 @@ build/wasi-libc.BUILT: build/llvm.BUILT
SYSROOT=$(BUILD_PREFIX)/share/wasi-sysroot
touch build/wasi-libc.BUILT
-build/compiler-rt.BUILT: build/llvm.BUILT
+build/compiler-rt.BUILT: build/llvm.BUILT build/wasi-libc.BUILT
# Do the build, and install it.
mkdir -p build/compiler-rt
cd build/compiler-rt && cmake -G Ninja \
EOF

# Build compiler-rt
make \
LLVM_PROJ_DIR=$LLVM_PROJ_DIR \
Expand Down

0 comments on commit 30724e5

Please sign in to comment.