mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-15 20:45:45 +03:00
Rollup merge of #140505 - petrochenkov:expquote, r=bjorn3
linker: Quote symbol names in .def files To support weird symbol names, including dots in particular. cc [#134767](https://github.com/rust-lang/rust/pull/134767#issuecomment-2839397610)
This commit is contained in:
@@ -816,7 +816,9 @@ fn export_symbols(&mut self, tmpdir: &Path, crate_type: CrateType, symbols: &[St
|
||||
writeln!(f, "EXPORTS")?;
|
||||
for symbol in symbols {
|
||||
debug!(" _{symbol}");
|
||||
writeln!(f, " {symbol}")?;
|
||||
// Quote the name in case it's reserved by linker in some way
|
||||
// (this accounts for names with dots in particular).
|
||||
writeln!(f, " \"{symbol}\"")?;
|
||||
}
|
||||
};
|
||||
if let Err(error) = res {
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
//@ build-pass
|
||||
//@ needs-crate-type: cdylib
|
||||
|
||||
#![crate_type = "cdylib"]
|
||||
|
||||
#[export_name = "foo.0123"]
|
||||
pub extern "C" fn foo() {}
|
||||
|
||||
#[export_name = "EXPORTS"]
|
||||
pub extern "C" fn bar() {}
|
||||
Reference in New Issue
Block a user