-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
LTO prunes symbols which are used resulting in a linking error #108030
Labels
A-LLVM
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
Might or might not be related: #107345 |
This is a minimal reproduction that works on macOS and Linux (x86_64). I think the D145293 fixes this issue. |
@rustbot label +A-llvm |
rustbot
added
the
A-LLVM
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
label
Mar 4, 2023
Noratrieb
added
the
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
label
Apr 5, 2023
@rustbot claim |
DianQK
added a commit
to DianQK/rust
that referenced
this issue
Sep 11, 2023
Closes rust-lang#108030. This issue has been resolved in LLVM 17.
DianQK
added a commit
to DianQK/rust
that referenced
this issue
Sep 11, 2023
Closes rust-lang#108030. This issue has been resolved in LLVM 17.
DianQK
added a commit
to DianQK/rust
that referenced
this issue
Sep 11, 2023
Closes rust-lang#108030. This issue has been resolved in LLVM 17.
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Sep 11, 2023
…sleywiser Add a test for rust-lang#108030 Closes rust-lang#108030. This issue has been resolved in LLVM 17. I can verify that this test fails on 63a81b0. r? compiler
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Sep 11, 2023
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#115548 (Extract parallel operations in `rustc_data_structures::sync` into a new `parallel` submodule) - rust-lang#115591 (Add regression test for LLVM 17-rc3 miscompile) - rust-lang#115631 (Don't ICE when computing ctype's `repr_nullable_ptr` for possibly-unsized ty) - rust-lang#115708 (fix homogeneous_aggregate not ignoring some ZST) - rust-lang#115730 (Some more small driver refactors) - rust-lang#115749 (Allow loading the SMIR for constants and statics) - rust-lang#115757 (Add a test for rust-lang#108030) - rust-lang#115761 (Update books) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
Sep 11, 2023
Rollup merge of rust-lang#115757 - DianQK:lto-linkage-used-attr, r=wesleywiser Add a test for rust-lang#108030 Closes rust-lang#108030. This issue has been resolved in LLVM 17. I can verify that this test fails on 63a81b0. r? compiler
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-LLVM
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Steps to Reproduce
This will take quite a while; sorry, I don't have a more minimal reproduction on hand since the issue doesn't reproduce on a toy example and reducing the actual reproduction into a minimal example is tricky when it takes forever to reproduce.
Expected Results
The compilation succeeds.
Actual Results
Linking fails.
Versions and Environment
The issue also reproduces on macOS+aarch64.
Extra Info
I'm not sure whether this is a generic LTO bug, or a bug with
global_asm!
.The
wasmtime
crate sets up a bunch ofglobal_asm!
trampolines like this:Relevant code
So as you can see the symbol that's being unnecessarily stripped out is being passed into the
global_asm!
block (sym $libcall_impl
) and that is being called from assembly (jmp {}
). That symbol is just a normal mangled extern "C" function (unsafe extern "C" fn [<impl_ $name>]
). What's also interesting is also that this seems to affect only these two symbols (there are more that are defined, and it seems like those are not being stripped out for some reason), and that it doesn't reproduce on toy examples.There are also two potential workarounds; first workaround is to just mark the function as
#[no_mangle]
:The other is to create a dummy
static
variable with a#[used]
on it:After applying either of those the linking succeeds even when LTO is enabled.
The text was updated successfully, but these errors were encountered: