Skip to content

Commit e69432b

Browse files
committed
Give global_asm symbol names
Currently global_asm already have symbol names when using v0 scheme, this makes them obtain symbols with legacy scheme too.
1 parent e5ff932 commit e69432b

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

compiler/rustc_middle/src/mir/mono.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ impl<'tcx> MonoItem<'tcx> {
122122
MonoItem::Fn(instance) => tcx.symbol_name(instance),
123123
MonoItem::Static(def_id) => tcx.symbol_name(Instance::mono(tcx, def_id)),
124124
MonoItem::GlobalAsm(item_id) => {
125-
SymbolName::new(tcx, &format!("global_asm_{:?}", item_id.owner_id))
125+
tcx.symbol_name(Instance::mono(tcx, item_id.owner_id.to_def_id()))
126126
}
127127
}
128128
}

compiler/rustc_symbol_mangling/src/legacy.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ pub(super) fn mangle<'tcx>(
3636
debug!(?instance_ty);
3737
break;
3838
}
39+
DefPathData::GlobalAsm => {
40+
// `global_asm!` doesn't have a type.
41+
instance_ty = tcx.types.unit;
42+
break;
43+
}
3944
_ => {
4045
// if we're making a symbol for something, there ought
4146
// to be a value or type-def or something in there

0 commit comments

Comments
 (0)