11use std:: collections:: hash_map:: Entry :: * ;
22
3+ use rustc_abi:: { CanonAbi , X86Call } ;
34use rustc_ast:: expand:: allocator:: { ALLOCATOR_METHODS , NO_ALLOC_SHIM_IS_UNSTABLE , global_fn_name} ;
45use rustc_data_structures:: unord:: UnordMap ;
56use rustc_hir:: def:: DefKind ;
@@ -14,7 +15,6 @@ use rustc_middle::ty::{self, GenericArgKind, GenericArgsRef, Instance, SymbolNam
1415use rustc_middle:: util:: Providers ;
1516use rustc_session:: config:: { CrateType , OomStrategy } ;
1617use rustc_symbol_mangling:: mangle_internal_symbol;
17- use rustc_target:: callconv:: Conv ;
1818use rustc_target:: spec:: { SanitizerSet , TlsModel } ;
1919use tracing:: debug;
2020
@@ -652,7 +652,7 @@ pub(crate) fn symbol_name_for_instance_in_crate<'tcx>(
652652fn calling_convention_for_symbol < ' tcx > (
653653 tcx : TyCtxt < ' tcx > ,
654654 symbol : ExportedSymbol < ' tcx > ,
655- ) -> ( Conv , & ' tcx [ rustc_target:: callconv:: ArgAbi < ' tcx , Ty < ' tcx > > ] ) {
655+ ) -> ( CanonAbi , & ' tcx [ rustc_target:: callconv:: ArgAbi < ' tcx , Ty < ' tcx > > ] ) {
656656 let instance = match symbol {
657657 ExportedSymbol :: NonGeneric ( def_id) | ExportedSymbol :: Generic ( def_id, _)
658658 if tcx. is_static ( def_id) =>
@@ -683,7 +683,7 @@ fn calling_convention_for_symbol<'tcx>(
683683 } )
684684 . map ( |fnabi| ( fnabi. conv , & fnabi. args [ ..] ) )
685685 // FIXME(workingjubilee): why don't we know the convention here?
686- . unwrap_or ( ( Conv :: Rust , & [ ] ) )
686+ . unwrap_or ( ( CanonAbi :: Rust , & [ ] ) )
687687}
688688
689689/// This is the symbol name of the given instance as seen by the linker.
@@ -717,14 +717,14 @@ pub(crate) fn linking_symbol_name_for_instance_in_crate<'tcx>(
717717 _ => return undecorated,
718718 } ;
719719
720- let ( conv , args) = calling_convention_for_symbol ( tcx, symbol) ;
720+ let ( callconv , args) = calling_convention_for_symbol ( tcx, symbol) ;
721721
722722 // Decorate symbols with prefixes, suffixes and total number of bytes of arguments.
723723 // Reference: https://docs.microsoft.com/en-us/cpp/build/reference/decorated-names?view=msvc-170
724- let ( prefix, suffix) = match conv {
725- Conv :: X86Fastcall => ( "@" , "@" ) ,
726- Conv :: X86Stdcall => ( "_" , "@" ) ,
727- Conv :: X86VectorCall => ( "" , "@@" ) ,
724+ let ( prefix, suffix) = match callconv {
725+ CanonAbi :: X86 ( X86Call :: Fastcall ) => ( "@" , "@" ) ,
726+ CanonAbi :: X86 ( X86Call :: Stdcall ) => ( "_" , "@" ) ,
727+ CanonAbi :: X86 ( X86Call :: Vectorcall ) => ( "" , "@@" ) ,
728728 _ => {
729729 if let Some ( prefix) = prefix {
730730 undecorated. insert ( 0 , prefix) ;
@@ -758,9 +758,9 @@ pub(crate) fn extend_exported_symbols<'tcx>(
758758 symbol : ExportedSymbol < ' tcx > ,
759759 instantiating_crate : CrateNum ,
760760) {
761- let ( conv , _) = calling_convention_for_symbol ( tcx, symbol) ;
761+ let ( callconv , _) = calling_convention_for_symbol ( tcx, symbol) ;
762762
763- if conv != Conv :: GpuKernel || tcx. sess . target . os != "amdhsa" {
763+ if callconv != CanonAbi :: GpuKernel || tcx. sess . target . os != "amdhsa" {
764764 return ;
765765 }
766766
0 commit comments