Skip to content

Commit e823940

Browse files
committed
librustc: Respect no_mangle attribute on statics.
1 parent 5c4cd30 commit e823940

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/librustc/middle/trans/base.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2453,7 +2453,12 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::node_id) -> ValueRef {
24532453
let v = match i.node {
24542454
ast::item_static(_, m, expr) => {
24552455
let typ = ty::node_id_to_type(ccx.tcx, i.id);
2456-
let s = mangle_exported_name(ccx, my_path, typ);
2456+
let s =
2457+
if attr::contains_name(i.attrs, "no_mangle") {
2458+
path_elt_to_str(*my_path.last(), token::get_ident_interner())
2459+
} else {
2460+
mangle_exported_name(ccx, my_path, typ)
2461+
};
24572462
// We need the translated value here, because for enums the
24582463
// LLVM type is not fully determined by the Rust type.
24592464
let v = consts::const_expr(ccx, expr);

0 commit comments

Comments
 (0)