Repository navigation
fix incorrect byte count suffix on MSVC - #165458
paradoxicalguy wants to merge 2 commits into
Conversation
|
cc @bjorn3 |
|
r? @jieyouxu rustbot has assigned @jieyouxu. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
3536372 to
3ec1e11
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
current CI failure is pointing to this existing FIXME rust/tests/assembly-llvm/win32-byte-count-suffix.rs Lines 234 to 255 in 2d20b42 the existing |
|
@bors squash msg = "fix MSVC calling convention symbol byte counts" |
|
Unknown value for argument "". Run |
|
is it because of blank space 🤔 |
This comment has been minimized.
This comment has been minimized.
|
🔨 5 commits were squashed into 71146c7. |
19b93cf to
71146c7
Compare
71146c7 to
16191b5
Compare
There was a problem hiding this comment.
A downside of this rmake test is that it only runs on windows msvc. For my local development, I have this setup as a plain UI test.
This works on x86_64-unknown-linux-gnu because it uses lld as the linker, I think it should also work in the msvc CI jobs, but then in most other cases this test is ignored. So, I'm not sure we should add it, but just wanted to share this.
Some notes
- uses
build-passso it builds and links all the way - uses
add-minicoreso it runs anywhere - uses
compile-flags: -Clinker=rust-lld, a linker that I actually have, in combination with//@ needs-rust-lld compile-flags: -Clink-arg=/NOENTRYensures there are no external dependencies, only this file is needed to produce the final link#![crate_type = "cdylib"]make sure there is something to link (this creates a final artifact)
//@ build-pass
//@ add-minicore
//@ revisions: i686 x86_64
//@[i686] compile-flags: --target i686-pc-windows-msvc
//@[x86_64] compile-flags: --target x86_64-pc-windows-msvc
//@ compile-flags: -Copt-level=3 -Clinker=rust-lld -Clink-arg=/NOENTRY
//@ needs-llvm-components: x86
//@ needs-rust-lld
//@ ignore-backends: gcc
#![feature(no_core, abi_vectorcall)]
#![no_core]
#![crate_type = "cdylib"]
extern crate minicore;
// then test whatever
use minicore::simd::i32x4;
#[unsafe(no_mangle)]
pub extern "vectorcall" fn eight_vectors_vectorcall(
_: i32x4,
_: i32x4,
_: i32x4,
_: i32x4,
_: i32x4,
_: i32x4,
_: i32x4,
_: i32x4,
) {
}
There was a problem hiding this comment.
this is much nicer tbh!
i ran into the missing target libraries while trying to get the i686 linker regression working locally, so minicore + rust-lld looks like a good way around that.
i'll try moving the existing regression into a build-pass test and check that it still fails on unpatched rustc for the expected linker errors
thanks for sharing this =D
There was a problem hiding this comment.
it passed locally after configuring my local setup into this
pushed the portable rust-lld version for ci; kept the run-make test for now until we confirm it runs there. thanks
View all comments
fixes #165299
this moves the byte count calculation into a shared helper in
rustc_codegen_ssa. it now derives the count from the original argument layouts rather than the lowered signature.the fix is wired up for
llvm. symbols are emitted with a\x01prefix so llvm doesn’t decorate them a second time, and the linker-facing symbol naming path now handles the\x01and?prefixes.testing:
verified fastcall, stdcall and vectorcall on msvc, including cross-crate references.
added a run-make regression test for the linker failure in #165299. unpatched nightly fails with
LNK2001; patched compiler links successfully.added codegen regression tests and updated the existing abi, unwind and assembly tests for the corrected symbol names and byte counts. this also resolves the over-aligned argument
FIXMEinwin32-byte-count-suffix.rs.cc @folkertdev @workingjubilee