-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[win][aarch64] Fix linking statics on Arm64EC, take 2 #142742
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
base: master
Are you sure you want to change the base?
Conversation
This PR modifies cc @jieyouxu Some changes occurred in compiler/rustc_codegen_ssa |
8463164
to
fec0e2a
Compare
@bors2 try jobs=x86_64-msvc-,x86_64-mingw-,dist-aarch64-msvc |
[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 #138541 Resurrects #140176 now that #141061 is merged, which removes the incompatibility with `__rust_no_alloc_shim_is_unstable`. r? `@wesleywiser` CC `@bjorn3` try-job: x86_64-msvc-
💔 Test failed
|
pub trait Copy {} | ||
impl Copy for i32 {} | ||
#[lang = "drop_in_place"] | ||
pub unsafe fn drop_in_place<T: ?Sized>(_: *mut T) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this test use mini_core? Or does that not work for run-make tests?
@bors2 try jobs= Edit: Seems to be rust-lang/bors#314 |
Unknown value for argument "jobs". |
You'll need to use the try-job-in-PR-description form |
@bors2 try |
[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 #138541 Resurrects #140176 now that #141061 is merged, which removes the incompatibility with `__rust_no_alloc_shim_is_unstable`. r? `@wesleywiser` CC `@bjorn3` -- try-job: x86_64-msvc-* try-job: x86_64-mingw-* try-job: dist-aarch64-msvc
@@ -755,7 +758,7 @@ pub(crate) fn extend_exported_symbols<'tcx>( | |||
let undecorated = symbol_name_for_instance_in_crate(tcx, symbol, instantiating_crate); | |||
|
|||
// Add the symbol for the kernel descriptor (with .kd suffix) | |||
symbols.push(format!("{undecorated}.kd")); | |||
symbols.push((format!("{undecorated}.kd"), info.kind)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be SymbolExportKind::Data
. According to https://llvm.org/docs/AMDGPUUsage.html#symbols, this symbol will be STT_OBJECT
rather than STT_FUNC
. It is some (non-executable) metadata for the function.
Arm64EC builds recently started to fail due to the linker not finding a symbol:
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 #138541
Resurrects #140176 now that #141061 is merged, which removes the incompatibility with
__rust_no_alloc_shim_is_unstable
.r? @wesleywiser
CC @bjorn3