We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 2ad5f86 + 842858f commit 46763a6Copy full SHA for 46763a6
compiler/rustc_codegen_ssa/src/back/linker.rs
@@ -816,7 +816,9 @@ impl<'a> Linker for GccLinker<'a> {
816
writeln!(f, "EXPORTS")?;
817
for symbol in symbols {
818
debug!(" _{symbol}");
819
- writeln!(f, " {symbol}")?;
+ // 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}\"")?;
822
}
823
};
824
if let Err(error) = res {
tests/ui/linking/weird-export-names.rs
@@ -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