Skip to main content

luaur_code_gen/records/
compilation_options.rs

1use crate::records::host_ir_hooks::HostIrHooks;
2
3#[derive(Debug, Clone)]
4#[repr(C)]
5pub struct CompilationOptions {
6    pub flags: u32,
7    pub hooks: HostIrHooks,
8
9    /// null-terminated array of userdata types names that might have custom lowering
10    pub userdata_types: *const *const core::ffi::c_char,
11
12    pub record_counters: bool,
13
14    /// When true, random NOP sleds are inserted between blocks to
15    /// make intra-function gadget offsets unpredictable.
16    pub nop_padding: bool,
17}
18
19impl Default for CompilationOptions {
20    fn default() -> Self {
21        unsafe {
22            let mut hooks = core::mem::MaybeUninit::<HostIrHooks>::zeroed();
23            Self {
24                flags: 0,
25                hooks: hooks.assume_init(),
26                userdata_types: core::ptr::null(),
27                record_counters: false,
28                nop_padding: false,
29            }
30        }
31    }
32}