Skip to content
Closed
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
8099510
Fix linking for symbols starting with ?
checkraisefold Sep 25, 2024
784d47b
Add a test
checkraisefold Dec 31, 2024
a4c628c
Significant test improvements
checkraisefold Dec 31, 2024
f81ebfb
Match LLVM behavior more closely
checkraisefold Jan 14, 2025
bf36338
Accept tidy changes
checkraisefold Jan 14, 2025
9c3b53d
Apply tidy suggestion (2)
checkraisefold Jan 14, 2025
893d81f
on s390x, use `PassMode::Direct` for vector types
folkertdev Jan 20, 2025
9d6a1c9
Shorten linker output even more when `--verbose` is not present
jyn514 Jan 18, 2025
a745b60
Only use linker-flavor=gnu-cc if we're actually going to compare the …
jyn514 Jan 22, 2025
aaccb71
Fix sparcv8plus test on LLVM 20
nikic Jan 20, 2025
2718710
Fix x86_64-bigint-helpers test on LLVM 20
nikic Jan 20, 2025
dd52bfc
Reword "crate not found" resolve message
estebank Nov 18, 2024
7c885c1
Compare object files, not PATH
jyn514 Jan 19, 2025
7786f7f
run-make-support: add `sysroot` helper
jieyouxu Jan 21, 2025
1912d56
run-make-support: improve docs for `assert_exit_code`
jieyouxu Jan 22, 2025
388a52f
tests: port `translation` to rmake.rs
jieyouxu Jan 21, 2025
ecbf0ac
Rollup merge of #130808 - checkraisefold:fix-questionmark-linking, r=…
matthiaskrgr Jan 25, 2025
82fe031
Rollup merge of #133154 - estebank:issue-133137, r=wesleywiser
matthiaskrgr Jan 25, 2025
8513b74
Rollup merge of #135707 - jyn514:linker-messages-2, r=bjorn3
matthiaskrgr Jan 25, 2025
59ac9a5
Rollup merge of #135764 - nikic:llvm-20-test-fixes, r=wesleywiser
matthiaskrgr Jan 25, 2025
9d2f089
Rollup merge of #135785 - folkertdev:s390x-vector-passmode-direct, r=…
matthiaskrgr Jan 25, 2025
172dcf2
Rollup merge of #135818 - jieyouxu:migrate-translation, r=compiler-er…
matthiaskrgr Jan 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions compiler/rustc_codegen_ssa/src/back/symbol_export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,9 @@ pub(crate) fn linking_symbol_name_for_instance_in_crate<'tcx>(
}

let prefix = match &target.arch[..] {
"x86" | "x86_64" if target.is_like_msvc && undecorated.starts_with("?") => {
return undecorated;
}
"x86" => Some('_'),
"x86_64" => None,
"arm64ec" => Some('#'),
Expand Down
25 changes: 25 additions & 0 deletions tests/ui/symbol-names/symbol-with-question-mark-links.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// This test ensures functions with an exported name beginning with a question mark
// successfully compile and link.
//
// Regression test for <https://github.com/rust-lang/rust/issues/44282>

//@ build-pass
//@ only-windows
//@ only-x86
// Reason: This test regards a linker issue which only applies to Windows.
// Specifically, it only occurs due to Windows x86 name decoration, combined with
// a mismatch between LLVM's decoration logic and Rust's (for `lib.def` generation)

#![crate_type = "cdylib"]

#[no_mangle]
pub extern "C" fn decorated(a: i32, b: i32) -> i32 {
1
}

// This isn't just `?undecorated` because MSVC's linker fails if the decorated
// symbol is not valid.
#[export_name = "?undecorated@@YAXXZ"]
pub extern "C" fn undecorated(a: i32, b: i32) -> i32 {
2
}