Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_ssa/src/back/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -881,8 +881,8 @@ impl<'a> Linker for GccLinker<'a> {
if !symbols.is_empty() {
writeln!(f, " global:")?;
for (sym, _) in symbols {
debug!(" {sym};");
writeln!(f, " {sym};")?;
debug!(" \"{sym}\";");
writeln!(f, " \"{sym}\";")?;
Comment thread
bjorn3 marked this conversation as resolved.
}
}
writeln!(f, "\n local:\n *;\n}};")?;
Expand Down
4 changes: 4 additions & 0 deletions tests/run-make/export-quoted-symbols-version-script/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#![crate_type = "cdylib"]

#[unsafe(export_name = "some$foo::bar$thing/path.rs:42")]
pub extern "C" fn exported_symbol_with_version_script_special_characters() {}
19 changes: 19 additions & 0 deletions tests/run-make/export-quoted-symbols-version-script/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//@ only-linux
//@ needs-crate-type: cdylib

extern crate run_make_support;

use run_make_support::object::Object;
use run_make_support::{dynamic_lib_name, object, rfs, rustc};

const EXPORTED_SYMBOL: &[u8] = b"some$foo::bar$thing/path.rs:42";

fn main() {
rustc().input("lib.rs").run();

let contents = rfs::read(dynamic_lib_name("lib"));
let object = object::File::parse(contents.as_slice()).unwrap();
let matching_exports =
object.exports().unwrap().iter().filter(|x| x.name() == EXPORTED_SYMBOL).count();
assert_eq!(matching_exports, 1);
}
Loading