-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
cmpxchg atomic will confuse emscripten (was: Error during linking) #1662
Comments
I can reproduce. Browsing through the code in anlayzer.js, looks like the intertype of 'atomic' is not handled, which is the cause of this issue. Does your source use an atomic intrinsic for compare-and-exchange? (compare_exchange) Can you build your code to not refer to atomics? |
You spotted it. We had __sync_bool_compare_and_swap in there. We used a workaround, and now it's all built and working. Thank you. I will edit the question and paste the error log instead of pastebin. Perhaps Google will help find this answer for other people with the same problem. |
Let me reopen this bug, and keep it as a record that this atomic operation will confuse emscripten. Perhaps in the future emscripten itself can implement 'no-op' support for the atomic so that client codebases will not need a workaround. What does your workaround look like, in case others need it as well? When in the future we get thread support to JavaScript, having real support for atomics will be also important. |
Sure, this issue's all yours ;-) As for the workaround, it just happened to be some code that wouldn't be run in the context of my project. I simply put the lines between #ifdef EMSCRIPTEN. |
Yeah, we don't support legalization for 100% of llvm ir, looks like we are missing atomics. But it should be easy to add - if someone can make a testcase using atomics on i64 values that would be helpful. |
@kripken can you elaborate on what you are looking for in a test case? Do we just want llvm IR assembly that calls all of the atomics? If we also want to do some basic sanity tests, should the tests be written in C or some other higher level language (e.g. Rust) that compiles to llvm IR? Must the tests somehow guarantee that the operations being performed are in fact atomic? I looked around a little for some already existing tests and found that the llvm compiler has several atomics code generation tests under |
LLVM IR assembly is fine, C is fine as well. Note that this bug is old, we rewrote the compiler meanwhile ;) Perhaps we already added testing for this while doing so, can grep in the emscripten and fastcomp repos. |
This issue has been automatically marked as stale because there has been no activity in the past 2 years. It will be closed automatically if no further activity occurs in the next 7 days. Feel free to re-open at any time if this issue is still relevant. |
Hi,
I am currently trying to emscripten-ize one of my projects. I had to tweak a few things, mostly casting, in order to pass the compilation phase.
Now, the error pops during Linking, which I have come to understand is the emscripten compilation phase.
Reproduction:
Please note that in 1.5.5 the "Stack: Error" part is not there. This is new from 1.5.6.
(1.5.5 version here http://pastebin.com/n35wNJFe )
And here are the documents required to repro:
https://www.dropbox.com/s/ta9ywd2uyj0u5a5/em.zip
And here is the command used:
Clear your cache, and change the paths, then it should repro.
Thanks, Laurens.
The text was updated successfully, but these errors were encountered: