From f2b30c8b07959bf92b161157ba200b7ec301271f Mon Sep 17 00:00:00 2001 From: Liran Ringel Date: Sat, 7 Oct 2017 12:12:19 +0200 Subject: Tell LLVM to not mangle names if they're already mangled through link_name attribute --- src/codegen/helpers.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/codegen/helpers.rs') diff --git a/src/codegen/helpers.rs b/src/codegen/helpers.rs index 5136d787..9a8b0576 100644 --- a/src/codegen/helpers.rs +++ b/src/codegen/helpers.rs @@ -45,6 +45,9 @@ pub mod attributes { } pub fn link_name(name: &str) -> quote::Tokens { + // LLVM mangles the name by default but it's already mangled. + // Prefixing the name with \u{1} should tell LLVM to not mangle it. + let name = format!("\u{1}{}", name); quote! { #[link_name = #name] } -- cgit v1.2.3