diff --git a/fuzz/Cargo.lock b/fuzz/Cargo.lock index b371412..5ad1b08 100644 --- a/fuzz/Cargo.lock +++ b/fuzz/Cargo.lock @@ -2009,7 +2009,6 @@ dependencies = [ "afl", "arbitrary", "borsh", - "cc", "common", "fuzz_props", "libfuzzer-sys", diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index 1aeaff3..d2d8e87 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -3,8 +3,6 @@ name = "fuzz" version = "0.1.0" edition = "2024" publish = false -# Provides sys_alloc_aligned stub for non-RISC-V host builds (see build.rs) -build = "build.rs" [package.metadata] cargo-fuzz = true @@ -52,10 +50,6 @@ common = { path = "../../logos-execution-zone/common" } fuzz_props = { path = "../fuzz_props" } testnet_initial_state = { path = "../../logos-execution-zone/testnet_initial_state" } -[build-dependencies] -# Used by build.rs to compile the sys_alloc_aligned stub for non-RISC-V hosts -cc = "1" - [profile.release] debug = true opt-level = 3 diff --git a/fuzz/build.rs b/fuzz/build.rs deleted file mode 100644 index c12f2bd..0000000 --- a/fuzz/build.rs +++ /dev/null @@ -1,25 +0,0 @@ -// fuzz/build.rs -// -// Provides `sys_alloc_aligned` for non-RISC-V host targets. -// -// `risc0_zkvm_platform::syscall::sys_alloc_words` calls the bare-metal symbol -// `sys_alloc_aligned`, which is normally supplied by the RISC-V zkVM runtime. -// When compiling fuzz targets for a host target (x86_64-unknown-linux-gnu, -// aarch64-unknown-linux-gnu, …) that symbol is absent, causing a linker error. -// This build script compiles a small C stub via the `cc` crate so the symbol -// is always available in the final fuzz binary. -// -// On macOS host builds (used by `cargo fuzz` / libFuzzer) the `cc` crate -// compiles the same stub; it is harmlessly dead-stripped if the symbol is not -// referenced. - -fn main() { - let target_arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap_or_default(); - - // RISC-V builds get the real symbol from the zkVM runtime — skip the stub. - if target_arch != "riscv32" && target_arch != "riscv64" { - cc::Build::new() - .file("build_stubs/sys_alloc_aligned.c") - .compile("sys_alloc_stub"); - } -} diff --git a/fuzz/build_stubs/sys_alloc_aligned.c b/fuzz/build_stubs/sys_alloc_aligned.c deleted file mode 100644 index 995f6ad..0000000 --- a/fuzz/build_stubs/sys_alloc_aligned.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * sys_alloc_aligned.c - * - * Provides `sys_alloc_aligned` for non-RISC-V host targets - * (e.g. aarch64-unknown-linux-gnu, x86_64-unknown-linux-gnu). - * - * On RISC-V the real symbol is supplied by the zkVM bare-metal runtime. - * On host targets, risc0_zkvm_platform may still reference this symbol via - * its `sys_alloc_words` helper; this stub satisfies that reference using - * POSIX `posix_memalign`. - */ -#ifndef __riscv - -#include -#include - -void *sys_alloc_aligned(size_t bytes, size_t align) { - void *ptr = NULL; - /* posix_memalign requires alignment >= sizeof(void*) and a power of 2. */ - size_t real_align = align < sizeof(void *) ? sizeof(void *) : align; - if (posix_memalign(&ptr, real_align, bytes) != 0) - return NULL; - return ptr; -} - -#endif /* !__riscv */