-
Notifications
You must be signed in to change notification settings - Fork 13k
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
STATUS_ACCESS_VIOLATION when running rend3 on Windows MSVC linked with LLD and thin LTO #111480
Comments
After checking out the same commit and ensuring I was running thin LTO with lld-link ( I've run all of the examples with the exception of the |
I'm still able to reproduce it both on the earlier commit listed in my original post and on the latest rend3 commit (d7806f584468c4ed974a2ff5e1eea547d26478db) on rustc stable 1.74.0 (79e9716 2023-11-13), stable 1.74.1, and 1.76.0-nightly (3340d49 2023-12-12) by running the cube example with Based on how long it takes to build the final [profile.dev]
lto = "thin" That seemed long so I checked by setting I removed everything in my global [target.x86_64-pc-windows-msvc]
linker = "rust-lld.exe" I also tested |
Would you happen to have an MinGW env lying around? I used the |
This still reproduces. Steps I took... Firstly download the repo in the OP and switch to the indicated commit:
Then I edited [target.x86_64-pc-windows-msvc]
linker = "rust-lld" Finally run an example to see the crash:
This fails with I then edited the Backtrace (from windbg)
This points to using lpszClassName: THREAD_EVENT_TARGET_WINDOW_CLASS.as_ptr(),
static THREAD_EVENT_TARGET_WINDOW_CLASS: Lazy<Vec<u16>> =
Lazy::new(|| util::encode_wide("Winit Thread Event Target")); So my assumption is the static isn't getting linked correctly for some reason. Maybe.... @lqd do you have any ideas? |
Ok I've minimized it a bit more and realised that the [lib]
crate-type = ["lib", "cdylib"] My minimization so far: # Cargo.toml
[package]
name = "winit_test"
version = "0.1.0"
edition = "2021"
[[bin]]
name = "animation"
path = "src/main.rs"
[lib]
crate-type = ["lib", "cdylib"]
[profile.dev]
lto = "thin"
[dependencies]
winit = "0.28" # .cargo/config.toml
[target.x86_64-pc-windows-msvc]
linker = "rust-lld // src/main.rs
fn main() {
winit_test::main();
} // src/lib.rs
use winit::event_loop::{EventLoop, EventLoopBuilder};
pub fn main() {
let _event_loop: EventLoop<u8> = EventLoopBuilder::with_user_event().build();
} Doing
backtrace
|
I also believe this is the key factor, we have other similar issues (involving LTO and PGO, creating invalid LLVM modules; I’ll find them when I’m back at a computer) triggered by this cargo setting/behavior. (I do wonder if this issue reproduces with zoxc’s recent PRs though (a revert and an _imp fix that lld needs but not link.exe)) |
Thanks! It seems like 713a006 fixes it on my local machine. |
This was fixed by #129079. The above test case works on beta (1.84) now. Closing as fixed. |
I'm getting a crash when running the rend3 examples
in --release modewith lto=thin and using LLD. (edit: Happens in both dev builds and release builds when using thinLTO)Rend3 repo: https://github.com/BVE-Reborn/rend3
Tested commit: 4d107951a3ba62a58a7be1849eb670d05f269e20
I expected to see this happen: It doesn't crash instantly when attempting to run it.
Instead, this happened: It crashes instantly when attempting to run the examples.
Meta
rustc --version --verbose
:tested nightly:
There's no backtrace, but running it in windbg it just loops these errors:
The text was updated successfully, but these errors were encountered: