2 use rustc_target::spec::abi::Abi;
5 use shims::unix::dlsym as unix;
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<'tcx>(name: &[u8], target_os: &str) -> InterpResult<'tcx, Option<Dlsym>> {
19 let name = &*String::from_utf8_lossy(name);
21 "linux" | "macos" => unix::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 dest: &PlaceTy<'tcx, Tag>,
36 ret: Option<mir::BasicBlock>,
37 ) -> InterpResult<'tcx> {
38 let this = self.eval_context_mut();
40 Dlsym::Posix(dlsym) =>
41 unix::EvalContextExt::call_dlsym(this, dlsym, abi, args, dest, ret),
42 Dlsym::Windows(dlsym) =>
43 windows::EvalContextExt::call_dlsym(this, dlsym, abi, args, dest, ret),