summaryrefslogtreecommitdiff
path: root/src/codegen/helpers.rs
diff options
context:
space:
mode:
authorLiran Ringel <liranringel@gmail.com>2017-10-07 12:12:19 +0200
committerLiran Ringel <liranringel@gmail.com>2017-10-07 15:02:08 +0200
commitf2b30c8b07959bf92b161157ba200b7ec301271f (patch)
tree3ce751af7d67a72aafbf680ce9d9f30c108ef835 /src/codegen/helpers.rs
parentc7fe6b67fa71f7a7a5d8534aa608865a987c1e94 (diff)
Tell LLVM to not mangle names if they're already mangled through link_name attribute
Diffstat (limited to 'src/codegen/helpers.rs')
-rw-r--r--src/codegen/helpers.rs3
1 files changed, 3 insertions, 0 deletions
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]
}