-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
GNU linker warns “corrupt .drectve” on staticlib binary generated with Rust 1.70 on Windows #112368
Copy link
Copy link
Closed
Labels
A-linkageArea: linking into static, shared libraries and binariesArea: linking into static, shared libraries and binariesC-bugCategory: This is a bug.Category: This is a bug.E-help-wantedCall for participation: Help is requested to fix this issue.Call for participation: Help is requested to fix this issue.O-windows-gnuToolchain: GNU, Operating system: WindowsToolchain: GNU, Operating system: Windowsregression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Metadata
Metadata
Assignees
Labels
A-linkageArea: linking into static, shared libraries and binariesArea: linking into static, shared libraries and binariesC-bugCategory: This is a bug.Category: This is a bug.E-help-wantedCall for participation: Help is requested to fix this issue.Call for participation: Help is requested to fix this issue.O-windows-gnuToolchain: GNU, Operating system: WindowsToolchain: GNU, Operating system: Windowsregression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Type
Fields
Give feedbackNo fields configured for issues without a type.
It seems, as of version 16, LLVM generates a binary containing incompatible directive with GNU linker. I believe this is the cause:
commit: llvm/llvm-project@c5b3de6
Since Rust 1.70 upgraded LLVM to version 16, we started to see a lot of warnings by GNU linker when I link against staticlibs compiled by Rust. The warnings are like this:
It seems I can just ignore this warning (while the concern described in the LLVM's commit can be a real problem in future), but still I feel this is something that should be fixed if possible. I know, from LLVM's viewpoint, it's reasonable to assume the linker is lld and embed the directives that only lld can understand. But, on the other hand, from Rust's viewpoint, is it intentional that the "GNU" target produces a binary that is incompatible with "GNU" linker? I'm honestly not sure about the answer. I'm yet to figure out what the "GNU" in Rust's GNU toolchain/target actually means.
Code
A minimal reproducible code: https://github.com/yutannihilation/rust170_gnu_warning
In case of Rust 1.69, we don't see any warnings. However, if it's compiled using Rust 1.70, GNU linker warns:
(This can be reproducible on GHA: result)
Version it worked on
It most recently worked on: Rust 1.69
Version with regression
rustc --version --verbose:Backtrace
References