@@ -146,14 +146,14 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
146
146
| "exit"
147
147
| "ExitProcess"
148
148
=> {
149
- check_abi ( abi, if link_name == "exit" { Abi :: C } else { Abi :: System } ) ?;
149
+ check_abi ( abi, if link_name == "exit" { Abi :: C { unwind : false } } else { Abi :: System { unwind : false } } ) ?;
150
150
let & [ ref code] = check_arg_count ( args) ?;
151
151
// it's really u32 for ExitProcess, but we have to put it into the `Exit` variant anyway
152
152
let code = this. read_scalar ( code) ?. to_i32 ( ) ?;
153
153
throw_machine_stop ! ( TerminationInfo :: Exit ( code. into( ) ) ) ;
154
154
}
155
155
"abort" => {
156
- check_abi ( abi, Abi :: C ) ?;
156
+ check_abi ( abi, Abi :: C { unwind : false } ) ?;
157
157
throw_machine_stop ! ( TerminationInfo :: Abort ( "the program aborted execution" . to_owned( ) ) )
158
158
}
159
159
_ => throw_unsup_format ! ( "can't call (diverging) foreign function: {}" , link_name) ,
@@ -170,7 +170,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
170
170
// Normally, this will be either `libpanic_unwind` or `libpanic_abort`, but it could
171
171
// also be a custom user-provided implementation via `#![feature(panic_runtime)]`
172
172
"__rust_start_panic" | "__rust_panic_cleanup" => {
173
- check_abi ( abi, Abi :: C ) ?;
173
+ check_abi ( abi, Abi :: C { unwind : false } ) ?;
174
174
// This replicates some of the logic in `inject_panic_runtime`.
175
175
// FIXME: is there a way to reuse that logic?
176
176
let panic_runtime = match this. tcx . sess . panic_strategy ( ) {
@@ -236,14 +236,14 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
236
236
237
237
// Standard C allocation
238
238
"malloc" => {
239
- check_abi ( abi, Abi :: C ) ?;
239
+ check_abi ( abi, Abi :: C { unwind : false } ) ?;
240
240
let & [ ref size] = check_arg_count ( args) ?;
241
241
let size = this. read_scalar ( size) ?. to_machine_usize ( this) ?;
242
242
let res = this. malloc ( size, /*zero_init:*/ false , MiriMemoryKind :: C ) ;
243
243
this. write_scalar ( res, dest) ?;
244
244
}
245
245
"calloc" => {
246
- check_abi ( abi, Abi :: C ) ?;
246
+ check_abi ( abi, Abi :: C { unwind : false } ) ?;
247
247
let & [ ref items, ref len] = check_arg_count ( args) ?;
248
248
let items = this. read_scalar ( items) ?. to_machine_usize ( this) ?;
249
249
let len = this. read_scalar ( len) ?. to_machine_usize ( this) ?;
@@ -253,13 +253,13 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
253
253
this. write_scalar ( res, dest) ?;
254
254
}
255
255
"free" => {
256
- check_abi ( abi, Abi :: C ) ?;
256
+ check_abi ( abi, Abi :: C { unwind : false } ) ?;
257
257
let & [ ref ptr] = check_arg_count ( args) ?;
258
258
let ptr = this. read_scalar ( ptr) ?. check_init ( ) ?;
259
259
this. free ( ptr, MiriMemoryKind :: C ) ?;
260
260
}
261
261
"realloc" => {
262
- check_abi ( abi, Abi :: C ) ?;
262
+ check_abi ( abi, Abi :: C { unwind : false } ) ?;
263
263
let & [ ref old_ptr, ref new_size] = check_arg_count ( args) ?;
264
264
let old_ptr = this. read_scalar ( old_ptr) ?. check_init ( ) ?;
265
265
let new_size = this. read_scalar ( new_size) ?. to_machine_usize ( this) ?;
@@ -334,7 +334,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
334
334
335
335
// C memory handling functions
336
336
"memcmp" => {
337
- check_abi ( abi, Abi :: C ) ?;
337
+ check_abi ( abi, Abi :: C { unwind : false } ) ?;
338
338
let & [ ref left, ref right, ref n] = check_arg_count ( args) ?;
339
339
let left = this. read_scalar ( left) ?. check_init ( ) ?;
340
340
let right = this. read_scalar ( right) ?. check_init ( ) ?;
@@ -355,7 +355,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
355
355
this. write_scalar ( Scalar :: from_i32 ( result) , dest) ?;
356
356
}
357
357
"memrchr" => {
358
- check_abi ( abi, Abi :: C ) ?;
358
+ check_abi ( abi, Abi :: C { unwind : false } ) ?;
359
359
let & [ ref ptr, ref val, ref num] = check_arg_count ( args) ?;
360
360
let ptr = this. read_scalar ( ptr) ?. check_init ( ) ?;
361
361
let val = this. read_scalar ( val) ?. to_i32 ( ) ? as u8 ;
@@ -374,7 +374,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
374
374
}
375
375
}
376
376
"memchr" => {
377
- check_abi ( abi, Abi :: C ) ?;
377
+ check_abi ( abi, Abi :: C { unwind : false } ) ?;
378
378
let & [ ref ptr, ref val, ref num] = check_arg_count ( args) ?;
379
379
let ptr = this. read_scalar ( ptr) ?. check_init ( ) ?;
380
380
let val = this. read_scalar ( val) ?. to_i32 ( ) ? as u8 ;
@@ -392,7 +392,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
392
392
}
393
393
}
394
394
"strlen" => {
395
- check_abi ( abi, Abi :: C ) ?;
395
+ check_abi ( abi, Abi :: C { unwind : false } ) ?;
396
396
let & [ ref ptr] = check_arg_count ( args) ?;
397
397
let ptr = this. read_scalar ( ptr) ?. check_init ( ) ?;
398
398
let n = this. memory . read_c_str ( ptr) ?. len ( ) ;
@@ -408,7 +408,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
408
408
| "asinf"
409
409
| "atanf"
410
410
=> {
411
- check_abi ( abi, Abi :: C ) ?;
411
+ check_abi ( abi, Abi :: C { unwind : false } ) ?;
412
412
let & [ ref f] = check_arg_count ( args) ?;
413
413
// FIXME: Using host floats.
414
414
let f = f32:: from_bits ( this. read_scalar ( f) ?. to_u32 ( ) ?) ;
@@ -428,7 +428,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
428
428
| "hypotf"
429
429
| "atan2f"
430
430
=> {
431
- check_abi ( abi, Abi :: C ) ?;
431
+ check_abi ( abi, Abi :: C { unwind : false } ) ?;
432
432
let & [ ref f1, ref f2] = check_arg_count ( args) ?;
433
433
// underscore case for windows, here and below
434
434
// (see https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/floating-point-primitives?view=vs-2019)
@@ -450,7 +450,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
450
450
| "asin"
451
451
| "atan"
452
452
=> {
453
- check_abi ( abi, Abi :: C ) ?;
453
+ check_abi ( abi, Abi :: C { unwind : false } ) ?;
454
454
let & [ ref f] = check_arg_count ( args) ?;
455
455
// FIXME: Using host floats.
456
456
let f = f64:: from_bits ( this. read_scalar ( f) ?. to_u64 ( ) ?) ;
@@ -470,7 +470,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
470
470
| "hypot"
471
471
| "atan2"
472
472
=> {
473
- check_abi ( abi, Abi :: C ) ?;
473
+ check_abi ( abi, Abi :: C { unwind : false } ) ?;
474
474
let & [ ref f1, ref f2] = check_arg_count ( args) ?;
475
475
// FIXME: Using host floats.
476
476
let f1 = f64:: from_bits ( this. read_scalar ( f1) ?. to_u64 ( ) ?) ;
@@ -486,7 +486,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
486
486
| "ldexp"
487
487
| "scalbn"
488
488
=> {
489
- check_abi ( abi, Abi :: C ) ?;
489
+ check_abi ( abi, Abi :: C { unwind : false } ) ?;
490
490
let & [ ref x, ref exp] = check_arg_count ( args) ?;
491
491
// For radix-2 (binary) systems, `ldexp` and `scalbn` are the same.
492
492
let x = this. read_scalar ( x) ?. to_f64 ( ) ?;
@@ -508,12 +508,12 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
508
508
509
509
// Architecture-specific shims
510
510
"llvm.x86.sse2.pause" if this. tcx . sess . target . arch == "x86" || this. tcx . sess . target . arch == "x86_64" => {
511
- check_abi ( abi, Abi :: C ) ?;
511
+ check_abi ( abi, Abi :: C { unwind : false } ) ?;
512
512
let & [ ] = check_arg_count ( args) ?;
513
513
this. yield_active_thread ( ) ;
514
514
}
515
515
"llvm.aarch64.hint" if this. tcx . sess . target . arch == "aarch64" => {
516
- check_abi ( abi, Abi :: C ) ?;
516
+ check_abi ( abi, Abi :: C { unwind : false } ) ?;
517
517
let & [ ref hint] = check_arg_count ( args) ?;
518
518
let hint = this. read_scalar ( hint) ?. to_i32 ( ) ?;
519
519
match hint {
0 commit comments