taikoxyz / raiko

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

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

Closed johntaiko closed 6 months ago

johntaiko commented 6 months ago

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

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

Wooooooow gonna try it out!

smtmfft commented 6 months ago

Just wondering why mismatched declaration does not lead to link failure

johntaiko commented 6 months 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 6 months 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.