@@ -25,7 +25,6 @@ use rustc_target::{
25
25
26
26
use super :: backtrace:: EvalContextExt as _;
27
27
use crate :: * ;
28
- use helpers:: strip_linker_suffix;
29
28
30
29
/// Returned by `emulate_foreign_item_by_name`.
31
30
pub enum EmulateByNameResult {
@@ -216,12 +215,11 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
216
215
. first_attr_value_str_by_name ( & attrs, sym:: link_name)
217
216
. unwrap_or_else ( || this. tcx . item_name ( def_id) ) ;
218
217
let link_name = link_name_sym. as_str ( ) ;
219
- let link_name = strip_linker_suffix ( & link_name) ;
220
218
let tcx = this. tcx . tcx ;
221
219
222
220
// First: functions that diverge.
223
221
let ( dest, ret) = match ret {
224
- None => match link_name {
222
+ None => match & * link_name {
225
223
"miri_start_panic" => {
226
224
// `check_shim` happens inside `handle_miri_start_panic`.
227
225
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
306
304
307
305
// Here we dispatch all the shims for foreign functions. If you have a platform specific
308
306
// 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 ( ) {
312
308
// Miri-specific extern functions
313
309
"miri_static_root" => {
314
310
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
499
495
let & [ ref f] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
500
496
// FIXME: Using host floats.
501
497
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 ( ) {
503
499
"cbrtf" => f. cbrt ( ) ,
504
500
"coshf" => f. cosh ( ) ,
505
501
"sinhf" => f. sinh ( ) ,
@@ -522,7 +518,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
522
518
// FIXME: Using host floats.
523
519
let f1 = f32:: from_bits ( this. read_scalar ( f1) ?. to_u32 ( ) ?) ;
524
520
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 ( ) {
526
522
"_hypotf" | "hypotf" => f1. hypot ( f2) ,
527
523
"atan2f" => f1. atan2 ( f2) ,
528
524
_ => bug ! ( ) ,
@@ -541,7 +537,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
541
537
let & [ ref f] = this. check_shim ( abi, Abi :: C { unwind : false } , link_name, args) ?;
542
538
// FIXME: Using host floats.
543
539
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 ( ) {
545
541
"cbrt" => f. cbrt ( ) ,
546
542
"cosh" => f. cosh ( ) ,
547
543
"sinh" => f. sinh ( ) ,
@@ -562,7 +558,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
562
558
// FIXME: Using host floats.
563
559
let f1 = f64:: from_bits ( this. read_scalar ( f1) ?. to_u64 ( ) ?) ;
564
560
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 ( ) {
566
562
"_hypot" | "hypot" => f1. hypot ( f2) ,
567
563
"atan2" => f1. atan2 ( f2) ,
568
564
_ => bug ! ( ) ,
0 commit comments