2 use rustc_target::spec::abi::Abi;
5 use shims::posix::dlsym as posix;
6 use shims::windows::dlsym as windows;
8 #[derive(Debug, Copy, Clone)]
9 #[allow(non_camel_case_types)]
12 Windows(windows::Dlsym),
16 // Returns an error for unsupported symbols, and None if this symbol
17 // should become a NULL pointer (pretend it does not exist).
18 pub fn from_str(name: &[u8], target_os: &str) -> InterpResult<'static, Option<Dlsym>> {
19 let name = &*String::from_utf8_lossy(name);
21 "linux" | "macos" => posix::Dlsym::from_str(name, target_os)?.map(Dlsym::Posix),
22 "windows" => windows::Dlsym::from_str(name)?.map(Dlsym::Windows),
23 os => bug!("dlsym not implemented for target_os {}", os),
28 impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
29 pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
34 args: &[OpTy<'tcx, Tag>],
35 ret: Option<(PlaceTy<'tcx, Tag>, mir::BasicBlock)>,
36 ) -> InterpResult<'tcx> {
37 let this = self.eval_context_mut();
39 Dlsym::Posix(dlsym) => posix::EvalContextExt::call_dlsym(this, dlsym, abi, args, ret),
40 Dlsym::Windows(dlsym) => windows::EvalContextExt::call_dlsym(this, dlsym, abi, args, ret),