-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
cdylib link error after TLS unused -> used transition #69798
Comments
@rustbot claim |
Here's what appears to be happening:
Note that exact names imported seem to be extremely sensitive to local changes, so you might get different constants/containing functions. The general problem seems to be that LLVM looks 'backward' in the dependency graph during ThinLTO - that is, it looks at whether any modules import from the current module, not just what modules the current modules imports. I think there are a few possible solutions:
Someone who's more familiar with LLVM should weigh in here. |
@rustbot ping icebreakers-llvm |
Hey LLVM ICE-breakers! This bug has been identified as a good cc @comex @DutchGhost @hanna-kruppe @hdhoang @heyrutvik @JOE1994 @jryans @mmilenko @nagisa @nikic @Noah-Kennedy @SiavoshZarrasvand @spastorino @vertexclique @vgxbj |
We have the first non working nightly which is |
Tagging as P-high until we know how bad this issue is. |
From |
Seems my guess was wrong. I ran cargo-bisect-rustc (neat command BTW). It reported the regression with commit d28560e |
For reference, d28560e is part of PR #67332; i.e. the latter PR either injected this bug, or tickled a latent bug in LLVM. (Which of the latter two cases we are in depends in part on how we resolve the questions raised earlier by @Aaron1011 .) |
Of the options outlined by @Aaron1011 above, I think number 2 is best:
I have started prototyping it on my laptop, since I am familiar with the code I added in PR #67020 |
My prototype is now done and appears to fix this case. I have not attempted to benchmark yet; I figure we can land it, or at least run it through perf.rlo, and see where it goes. |
Namely, a regression test for issue rust-lang#69798 (export added), and the inverse of that test (export removd).
marking as stable-to-beta regression. The underlying bug here is old, but the change that exposes the bug here (PR #67332) has not yet made it to stable. |
…lto-products-when-exports-change, r=nagisa Do not reuse post LTO products when exports change Do not reuse post lto products when exports change Generalizes code from PR rust-lang#67020, which handled case when imports change. Fix rust-lang#69798
…file in incremental compilation. This is symmetric to PR rust-lang#67020, which handled the case where the LLVM module's *imports* changed. This commit builds upon the infrastructure added there; the export map is just the inverse of the import map, so we can build the export map at the same time that we load the serialized import map. Fix rust-lang#69798
Namely, a regression test for issue rust-lang#69798 (export added), and the inverse of that test (export removd).
From nightly-2020-02-28 (nightly-2020-02-27 was fine), I get link errors if I compile a cdylib with a thread local that isn't used, then compile again after referencing the thread local.
To reproduce, create a.rs:
Then run:
Uncomment the commented line and rerun the above command.
This produces the following link error:
It's possible however that the underlying bug is actually older though, since at opt-level=1, I get link errors from 1.32.0 onwards (1.31.0 was fine). In that case, the Drop implementation isn't needed.
Linking fails with:
undefined reference to 'core::ptr::drop_in_place'
The exact symbol that's reported varies.
Versions:
rustc 1.43.0-nightly (2890b37 2020-03-06)
cc (Debian 9.2.1-16) 9.2.1 20191030
GNU ld (GNU Binutils for Debian) 2.33.1
The text was updated successfully, but these errors were encountered: