@@ -189,19 +189,30 @@ PY_MODULE=false
189189MVP=\$ {MVP:true}
190190WASM_PURE=\$ {WASM_PURE:true}
191191
192+
193+
194+
192195if \$ MVP
193196then
197+
198+ # turn of wasm ex (https://github.com/emscripten-core/emscripten/pull/20536)
199+ # -fno-wasm-exceptions -sEMSCRIPTEN_LONGJMP=0
200+
201+ WASMOPTS="-fno-wasm-exceptions -sSUPPORT_LONGJMP=emscripten"
202+
194203 # -mcpu=generic would activate those https://reviews.llvm.org/D125728
195204 # https://github.com/emscripten-core/emscripten/pull/17689
205+
196206 # -fPIC not allowed with -mno-mutable-globals
197207 # -mno-sign-ext not allowed with pthread
198- CPU="-sSUPPORT_LONGJMP=emscripten -mnontrapping-fptoint -mno-reference-types -mno-sign-ext -m32"
208+
209+ CPU="-mnontrapping-fptoint -mno-reference-types -mno-sign-ext -m32"
199210else
200211 CPU="-mcpu=bleeding-edge -m32"
201212fi
202213
203214# quick hack until 3.1.47
204- CPU ="$WASM_EXTRA \$ CPU "
215+ WASMOPTS ="$WASM_EXTRA \$ WASMOPTS "
205216
206217
207218LINKING=\$ {LINKING:-false}
@@ -299,6 +310,15 @@ for arg do
299310 continue
300311 fi
301312
313+ if [ "\$ arg" = "-pthread" ]
314+ then
315+ if echo \$ CPU|grep -q mno-sign-ext
316+ then
317+ continue
318+ fi
319+ fi
320+
321+
302322 # that is for some very bad setup.py behaviour regarding cross compiling.
303323 # should not be needed ..
304324 [ "\$ arg" = "-I/usr/include" ] && continue
365385 fi
366386 fi
367387else
368- # pass CPU opts only when -c/-o but always PIC
369- $EMSDK_PYTHON -E \$ 0.py \$ CPU_EXTRA -fpic \$ COPTS \$ CPPFLAGS -DBUILD_STATIC "\$ @" \$ COMMON
388+ # do not pass WASM opts when -c/-o but always PIC
389+ $EMSDK_PYTHON -E \$ 0.py $COPTS \$ CPU \$ CPPFLAGS -DBUILD_STATIC "\$ @" \$ COMMON
370390fi
371391#else
372392# unset _EMCC_CCACHE
0 commit comments