Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wasm-ld crash running sockets.test_enet #14220

Closed
sbc100 opened this issue May 19, 2021 · 4 comments
Closed

wasm-ld crash running sockets.test_enet #14220

sbc100 opened this issue May 19, 2021 · 4 comments
Assignees

Comments

@sbc100
Copy link
Collaborator

sbc100 commented May 19, 2021

This crash made it through the rollers:

https://app.circleci.com/pipelines/github/emscripten-core/emscripten/13394/workflows/68e06e6f-fc5f-4135-9d37-1337aebc80df/jobs/426872

Its most likely related to the recent string merging change.

libtool: link: /usr/local/google/home/sbc/dev/wasm/emscripten/emcc -shared  -fPIC -DPIC  .libs/callbacks.o .libs/compress.o .libs/host.o .libs/list.o .libs/packet.o .libs/peer.o .libs/protocol.o .libs/unix.o .libs/win32.o   -lc  -O2   -Wl,-soname -Wl,libenet.so.1 -o .libs/libenet.so.1.0.3
emcc: warning: linking a library with `-shared` will emit a static object file.  This is a form of emulation to support existing build systems.  If you want to build a runtime shared library use the SIDE_MODULE setting. [-Wemcc]
emcc: warning: generating an executable with an object extension (.so).  If you meant to build an object file please use `-c, `-r`, or `-shared` [-Wemcc]
emcc: warning: ignoring unsupported linker flag: `-soname` [-Wlinkflags]
wasm-ld: /usr/local/google/home/sbc/dev/wasm/llvm-project/lld/wasm/Symbols.cpp:399: const lld::wasm::OutputSectionSymbol *lld::wasm::SectionSymbol::getOutputSectionSymbol() const: Assertion `section->outputSec && section->outputSec->sectionSym' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /usr/local/google/home/sbc/dev/wasm/llvm-build/bin/wasm-ld -o .libs/libenet.so.1.0.3 .libs/callbacks.o .libs/compress.o .libs/host.o .libs/list.o .libs/packet.o .libs/peer.o .libs/protocol.o .libs/unix.o .libs/win32.o /usr/local/google/home/sbc/dev/wasm/emscripten/cache/sysroot/lib/wasm32-emscripten/libc.a -L/usr/local/google/home/sbc/dev/wasm/emscripten/cache/sysroot/lib/wasm32-emscripten --relocatable -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr
 #0 0x00007fdc53687363 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libLLVMSupport.so.13git+0x19a363)
 #1 0x00007fdc536850ae llvm::sys::RunSignalHandlers() (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/libLLVMSupport.so.13git+0x1980ae)
 #2 0x00007fdc5368782f SignalHandler(int) Signals.cpp:0:0
 #3 0x00007fdc53d46140 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14140)
 #4 0x00007fdc53036ce1 raise ./signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #5 0x00007fdc53020537 abort ./stdlib/abort.c:81:7
 #6 0x00007fdc5302040f get_sysdep_segment_value ./intl/loadmsgcat.c:509:8
 #7 0x00007fdc5302040f _nl_load_domain ./intl/loadmsgcat.c:970:34
 #8 0x00007fdc5302f662 (/lib/x86_64-linux-gnu/libc.so.6+0x34662)
 #9 0x00007fdc538a2868 (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/liblldWasm.so.13git+0x54868)
#10 0x00007fdc5387ee12 lld::wasm::ObjFile::calcNewIndex(llvm::wasm::WasmRelocation const&) const (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/liblldWasm.so.13git+0x30e12)
#11 0x00007fdc5387bdde lld::wasm::InputChunk::writeRelocations(llvm::raw_ostream&) const (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/liblldWasm.so.13git+0x2ddde)
#12 0x00007fdc53892b7b lld::wasm::CustomSection::writeRelocations(llvm::raw_ostream&) const (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/liblldWasm.so.13git+0x44b7b)
#13 0x00007fdc538a8b79 lld::wasm::RelocSection::writeBody() (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/liblldWasm.so.13git+0x5ab79)
#14 0x00007fdc538a8d8a lld::wasm::SyntheticSection::finalizeContents() crtstuff.c:0:0
#15 0x00007fdc538b5c28 lld::wasm::(anonymous namespace)::Writer::run() Writer.cpp:0:0
#16 0x00007fdc538ac9a1 lld::wasm::writeResult() (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/liblldWasm.so.13git+0x5e9a1)
#17 0x00007fdc53873080 lld::wasm::(anonymous namespace)::LinkerDriver::linkerMain(llvm::ArrayRef<char const*>) Driver.cpp:0:0
#18 0x00007fdc5386c216 lld::wasm::link(llvm::ArrayRef<char const*>, bool, llvm::raw_ostream&, llvm::raw_ostream&) (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/../lib/liblldWasm.so.13git+0x1e216)
#19 0x0000000000403bdf lldMain(int, char const**, llvm::raw_ostream&, llvm::raw_ostream&, bool) lld.cpp:0:0
#20 0x00000000004037e0 main (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/wasm-ld+0x4037e0)
#21 0x00007fdc53021d0a __libc_start_main ./csu/../csu/libc-start.c:308:16
#22 0x00000000004034ba _start (/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/wasm-ld+0x4034ba)
emcc: error: '/usr/local/google/home/sbc/dev/wasm/llvm-build/bin/wasm-ld -o .libs/libenet.so.1.0.3 .libs/callbacks.o .libs/compress.o .libs/host.o .libs/list.o .libs/packet.o .libs/peer.o .libs/protocol.o .libs/unix.o .libs/win32.o /usr/local/google/home/sbc/dev/wasm/emscripten/cache/sysroot/lib/wasm32-emscripten/libc.a -L/usr/local/google/home/sbc/dev/wasm/emscripten/cache/sysroot/lib/wasm32-emscripten --relocatable -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr' failed (-6)
make: *** [Makefile:323: libenet.la] Error 1
emmake: error: 'make' failed (2)
FAIL
@sbc100 sbc100 self-assigned this May 19, 2021
sbc100 added a commit that referenced this issue May 19, 2021
This isn't actually a fix for the linker crash but a workaround
to fix emscripten CI.  I'll leave the bug open until we have an
actual fix upstream.

See: #14220
sbc100 added a commit that referenced this issue May 19, 2021
This isn't actually a fix for the linker crash but a workaround
to fix emscripten CI.  I'll leave the bug open until we have an
actual fix upstream.

See: #14220
@kripken
Copy link
Member

kripken commented May 19, 2021

Commenting here to remind us to remove the workaround in #14222 when we can (when the LLVM issue is fixed).

@sbc100
Copy link
Collaborator Author

sbc100 commented May 19, 2021

Yeah.. I'm in two minds about actually reverting that since --disabled-shared is the prefered/recommended way to target emscripten, but clearly there is some test coverage here that we were lacking elsewhere. If it can add a targetted test rather than reverting #14222 I think that would be nicer.

@kripken
Copy link
Member

kripken commented May 19, 2021

Makes sense, a targeted test sounds even better.

@sbc100
Copy link
Collaborator Author

sbc100 commented May 19, 2021

Upstream fix is https://reviews.llvm.org/D102806

arichardson pushed a commit to arichardson/llvm-project that referenced this issue Sep 12, 2021
Ensure that both SyntheticMergedChunk and all MergeInfoChunks that it
comprises are assigned the correct output section.  Without this we
would crash when outputting relocations in --relocatable mode.

Fixes: emscripten-core/emscripten#14220

Differential Revision: https://reviews.llvm.org/D102806
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants