-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
linking failed: undefined reference to STATIC #60184
Comments
Using rust master, I bisected LLVM between 7 and 8 to find rust-lang/llvm-project@be8d199 as the point of regression. We gained this in rust when we moved to the monorepo in #57675, especially the change to rustllvm/PassWrapper.cpp. I haven't figured out what's wrong with this yet, nor why it would only be affecting i686. As a workaround avoiding ThinLTO, it builds fine with |
@alexcrichton, any idea why statics would be apparently lost by ThinLTO? |
Oh wow starting from a bisected LLVM commit is quite nice, thanks for doing the legwork to find that! That commit in LLVM sounds pretty suspicious though because it sounds like it's working from the assumption that ThinLTO has complete and total knowledge of the entire compilation, I'm not sure there's ever a case you can internalize something that's otherwise public. Especially in Rust's case we can never do that because we don't learn about cross-crate dependencies until the linker, and our ThinLTO phase only ever has total knowledge of one crate, no others. From browsing around the patch it looks like we may be able to fix this though on our end. If this line is changed to |
Huh, can it be so simple? I did have a suspicious eye on that argument, but the callers in LLVM made me think we would want I'll run through more tests to make sure that's not regressing anything, but I'm hopeful -- thanks! |
With
|
Umm, actually those tests fail for me on i686 without modification too... 😕 |
Those tests are pretty brittle and are probably likely to produce false negatives, but I'd also be curious to see what causes it! Sounds like otherwise it may be fixed so yay! FWIW all I do when updating llvm is copy their code for thinlto as well and this is the first time that strategy hasn't worked! |
😆 I'm trying again in the |
Should we be making a distinction between local and global ThinLTO here? The latter should have a full cross-crate picture, right? |
I think we could do that if no native libraries are linked, but as soon as there's some native library is somewhere we also don't have the full picture because it could be relying on linking to a static that's only read from Rust (or something like that) |
Limit internalization in LLVM 8 ThinLTO Fixes rust-lang#60184. r? @alexcrichton
Limit internalization in LLVM 8 ThinLTO Fixes #60184. r? @alexcrichton
ref: https://bugzilla.redhat.com/show_bug.cgi?id=1701339
We ran into this linking failure only on i686 Fedora 30+, with LLVM 8. Other arches are fine with LLVM 8, and all arches are fine with LLVM 7 on Fedora 29.
I can reproduce this building stock tokei with normal crates.io dependencies, so that takes Fedora's crate packaging out of the picture. I also reproduced similar errors with ffsend, but different symbols:
colored::style::CLEAR
andtime::NSEC_PER_SEC
.I can't reproduce this with official stable-1.34, 1.35-beta, nor 1.36-nightly compiler builds. However, I can reproduce it when I build those locally myself, even with a minimal config so I'm using rust's
llvm-project
. I have no idea what is the difference in my build at this point.The text was updated successfully, but these errors were encountered: