diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2025-06-24 15:39:39 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-24 15:39:39 +0200 |
| commit | 4b52c9d8ead516211eefba8341913e1a3a2cf7d1 (patch) | |
| tree | afe6163b4e9fef6d15ef6e906249375a83f7abc7 /compiler/rustc_codegen_ssa/src/lib.rs | |
| parent | 0377330be4b7fa7569e4b04113207468e002d1bb (diff) | |
| parent | 26026534243332ffaf7ca0ef24c43abfe47d7ff2 (diff) | |
| download | rust-4b52c9d8ead516211eefba8341913e1a3a2cf7d1.tar.gz rust-4b52c9d8ead516211eefba8341913e1a3a2cf7d1.zip | |
Rollup merge of #142742 - dpaoliello:arm64eclinking, r=bjorn3
[win][aarch64] Fix linking statics on Arm64EC, take 2
Arm64EC builds recently started to fail due to the linker not finding a symbol:
```
symbols.o : error LNK2001: unresolved external symbol #_ZN3std9panicking11EMPTY_PANIC17hc8d2b903527827f1E (EC Symbol)
C:\Code\hello-world\target\arm64ec-pc-windows-msvc\debug\deps\hello_world.exe : fatal error LNK1120: 1 unresolved externals
```
It turns out that `EMPTY_PANIC` is a new static variable that was being exported then imported from the standard library, but when exporting LLVM didn't prepend the name with `#` (as only functions are prefixed with this character), whereas Rust was prefixing with `#` when attempting to import it.
The fix is to have Rust not prefix statics with `#` when importing.
Adding tests discovered another issue: we need to correctly mark static exported from dylibs with `DATA`, otherwise MSVC's linker assumes they are functions and complains that there is no exit thunk for them.
Fixes rust-lang/rust#138541
Resurrects rust-lang/rust#140176 now that rust-lang/rust#141061 is merged, which removes the incompatibility with `__rust_no_alloc_shim_is_unstable`.
r? ``@wesleywiser``
CC ``@bjorn3``
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/lib.rs')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/lib.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_ssa/src/lib.rs b/compiler/rustc_codegen_ssa/src/lib.rs index 523c9f2ad1c..23ed387a3ff 100644 --- a/compiler/rustc_codegen_ssa/src/lib.rs +++ b/compiler/rustc_codegen_ssa/src/lib.rs @@ -218,7 +218,7 @@ pub struct CrateInfo { pub target_cpu: String, pub target_features: Vec<String>, pub crate_types: Vec<CrateType>, - pub exported_symbols: UnordMap<CrateType, Vec<String>>, + pub exported_symbols: UnordMap<CrateType, Vec<(String, SymbolExportKind)>>, pub linked_symbols: FxIndexMap<CrateType, Vec<(String, SymbolExportKind)>>, pub local_crate_name: Symbol, pub compiler_builtins: Option<CrateNum>, |
