Skip to main content

code_address

Function code_address 

Source
pub const fn code_address(arch: Architecture) -> u64
Expand description

The address executable loads its code at: one page above 4 MiB (0x40_0000), the traditional base of a static Linux executable, with the file headers on the page(s) below it.

ยงExamples

use object_lang::{Architecture, elf};

assert_eq!(elf::code_address(Architecture::X86_64), 0x40_1000);
assert_eq!(elf::code_address(Architecture::Aarch64), 0x41_0000);