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 bug #8981

Closed
mekhontsev opened this issue Jul 14, 2019 · 2 comments
Closed

wasm-ld bug #8981

mekhontsev opened this issue Jul 14, 2019 · 2 comments
Assignees

Comments

@mekhontsev
Copy link

mekhontsev commented Jul 14, 2019

em++ file1.cpp file2.cpp

where file1.cpp and file2.cpp are the same:

template <typename T> struct foo {
	foo() :v(s) {}
	T& v;
	static T s;
};
template <typename T> T foo<T>::s = T();
struct bar{ ~bar() { foo<bar>(); }};

Assertion failed: FunctionIndex != INVALID_INDEX, file C:\b\s\w\ir\cache\builder\emscripten-releases\llvm-project\lld\wasm\Symbols.cpp, line 152

The bug also can be reproduced with
boost/math/special_functions/binomial.hpp
boost/spirit/home/support/utree.hpp

It only happens with upstream WASM backend.

@mekhontsev mekhontsev changed the title wasm-ld bug with boost/math wasm-ld bug Jul 15, 2019
@kripken
Copy link
Member

kripken commented Jul 16, 2019

Thanks @truedim!

@sbc100 Looks like this might be an unknown wasm-ld bug?

@sbc100 sbc100 self-assigned this Jul 16, 2019
@sbc100
Copy link
Collaborator

sbc100 commented Jul 17, 2019

Fix is at https://reviews.llvm.org/D64872

llvm-git-migration pushed a commit to llvm/llvm-project that referenced this issue Jul 17, 2019
When hidden symbols are discarded by comdat rules we still want to
create a local defined symbol, otherwise `Symbol::isDiscarded()` relies
on begin able to check `getChunk->discarded`.

This is a followup on rL362769. The comdat.ll test was previously GC'ing
the `__wasm_call_ctors` functions so `do_init` was not actually being
included in the link.  Once that function was included in triggered the
crash bug that this change addresses.

Fixes: emscripten-core/emscripten#8981

Differential Revision: https://reviews.llvm.org/D64872

llvm-svn: 366358
dtzWill pushed a commit to llvm-mirror/lld that referenced this issue Jul 17, 2019
When hidden symbols are discarded by comdat rules we still want to
create a local defined symbol, otherwise `Symbol::isDiscarded()` relies
on begin able to check `getChunk->discarded`.

This is a followup on rL362769. The comdat.ll test was previously GC'ing
the `__wasm_call_ctors` functions so `do_init` was not actually being
included in the link.  Once that function was included in triggered the
crash bug that this change addresses.

Fixes: emscripten-core/emscripten#8981

Differential Revision: https://reviews.llvm.org/D64872

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@366358 91177308-0d34-0410-b5e6-96231b3b80d8
@sbc100 sbc100 closed this as completed Jul 17, 2019
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

3 participants