@@ -13,12 +13,10 @@ use rustc_hir::def_id::DefId;
1313use rustc_middle:: bug;
1414use rustc_middle:: mir:: interpret:: { ConstAllocation , GlobalAlloc , Scalar } ;
1515use rustc_middle:: ty:: TyCtxt ;
16- use rustc_session:: cstore:: { DllCallingConvention , DllImport , PeImportNameType } ;
16+ use rustc_session:: cstore:: DllImport ;
1717use rustc_target:: abi:: { self , AddressSpace , HasDataLayout , Pointer } ;
18- use rustc_target:: spec:: Target ;
1918
2019use libc:: { c_char, c_uint} ;
21- use std:: fmt:: Write ;
2220use tracing:: debug;
2321
2422/*
@@ -379,64 +377,3 @@ pub(crate) fn get_dllimport<'tcx>(
379377 tcx. native_library ( id)
380378 . and_then ( |lib| lib. dll_imports . iter ( ) . find ( |di| di. name . as_str ( ) == name) )
381379}
382-
383- pub ( crate ) fn is_mingw_gnu_toolchain ( target : & Target ) -> bool {
384- target. vendor == "pc" && target. os == "windows" && target. env == "gnu" && target. abi . is_empty ( )
385- }
386-
387- pub ( crate ) fn i686_decorated_name (
388- dll_import : & DllImport ,
389- mingw : bool ,
390- disable_name_mangling : bool ,
391- ) -> String {
392- let name = dll_import. name . as_str ( ) ;
393-
394- let ( add_prefix, add_suffix) = match dll_import. import_name_type {
395- Some ( PeImportNameType :: NoPrefix ) => ( false , true ) ,
396- Some ( PeImportNameType :: Undecorated ) => ( false , false ) ,
397- _ => ( true , true ) ,
398- } ;
399-
400- // Worst case: +1 for disable name mangling, +1 for prefix, +4 for suffix (@@__).
401- let mut decorated_name = String :: with_capacity ( name. len ( ) + 6 ) ;
402-
403- if disable_name_mangling {
404- // LLVM uses a binary 1 ('\x01') prefix to a name to indicate that mangling needs to be disabled.
405- decorated_name. push ( '\x01' ) ;
406- }
407-
408- let prefix = if add_prefix && dll_import. is_fn {
409- match dll_import. calling_convention {
410- DllCallingConvention :: C | DllCallingConvention :: Vectorcall ( _) => None ,
411- DllCallingConvention :: Stdcall ( _) => ( !mingw
412- || dll_import. import_name_type == Some ( PeImportNameType :: Decorated ) )
413- . then_some ( '_' ) ,
414- DllCallingConvention :: Fastcall ( _) => Some ( '@' ) ,
415- }
416- } else if !dll_import. is_fn && !mingw {
417- // For static variables, prefix with '_' on MSVC.
418- Some ( '_' )
419- } else {
420- None
421- } ;
422- if let Some ( prefix) = prefix {
423- decorated_name. push ( prefix) ;
424- }
425-
426- decorated_name. push_str ( name) ;
427-
428- if add_suffix && dll_import. is_fn {
429- match dll_import. calling_convention {
430- DllCallingConvention :: C => { }
431- DllCallingConvention :: Stdcall ( arg_list_size)
432- | DllCallingConvention :: Fastcall ( arg_list_size) => {
433- write ! ( & mut decorated_name, "@{arg_list_size}" ) . unwrap ( ) ;
434- }
435- DllCallingConvention :: Vectorcall ( arg_list_size) => {
436- write ! ( & mut decorated_name, "@@{arg_list_size}" ) . unwrap ( ) ;
437- }
438- }
439- }
440-
441- decorated_name
442- }
0 commit comments