- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
Closed
Labels
A-thread-localsArea: Thread local storage (TLS)Area: Thread local storage (TLS)C-bugCategory: This is a bug.Category: This is a bug.O-windows-msvcToolchain: MSVC, Operating system: WindowsToolchain: MSVC, Operating system: Windows
Description
How to reproduce:
"<build>\x86_64-pc-windows-msvc\stage1\bin\rustc.exe" -Clinker=lld hello.rs
where hello.rs is
// The important thing here is accessing thread-local `static LOCAL_STDERR` in libstd.
fn main() {
    eprint!("Hello");
}
- rustcmust be built locally, the issue doesn't reproduce on nightly rustc, I don't know due to which differences.
- lldcan be either- rust-lldshipped with rustc, or- lldfrom a msys2 package, the issue reproduces on both, and it doesn't happen without lld.
- the produced executable must be run using a path, not just an executable name, an absolute path like "C:\msys64\home\me\hello.exe"works for sure. UPD: The program invocation string should just be long enough, not necessarily a path.
- libstd must be build with opt-level = 3(the default), lowering the opt level to improve debugging removes the issue :( but full debuginfo can still be enabled.
- The exception and backtrace look like this - rustbuild: Remove one LLD workaround #76127 (comment)
I'll try to step through disassembly and look what happens in more detail tomorrow.
Metadata
Metadata
Assignees
Labels
A-thread-localsArea: Thread local storage (TLS)Area: Thread local storage (TLS)C-bugCategory: This is a bug.Category: This is a bug.O-windows-msvcToolchain: MSVC, Operating system: WindowsToolchain: MSVC, Operating system: Windows