Description
I can't seem to reproduce this when building locally from source, but the precompiled releases are segfaulting when executed over some wasm files locally on Linux. This was originally reported at rustwasm/wasm-pack#696 and can be reproduced by downloading the latest Linux binary release and running wasm-opt -O1 input.wasm -o /dev/null
over this wasm file: wasmboypluginhqx_bg.wasm.gz
When I reproduce the build process for the Linux releases locally I get a build which sometimes works and sometimes doesn't (most of it doesn't). I've at least ruled out the strip
step as the binaries coming out of make
are the ones which segfault:
$ ./bin/wasm-opt -O1 $HOME/code/wasm-pack/wut/binaryen-version_78/wasmboypluginhqx_bg.wasm
zsh: abort (core dumped) ./bin/wasm-opt -O1
The stack trace for the abort is:
Thread 23 "wasm-opt" received signal SIGABRT, Aborted.
[Switching to LWP 15715]
__restore_sigs (set=set@entry=0x7ffff7e16000) at ./arch/x86_64/syscall_arch.h:40
40 ./arch/x86_64/syscall_arch.h: No such file or directory.
(gdb) bt
#0 __restore_sigs (set=set@entry=0x7ffff7e16000) at ./arch/x86_64/syscall_arch.h:40
#1 0x00000000007dd1ce in raise (sig=sig@entry=6) at src/signal/raise.c:11
#2 0x00000000007db2a2 in abort () at src/exit/abort.c:14
#3 0x00000000007d8a6b in uw_init_context_1 (context=context@entry=0x7ffff7e162a0, outer_cfa=outer_cfa@entry=0x7ffff7e16650, outer_ra=
0x781f6d <__cxxabiv1::__cxa_throw(void*, std::type_info*, void (*)(void*))+66>) at /home/buildozer/aports/main/gcc/src/gcc-8.3.0/libgcc/unwind-dw2.c:1587
#4 0x00000000007d8eac in _Unwind_RaiseException (exc=exc@entry=0x999720) at /home/buildozer/aports/main/gcc/src/gcc-8.3.0/libgcc/unwind.inc:93
#5 0x0000000000781f6d in __cxxabiv1::__cxa_throw (obj=0x999740, tinfo=0x8a6098 <typeinfo for wasm::PrecomputingExpressionRunner::NonstandaloneException>, dest=0x0)
at /home/buildozer/aports/main/gcc/src/gcc-8.3.0/libstdc++-v3/libsupc++/eh_throw.cc:90
#6 0x000000000064079f in wasm::PrecomputingExpressionRunner::trap(char const*) ()
#7 0x0000000000642980 in wasm::OverriddenVisitor<wasm::PrecomputingExpressionRunner, wasm::Flow>::visit(wasm::Expression*) ()
#8 0x00000000006474b9 in wasm::Precompute::visitExpression(wasm::Expression*) ()
#9 0x000000000064b84f in wasm::WalkerPass<wasm::PostWalker<wasm::Precompute, wasm::UnifiedExpressionVisitor<wasm::Precompute, void> > >::runOnFunction(wasm::PassRunner*, wasm::Module*, wasm::Function*) ()
#10 0x00000000004ce68a in wasm::PassRunner::runPassOnFunction(wasm::Pass*, wasm::Function*) ()
#11 0x00000000004ce844 in std::_Function_handler<wasm::ThreadWorkState (), wasm::PassRunner::run()::{lambda()#2}::operator()() const::{lambda()#1}>::_M_invoke(std::_Any_data const&) ()
#12 0x000000000076a882 in wasm::Thread::mainLoop(void*) ()
#13 0x0000000000788662 in std::execute_native_thread_routine (__p=0x9acfc0) at /home/buildozer/aports/main/gcc/src/gcc-8.3.0/libstdc++-v3/src/c++11/thread.cc:80
#14 0x00000000007e1189 in start (p=<optimized out>) at src/thread/pthread_create.c:147
#15 0x00000000007e1e1e in __clone () at src/thread/x86_64/clone.s:21
Backtrace stopped: frame did not save the PC
This does sort of look build-related and all about unwinding, although I won't pretend to understand what is going on here and how this could be fixed.