1
1
use std:: collections:: hash_map:: Entry :: * ;
2
2
3
+ use rustc_abi:: { CanonAbi , X86Call } ;
3
4
use rustc_ast:: expand:: allocator:: { ALLOCATOR_METHODS , NO_ALLOC_SHIM_IS_UNSTABLE , global_fn_name} ;
4
5
use rustc_data_structures:: unord:: UnordMap ;
5
6
use rustc_hir:: def:: DefKind ;
@@ -14,7 +15,6 @@ use rustc_middle::ty::{self, GenericArgKind, GenericArgsRef, Instance, SymbolNam
14
15
use rustc_middle:: util:: Providers ;
15
16
use rustc_session:: config:: { CrateType , OomStrategy } ;
16
17
use rustc_symbol_mangling:: mangle_internal_symbol;
17
- use rustc_target:: callconv:: Conv ;
18
18
use rustc_target:: spec:: { SanitizerSet , TlsModel } ;
19
19
use tracing:: debug;
20
20
@@ -652,7 +652,7 @@ pub(crate) fn symbol_name_for_instance_in_crate<'tcx>(
652
652
fn calling_convention_for_symbol < ' tcx > (
653
653
tcx : TyCtxt < ' tcx > ,
654
654
symbol : ExportedSymbol < ' tcx > ,
655
- ) -> ( Conv , & ' tcx [ rustc_target:: callconv:: ArgAbi < ' tcx , Ty < ' tcx > > ] ) {
655
+ ) -> ( CanonAbi , & ' tcx [ rustc_target:: callconv:: ArgAbi < ' tcx , Ty < ' tcx > > ] ) {
656
656
let instance = match symbol {
657
657
ExportedSymbol :: NonGeneric ( def_id) | ExportedSymbol :: Generic ( def_id, _)
658
658
if tcx. is_static ( def_id) =>
@@ -683,7 +683,7 @@ fn calling_convention_for_symbol<'tcx>(
683
683
} )
684
684
. map ( |fnabi| ( fnabi. conv , & fnabi. args [ ..] ) )
685
685
// FIXME(workingjubilee): why don't we know the convention here?
686
- . unwrap_or ( ( Conv :: Rust , & [ ] ) )
686
+ . unwrap_or ( ( CanonAbi :: Rust , & [ ] ) )
687
687
}
688
688
689
689
/// 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>(
717
717
_ => return undecorated,
718
718
} ;
719
719
720
- let ( conv , args) = calling_convention_for_symbol ( tcx, symbol) ;
720
+ let ( callconv , args) = calling_convention_for_symbol ( tcx, symbol) ;
721
721
722
722
// Decorate symbols with prefixes, suffixes and total number of bytes of arguments.
723
723
// 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 ) => ( "" , "@@" ) ,
728
728
_ => {
729
729
if let Some ( prefix) = prefix {
730
730
undecorated. insert ( 0 , prefix) ;
@@ -758,9 +758,9 @@ pub(crate) fn extend_exported_symbols<'tcx>(
758
758
symbol : ExportedSymbol < ' tcx > ,
759
759
instantiating_crate : CrateNum ,
760
760
) {
761
- let ( conv , _) = calling_convention_for_symbol ( tcx, symbol) ;
761
+ let ( callconv , _) = calling_convention_for_symbol ( tcx, symbol) ;
762
762
763
- if conv != Conv :: GpuKernel || tcx. sess . target . os != "amdhsa" {
763
+ if callconv != CanonAbi :: GpuKernel || tcx. sess . target . os != "amdhsa" {
764
764
return ;
765
765
}
766
766
0 commit comments