always use memfd for lib

This commit is contained in:
5ec1cff
2024-01-02 19:34:34 +08:00
parent d5c896e966
commit b041a4fca0

View File

@@ -137,12 +137,6 @@ fn load_modules(arch: &str) -> Result<Vec<Module>> {
Ok(modules) Ok(modules)
} }
#[cfg(debug_assertions)]
fn create_library_fd(so_path: &PathBuf) -> Result<OwnedFd> {
Ok(OwnedFd::from(fs::File::open(so_path)?))
}
#[cfg(not(debug_assertions))]
fn create_library_fd(so_path: &PathBuf) -> Result<OwnedFd> { fn create_library_fd(so_path: &PathBuf) -> Result<OwnedFd> {
let opts = memfd::MemfdOptions::default().allow_sealing(true); let opts = memfd::MemfdOptions::default().allow_sealing(true);
let memfd = opts.create("jit-cache")?; let memfd = opts.create("jit-cache")?;