-
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
"wasm-ld: error: Expected at most one ThinLTO module per bitcode file" #12763
Comments
Looks like that commit has landed on LLVM months ago, so it should be in 2.0.8 definitely, unless LLVM backed it out. Can you test to see if the error happens with plain clang as well? I'd expect it to since I think we just let LLVM do this linking stuff now. If so, it's an LLVM bug we should file there. |
Does this only happen with Note that we do basically no testing with |
Following up, this works with Clang 10.0.0 with -flto=thin ...
(I had to use -fuse-ld=lld because of the way this Clang was built, and it's worth noting that this could totally be what avoids this bug in the first place.) I am absolutely unfamiliar with all these details, but the LLVM fix I linked to appears to be ELF-specific, so possibly it doesn't apply to Emscripten output? As for -flto vs -flto=thin: using -flto works (at least, it links, I haven't tested the results further yet); this bug only reproduces with -flto=thin. It's worth noting, however, that when you set CMAKE_INTERPROCEDURAL_OPTIMIZATION to True in a CMake project, it sets -flto=thin without any way to specify the specific option directly, which is how I came to stumble into this problem, so others will eventually hit this, too, I assume. |
Seems you can override it in CMake via:
|
@haraldF oh, nice, I'll try that, thanks! |
Hi there, This happens with
ModuleIdentifier = "engine/libengine.aUtils.cpp.o" |
It will take a few hours for this fix to show up in |
This entire change, including the test case, comes almost verbatim from the ELF driver. Fixes: emscripten-core/emscripten#12763 Differential Revision: https://reviews.llvm.org/D112723
Emscripten fails to link if using -flto=thin and one of the inputs is a static library (.a file) that contains two object files with the same name. This happens to me because I'm building mRuby into a library, which has two unrelated source files in different directories named "array.c" (and others, too).
This seems to be an error inherited from LLVM, based on limited results from Googling, but here's how to reproduce this (tested against 2.0.8) ...
On the last emcc command, it generates the error:
Changing one of the object names to something other than "a.o" works around this--as does linking against the .o files instead of the .a--but a proper fix would be appreciated, especially if it just needs something pulled in or adapted from LLVM: https://reviews.llvm.org/D79880
The text was updated successfully, but these errors were encountered: