-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Fix HTML5 lib LTO build with PTHREADS (#20275) #20858
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
Conversation
I think this shouldn't be need, but currently is due a bug in the linker. Can you add a comment mentioning that this is workaround for what a bug in wasm-ld? And perhaps add "Fixes #20275" to the PR description? |
Totally forgot about this change, merged in latest + updated the title! Came across it again just now in 3.1.51 |
tools/system_libs.py
Outdated
path='system/lib/html5', | ||
filenames=['callback.c']) | ||
|
||
return math_files + exit_files + other_files + iprintf_files + errno_files + html5_files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIUC this move html5/callback.c
from libhtml
to libc
.. or actually it seems maybe duplicates it in the two libraries?
Sorry for the delay, I revisited this just now - I believe this fix is the current correct way of doing it. |
@@ -2038,7 +2038,7 @@ class libhtml5(Library): | |||
cflags = ['-Oz', '-fno-inline-functions'] | |||
src_dir = 'system/lib/html5' | |||
src_glob = '*.c' | |||
|
|||
force_object_files = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a comment here with a link LTO bug so we know to remove it when its no longer needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would that be the same as the one below, or a new ticket?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#20275 (can you also add it to the PR description)
This change should no longer be needed since llvm/llvm-project#101894 landed in llvm. Can you confirm this is no longer needed at your end? |
Yup! I merged latest into our fork over the weekend but ran into other LTO issues - I'll get back to it soon and let you know. I think this fixed worked, but something else was acting up. Will let you know if it's our fault or not when I have time! |
I think we can safely close this PR now |
This is workaround for a bug in wasm-ld.
We use WebGPU, pthread and PROXY_TO_PTHREAD and noticed a linker error in our release builds where we enable LTO:
wasm-ld: error: C:\Dev\emsdk\upstream\emscripten\cache\sysroot\lib\wasm32-emscripten\lto\libhtml5.a(callback.o): attempt to add bitcode file after LTO (_emscripten_run_callback_on_thread)
Judging by other tickets this seems like the place to fix it, but let me know if that's wrong.