Skip to content

Commit 46763a6

Browse files
authored
Unrolled build for rust-lang#140505
Rollup merge of rust-lang#140505 - petrochenkov:expquote, r=bjorn3 linker: Quote symbol names in .def files To support weird symbol names, including dots in particular. cc [rust-lang#134767](rust-lang#134767 (comment))
2 parents 2ad5f86 + 842858f commit 46763a6

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

compiler/rustc_codegen_ssa/src/back/linker.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,9 @@ impl<'a> Linker for GccLinker<'a> {
816816
writeln!(f, "EXPORTS")?;
817817
for symbol in symbols {
818818
debug!(" _{symbol}");
819-
writeln!(f, " {symbol}")?;
819+
// Quote the name in case it's reserved by linker in some way
820+
// (this accounts for names with dots in particular).
821+
writeln!(f, " \"{symbol}\"")?;
820822
}
821823
};
822824
if let Err(error) = res {
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//@ build-pass
2+
//@ needs-crate-type: cdylib
3+
4+
#![crate_type = "cdylib"]
5+
6+
#[export_name = "foo.0123"]
7+
pub extern "C" fn foo() {}
8+
9+
#[export_name = "EXPORTS"]
10+
pub extern "C" fn bar() {}

0 commit comments

Comments
 (0)