From dca2bb68b3010a7cd47ae1e79674dcc7812828ce Mon Sep 17 00:00:00 2001 From: InfRandomness Date: Fri, 1 Jul 2022 18:36:14 +0200 Subject: [PATCH] Add `__error` to freebsd shims Signed-off-by: InfRandomness --- src/shims/unix/freebsd/foreign_items.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/shims/unix/freebsd/foreign_items.rs b/src/shims/unix/freebsd/foreign_items.rs index cad119233740..66e339cc4a82 100644 --- a/src/shims/unix/freebsd/foreign_items.rs +++ b/src/shims/unix/freebsd/foreign_items.rs @@ -24,6 +24,14 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; this.write_null(dest)?; } + + // errno + "__error" => { + let [] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?; + let errno_place = this.last_error_place()?; + this.write_scalar(errno_place.to_ref(this).to_scalar()?, dest)?; + } + _ => return Ok(EmulateByNameResult::NotSupported), } Ok(EmulateByNameResult::NeedsJumping)