Skip to content

"Memory Layout Restrictions" proposal#10

Open
marcinbugaj wants to merge 1 commit intomainfrom
mmbugaj/common-memory-layout
Open

"Memory Layout Restrictions" proposal#10
marcinbugaj wants to merge 1 commit intomainfrom
mmbugaj/common-memory-layout

Conversation

@marcinbugaj
Copy link
Collaborator

No description provided.

@marcinbugaj marcinbugaj force-pushed the mmbugaj/common-memory-layout branch from e842e49 to d870f31 Compare December 2, 2025 16:03
@kevaundray
Copy link
Contributor

@maximmenshikov
Copy link

@marcinbugaj in general no objections.
However, as we need to debug code, I suggest that we add a point that zkVM developer team is recommended to supply a linker script that is a gentle mix of zkVM-specific linker script and normal Linux linker script. If we can run the app in native Linux, it gives significantly more debugging and testing capabilities, and I don't think we should throw this possibility away.
That might push the zkVM R&D team towards using the layout more compatible with Linux. I think it is good for zkVM world.

@kevaundray
Copy link
Contributor

gentle mix of zkVM-specific linker script and normal Linux linker script

I'm wondering if this suggesting leans more towards just standardizing the memory layout?

@maximmenshikov
Copy link

gentle mix of zkVM-specific linker script and normal Linux linker script

I'm wondering if this suggesting leans more towards just standardizing the memory layout?

There are two widely different aspects: efficiency and compatibility.
zkVM must be efficient, but testing the ELF must be possible offline - this gives much richer debugging environment. In that case, we need linker script that is more compatible with regular Linux.

In our case, for debugging we have made zkvm-specific script and the Linux script that preserves sections and important symbols of the zkvm script. The latter is very good for gdb, lldb, whatever, and speeds up development a lot.

@marcinbugaj
Copy link
Collaborator Author

marcinbugaj commented Dec 16, 2025

The silent assumption of mine was that a guest application source code can be compiled for Linux with stock toolchain (for C and Rust). That implies that no custom linker script for Linux is needed. That is achievable as long as zkVMs provide Linux implementations of precompiles library and IO library (#8). Perhaps we could standardize it in a separate PR saying that "zkVMs must provide precompiles library and IO library that works on Linux so that any application targeting zkVM can be compiled without source code modification for Linux". That proposal could be called "Testing and Linux guest program portability". @kevaundray , @maximmenshikov what's your take on that?

@kevaundray
Copy link
Contributor

The silent assumption of mine was that a guest application source code can be compiled for Linux with stock toolchain (for C and Rust). That implies that no custom linker script for Linux is needed. That is achievable as long as zkVMs provide Linux implementations of precompiles library and IO library (#8). Perhaps we could standardize it in a separate PR saying that "zkVMs must provide precompiles library and IO library that works on Linux so that any application targeting zkVM can be compiled without source code modification for Linux". That proposal could be called "Testing and Linux guest program portability". @kevaundray , @maximmenshikov what's your take on that?

Would this mean that zkVMs will need to move their ecall syscall numbers down to not collide with linux syscalls? (For the zkVMs that use ecall)

@marcinbugaj
Copy link
Collaborator Author

marcinbugaj commented Dec 16, 2025

Would this mean that zkVMs will need to move their ecall syscall numbers down to not collide with linux syscalls? (For the zkVMs that use ecall)

No. An application code won't use syscalls. That's because we agreed to riscv64im-unknown-none-elf which doesn't use syscalls for IO, memory allocation etc. Syscalls can be used as an internal implementation of IO library or precompiles library. These are provided by zkVMs and would be different for zkVM and host (x86). Actually there could be a generic implementation of these libraries for host.

@marcinbugaj
Copy link
Collaborator Author

@maximmenshikov , @kevaundray here is a document that covers compatibility and testing: https://github.com/eth-act/zkvm-standards/pull/12/files

@marcinbugaj marcinbugaj changed the title Memory Layout Restrictions proposal "Memory Layout Restrictions" proposal Jan 22, 2026
@marcinbugaj marcinbugaj force-pushed the mmbugaj/common-memory-layout branch 2 times, most recently from 82358f3 to 7173f7d Compare February 11, 2026 12:07
@marcinbugaj marcinbugaj force-pushed the mmbugaj/common-memory-layout branch from 7173f7d to 55d85fa Compare February 11, 2026 12:27
@shamatar
Copy link

No objections from me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants