@@ -61,6 +61,10 @@ stdenv.mkDerivation rec {
6161 sed -i "s|^EMXX =.*|EMXX='$out/bin/em++'|" tools/shared.py
6262 sed -i "s|^EMAR =.*|EMAR='$out/bin/emar'|" tools/shared.py
6363 sed -i "s|^EMRANLIB =.*|EMRANLIB='$out/bin/emranlib'|" tools/shared.py
64+
65+ # The tests use the C compiler to compile generated C code,
66+ # use the wrapped compiler
67+ sed -i 's/shared.CLANG_CC/"cc"/' tests/runner.py
6468 '';
6569
6670 installPhase = ''
@@ -77,16 +81,23 @@ stdenv.mkDerivation rec {
7781 --set PYTHON ${python3}/bin/python
7882 done
7983
80− # precompile libc in all four variants:
81− # wasm, wasm-pic, wasm-lto, wasm-lto-pic
84+ # precompile libc (etc.) in all variants:
85+ pushd $TMPDIR
86+ echo 'int main() { return 42; }' >test.c
87+ for LTO in -flto ""; do
88+ # wasm2c doesn't work with PIC
89+ $out/bin/emcc -s WASM2C -s STANDALONE_WASM $LTO test.c
90+
91+ for RELOCATABLE in "" "-s RELOCATABLE"; do
92+ $out/bin/emcc $RELOCATABLE $LTO test.c
93+ done
94+ done
95+ popd
96+
8297 export PYTHON=${python3}/bin/python
8398 export NODE_PATH=${nodeModules}/node_modules
8499 pushd $appdir
85− for lto in wasm2 wasmlto2; do
86− for pic in test_hello_world test_relocatable_void_function; do
87− python tests/runner.py $lto.$pic
88− done
89− done
100+ python tests/runner.py test_hello_world
90101 popd
91102 '';
92103