5 #[derive(Debug, Copy, Clone)]
11 // Returns an error for unsupported symbols, and None if this symbol
12 // should become a NULL pointer (pretend it does not exist).
13 pub fn from_str(name: &str) -> InterpResult<'static, Option<Dlsym>> {
16 "getentropy" => Some(GetEntropy),
17 "__pthread_get_minstack" => None,
18 _ => throw_unsup_format!("Unsupported dlsym: {}", name),
23 impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
24 pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
28 args: &[OpTy<'tcx, Tag>],
29 ret: Option<(PlaceTy<'tcx, Tag>, mir::BasicBlock)>,
30 ) -> InterpResult<'tcx> {
33 let this = self.eval_context_mut();
34 let (dest, ret) = ret.expect("we don't support any diverging dlsym");
38 let ptr = this.read_scalar(args[0])?.not_undef()?;
39 let len = this.read_scalar(args[1])?.to_machine_usize(this)?;
40 this.gen_random(ptr, len as usize)?;
41 this.write_null(dest)?;
45 this.dump_place(*dest);
46 this.go_to_block(ret);