-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Polymorphism doesn't work with SIDE_MODULE + USE_PTHREADS at all #17150
Comments
This seems like a very serious bug, do emscripten devs have any comments or suggestions, are there any plans to fix this? |
Dynamic linking + threading is still experimental so its not unlikely this is real bug for something we don't yet have test coverage for. I'll take a look. |
I'm not having any success with dynamic linking and pthreads in a real world multithreaded app. Statically linked, everything works as expected. Dynamically linked (on load or dlopen), strange and unexpected errors always occur. These errors occur on pure C libraries, so I think the issue goes beyond polymorphism. |
I'm working a fix this for this issue. It relates the weakly defined symbols that C++ uses for rtti info. If you have other issues please file them. |
Fix is in flight upstream in llvm: https://reviews.llvm.org/D127333 |
This test will only pass once that corresponding llvm fix lands: https://reviews.llvm.org/D127333 See #17150
Thanks for a quick fix |
Thank you so much! |
This test will only pass once that corresponding llvm fix lands: https://reviews.llvm.org/D127333 See #17150
#17180) This test will only pass once that corresponding llvm fix lands: https://reviews.llvm.org/D127333 See #17150
Dynamically linked C and C++ modules are working great now. Thanks! |
Back in https://reviews.llvm.org/D117412 we moved the application of data reloctions to the wasm start function. However, because the dynamic linker doesn't know the final addresses at module instantiation time, this proved to be too early and the relocations could be applied with the wrong values. Fixes: emscripten-core/emscripten#17150 Differential Revision: https://reviews.llvm.org/D127333
It seems that polymorphism doesn't work with
SIDE_MODULE
+USE_PTHREADS
at all (see code below):Implementation
typeid name:emsc
Implementation
methods through pointers (neither through the base pointer nor through the derived)dynamic_cast
/static_cast
don't workI think this is a serious problem. Am I missing something?
Important: If you remove -sUSE_PTHREADS=1 and -pthread, then everything works.
Implementation.h
Implementation.cpp
main.cpp
Build commands:
Runtime error:
The text was updated successfully, but these errors were encountered: