First working version of LLVM in Windows

This commit is contained in:
Syrus Akbary
2019-07-30 14:47:53 -07:00
parent 714bf6ab6b
commit 12f8f3d085
12 changed files with 227 additions and 111 deletions

View File

@ -0,0 +1,39 @@
use libc::c_char;
use wasmer_runtime_core::vm;
#[repr(C)]
pub struct LLVMModule {
_private: [u8; 0],
}
#[allow(non_camel_case_types, dead_code)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
#[repr(C)]
pub enum MemProtect {
NONE,
READ,
READ_WRITE,
READ_EXECUTE,
}
#[allow(non_camel_case_types, dead_code)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
#[repr(C)]
pub enum LLVMResult {
OK,
ALLOCATE_FAILURE,
PROTECT_FAILURE,
DEALLOC_FAILURE,
OBJECT_LOAD_FAILURE,
}
#[repr(C)]
pub struct Callbacks {
pub alloc_memory: extern "C" fn(usize, MemProtect, &mut *mut u8, &mut usize) -> LLVMResult,
pub protect_memory: extern "C" fn(*mut u8, usize, MemProtect) -> LLVMResult,
pub dealloc_memory: extern "C" fn(*mut u8, usize) -> LLVMResult,
pub lookup_vm_symbol: extern "C" fn(*const c_char, usize) -> *const vm::Func,
pub visit_fde: extern "C" fn(*mut u8, usize, extern "C" fn(*mut u8)),
}