@@ -25,7 +25,6 @@ use rustc_target::{
2525
2626use super :: backtrace:: EvalContextExt as _;
2727use crate :: * ;
28- use helpers:: strip_linker_suffix;
2928
3029/// Returned by `emulate_foreign_item_by_name`.
3130pub enum EmulateByNameResult {
@@ -216,12 +215,11 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
216215 . first_attr_value_str_by_name ( & attrs, sym:: link_name)
217216 . unwrap_or_else ( || this. tcx . item_name ( def_id) ) ;
218217 let link_name = link_name_sym. as_str ( ) ;
219- let link_name = strip_linker_suffix ( & link_name) ;
220218 let tcx = this. tcx . tcx ;
221219
222220 // First: functions that diverge.
223221 let ( dest, ret) = match ret {
224- None => match link_name {
222+ None => match & * link_name {
225223 "miri_start_panic" => {
226224 // `check_shim` happens inside `handle_miri_start_panic`.
227225 this. handle_miri_start_panic ( abi, link_name_sym, args, unwind) ?;
@@ -306,9 +304,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
306304
307305 // Here we dispatch all the shims for foreign functions. If you have a platform specific
308306 // shim, add it to the corresponding submodule.
309- let shim_name = link_name. as_str ( ) ;
310- let shim_name = strip_linker_suffix ( & shim_name) ;
311- match shim_name {
307+ match & * link_name. as_str ( ) {
312308 // Miri-specific extern functions
313309 "miri_static_root" => {
314310 let & [ ref ptr] = this. check_shim ( abi, Abi :: Rust , link_name, args) ?;
@@ -499,7 +495,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
499495 let & [ ref f] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
500496 // FIXME: Using host floats.
501497 let f = f32:: from_bits ( this. read_scalar ( f) ?. to_u32 ( ) ?) ;
502- let f = match shim_name {
498+ let f = match & * link_name . as_str ( ) {
503499 "cbrtf" => f. cbrt ( ) ,
504500 "coshf" => f. cosh ( ) ,
505501 "sinhf" => f. sinh ( ) ,
@@ -522,7 +518,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
522518 // FIXME: Using host floats.
523519 let f1 = f32:: from_bits ( this. read_scalar ( f1) ?. to_u32 ( ) ?) ;
524520 let f2 = f32:: from_bits ( this. read_scalar ( f2) ?. to_u32 ( ) ?) ;
525- let n = match shim_name {
521+ let n = match & * link_name . as_str ( ) {
526522 "_hypotf" | "hypotf" => f1. hypot ( f2) ,
527523 "atan2f" => f1. atan2 ( f2) ,
528524 _ => bug ! ( ) ,
@@ -541,7 +537,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
541537 let & [ ref f] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
542538 // FIXME: Using host floats.
543539 let f = f64:: from_bits ( this. read_scalar ( f) ?. to_u64 ( ) ?) ;
544- let f = match shim_name {
540+ let f = match & * link_name . as_str ( ) {
545541 "cbrt" => f. cbrt ( ) ,
546542 "cosh" => f. cosh ( ) ,
547543 "sinh" => f. sinh ( ) ,
@@ -562,7 +558,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
562558 // FIXME: Using host floats.
563559 let f1 = f64:: from_bits ( this. read_scalar ( f1) ?. to_u64 ( ) ?) ;
564560 let f2 = f64:: from_bits ( this. read_scalar ( f2) ?. to_u64 ( ) ?) ;
565- let n = match shim_name {
561+ let n = match & * link_name . as_str ( ) {
566562 "_hypot" | "hypot" => f1. hypot ( f2) ,
567563 "atan2" => f1. atan2 ( f2) ,
568564 _ => bug ! ( ) ,
0 commit comments