pub fn load_elf_image(
elf_data: &[u8],
user_as: &AddressSpace,
) -> Result<LoadedElfInfo, &'static str>Expand description
Load an ELF binary into the provided address space. Returns the entry point address.
§Duplication note (audit 2026-09-07)
This function duplicates the parsing / PT_LOAD / RELRO / PT_INTERP /
TLS-extraction steps of load_elf_task_inner. Asterinas avoids the
duplication by separating load_elf_to_vmar (image-loading sink)
from do_execve (process setup). In Strat9-OS the two paths have
diverged over time : this function does not allocate the TLS block
itself (the caller in crate::syscall::exec does), and it does not
build a Task struct.
A future refactor should extract the common parse → load_segments → RELRO → interp-load → tls-extract sequence into a single private
helper parameterised by an ImageSink trait (Task-bound vs bare AS),
mirroring Asterinas. Until then, every loader-side fix must be applied
to both functions.