taikoxyz / raiko

Multi-proofs for Taiko. SNARKS, STARKS and Trusted Execution Enclave. Our previous ZK-EVM circuits are deprecated.
Apache License 2.0
96 stars 75 forks source link

fix: mismatch method signature of libc's calloc #201

Closed johntaiko closed 1 month ago

johntaiko commented 1 month ago

https://docs.rs/libc/latest/libc/fn.calloc.html

pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void;
Brechtpd commented 1 month ago

Wooooooow gonna try it out!

smtmfft commented 1 month ago

Just wondering why mismatched declaration does not lead to link failure

johntaiko commented 1 month ago

Just wondering why mismatched declaration does not lead to link failure

Linker is only a sysmbol(function name) lookup table without any syntax check, and it supports variable-counts arguments, the caller and the callee need to strictly adhere to the constraints themselves.

https://www.reddit.com/r/rust/comments/xl9ths/comment/ipixn53/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button

smtmfft commented 1 month ago

Just wondering why mismatched declaration does not lead to link failure

Linker is only a sysmbol(function name) lookup table without any syntax check, and it supports variable-counts arguments, the caller and the callee need to strictly adhere to the constraints themselves.

https://www.reddit.com/r/rust/comments/xl9ths/comment/ipixn53/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button

Oh, it seems a 2 levels include reference, so here rust extern C ABI conceals the real signature in libc.h.