Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,17 @@
llvmEnv = ''
# When compiling to wasm, we want to have more control over the flags,
# so we do not use the nix-provided wrapper in clang
export WASM_CLANG="clang-19"
export WASM_CLANG="clang-20"
export WASM_LD=wasm-ld
# because we use the unwrapped clang, we have to pass in some flags/paths
# that otherwise the wrapped clang would take care for us
export WASM_CLANG_LIB="${pkgs.llvmPackages_19.clang-unwrapped.lib}"
export WASM_CLANG_LIB="${pkgs.llvmPackages_20.clang-unwrapped.lib}"

# When compiling natively, we want to use `clang` (which is a nixpkgs
# provided wrapper that sets various include paths etc).
# But for some reason it does not handle building for Wasm well, so
# there we use plain clang-19. There is no stdlib there anyways.
export CLANG="${pkgs.clang_19}/bin/clang"
# there we use plain clang-20. There is no stdlib there anyways.
export CLANG="${pkgs.clang_20}/bin/clang"
'';

rts = import ./nix/rts.nix { inherit pkgs llvmEnv; };
Expand Down
2 changes: 1 addition & 1 deletion nix/ic-wasm.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pkgs: with pkgs.llvmPackages_19; pkgs.rustPlatform.buildRustPackage rec {
pkgs: with pkgs.llvmPackages_20; pkgs.rustPlatform.buildRustPackage rec {
pname = "ic-wasm";
version = builtins.substring 0 7 src.rev;
src = pkgs.sources.ic-wasm-src;
Expand Down
4 changes: 2 additions & 2 deletions nix/rts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ pkgs.stdenv.mkDerivation {
nativeBuildInputs = [ pkgs.makeWrapper pkgs.removeReferencesTo pkgs.cacert ];

buildInputs = with pkgs; [
llvmPackages_19.clang
llvmPackages_19.bintools
llvmPackages_20.clang
llvmPackages_20.bintools
rust-nightly
wasmtime
rust-bindgen
Expand Down
2 changes: 1 addition & 1 deletion nix/tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ let

# extra deps for test/ld
ldTestDeps =
with pkgs.llvmPackages_19; [ lld clang ];
with pkgs.llvmPackages_20; [ lld clang ];

testDerivation = args:
pkgs.stdenv.mkDerivation (testDerivationArgs // args);
Expand Down
13 changes: 9 additions & 4 deletions rts/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
SHELL:=bash -O globstar

CLANG ?= clang-19
CLANG ?= clang-20
LLVM_LINK = llvm-link
WASM_CLANG ?= clang-19
WASM_LD ?= wasm-ld-19
WASM_CLANG ?= clang-20
WASM_LD ?= wasm-ld-20

#
# We manually list all the .c files of libtommath that we care about.
Expand Down Expand Up @@ -270,7 +270,6 @@ test64: $(TEST_DEPENDENCIES_64)

EXPORTED_SYMBOLS=\
__wasm_call_ctors \
__wasm_apply_data_relocs \
memcmp \
tan \
asin \
Expand All @@ -286,6 +285,12 @@ EXPORTED_SYMBOLS=\
fmodf \
log

EXPORTED_SYMBOLS_64=\
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is dead code. None of our RTS libraries export it.

$(EXPORTED_SYMBOLS) \
__wasm_apply_data_relocs



WASM_A_DEPENDENCIES_32=$(TOMMATH_WASM_32_A)
LINKER_OPTIONS_32=\
--import-memory --shared --no-entry --gc-sections \
Expand Down
4 changes: 2 additions & 2 deletions rts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ Running `make` should produce RTS Wasm files (different versions).

If run within the Nix shell, the environment variables `WASM_CLANG` and `WASM_LD`
should point to suitable binaries (we track a specific unreleased version of
`llvm`). If not present, the `Makefile` will try to use `clang-19` and
`wasm-ld-19`.
`llvm`). If not present, the `Makefile` will try to use `clang-20` and
`wasm-ld-20`.

The runtime compiles and links in [libtommath]. It needs the source, so
`nix build` and `nix develop` will set the environment variable `TOMMATHSRC` to
Expand Down
2 changes: 1 addition & 1 deletion test/bench/ok/bignum.drun-run.ok
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ingress Completed: Reply: 0x4449444c016c01b3c4b1f204680100010a00000000000000000101
ingress Completed: Reply: 0x4449444c0000
debug.print: {cycles = 2_503_853; size = +25_528}
debug.print: {cycles = 2_464_174; size = +25_528}
ingress Completed: Reply: 0x4449444c0000
debug.print: {cycles = 54_911_669; size = +830_464}
ingress Completed: Reply: 0x4449444c0000
Expand Down
4 changes: 2 additions & 2 deletions test/bench/ok/heap-32.drun-run.ok
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ingress Completed: Reply: 0x4449444c016c01b3c4b1f204680100010a00000000000000000101
ingress Completed: Reply: 0x4449444c0000
debug.print: (50_227, +75_320_504, 1_137_727_438)
debug.print: (50_070, +86_221_288, 1_237_464_268)
debug.print: (50_227, +75_320_504, 1_137_089_459)
debug.print: (50_070, +86_221_288, 1_236_660_755)
ingress Completed: Reply: 0x4449444c0000
ingress Completed: Reply: 0x4449444c0000
4 changes: 2 additions & 2 deletions test/bench/ok/heap-64.drun-run.ok
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ingress Completed: Reply: 0x4449444c016c01b3c4b1f204680100010a00000000000000000101
ingress Completed: Reply: 0x4449444c0000
debug.print: (49_965, +88_051_888, 1_309_249_302)
debug.print: (49_806, +86_432_120, 1_281_944_210)
debug.print: (49_965, +88_051_888, 1_307_891_851)
debug.print: (49_806, +86_432_120, 1_280_591_180)
ingress Completed: Reply: 0x4449444c0000
ingress Completed: Reply: 0x4449444c0000
4 changes: 2 additions & 2 deletions test/ld/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ accept:
clean:
rm -rf _out

WASM_CLANG?=clang-19
WASM_LD?=wasm-ld-19
WASM_CLANG?=clang-20
WASM_LD?=wasm-ld-20
MO_LD?=../../src/mo-ld

_out/%.lib.o: %.c | _out
Expand Down
6 changes: 1 addition & 5 deletions test/ld/ok/representative.linked.wat.ok
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
call $not_yet_imported2)
(func $resolved_export (type 0))
(func $__wasm_call_ctors (type 0))
(func $__wasm_apply_data_relocs (type 0))
(func $square (type 1) (param i32) (result i32)
call $resolved_export
call $unresolved_import
Expand All @@ -21,10 +20,7 @@
i32.mul)
(func $link_start (type 0)
call $__wasm_call_ctors)
(func $link_start.1 (type 0)
call $__wasm_apply_data_relocs
call $link_start)
(table (;0;) i64 1 1 funcref)
(memory (;0;) i64 2)
(global (;0;) i64 (i64.const 65536))
(start $link_start.1))
(start $link_start))
Loading