We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 16df570 + 8298004 commit 1610370Copy full SHA for 1610370
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,9 @@
1
+//@ build-pass
2
+
3
+#![crate_type = "cdylib"]
4
5
+#[export_name = "foo.0123"]
6
+pub extern "C" fn foo() {}
7
8
+#[export_name = "EXPORTS"]
9
+pub extern "C" fn bar() {}
0 commit comments