about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLuqman Aden <laden@csclub.uwaterloo.ca>2013-07-26 23:19:58 -0400
committerLuqman Aden <laden@csclub.uwaterloo.ca>2013-07-26 23:41:22 -0400
commite82394013d90f1dfe8f3f990809c74e3f149e23e (patch)
tree244fe5ab2dd639c6c0d6c8a421588e3be850a423
parent5c4cd30f80273ba573df048b6295ea6e543df599 (diff)
downloadrust-e82394013d90f1dfe8f3f990809c74e3f149e23e.tar.gz
rust-e82394013d90f1dfe8f3f990809c74e3f149e23e.zip
librustc: Respect no_mangle attribute on statics.
-rw-r--r--src/librustc/middle/trans/base.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs
index 50ea6537544..1ab6233e939 100644
--- a/src/librustc/middle/trans/base.rs
+++ b/src/librustc/middle/trans/base.rs
@@ -2453,7 +2453,12 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::node_id) -> ValueRef {
             let v = match i.node {
               ast::item_static(_, m, expr) => {
                 let typ = ty::node_id_to_type(ccx.tcx, i.id);
-                let s = mangle_exported_name(ccx, my_path, typ);
+                let s =
+                    if attr::contains_name(i.attrs, "no_mangle") {
+                        path_elt_to_str(*my_path.last(), token::get_ident_interner())
+                    } else {
+                        mangle_exported_name(ccx, my_path, typ)
+                    };
                 // We need the translated value here, because for enums the
                 // LLVM type is not fully determined by the Rust type.
                 let v = consts::const_expr(ccx, expr);