| git.druid.rocks | index | druid520 | kaboom | src/ | user/ | user.ld |
src/user/user.ld
/*
* link script for every userspace program, sh included -- now that
* each process gets its own real address space (vmm.nsc), isolation
* comes from cr3, not address partitioning, so there's no reason for
* sh to need a different fixed address from anything it runs any
* more (see the old user_shell.ld/user_prog.ld's own history for why
* that split existed in the first place).
*
* two PT_LOAD segments (R+X text/rodata, R+W bss), tiny linker page
* size -- unchanged reasoning from the old scripts: avoids ld's "RWX
* permissions" warning at near-zero cost, since this loader has no
* real use for page alignment.
*/
PHDRS
{
rx PT_LOAD FLAGS(5); /* R+X, never W */
rw PT_LOAD FLAGS(6); /* R+W, never X */
}
ENTRY(_start)
SECTIONS
{
. = 0x400000;
.text : { *(.text) } :rx
.rodata : { *(.rodata) } :rx
. = ALIGN(8);
.bss : { *(.bss) *(COMMON) } :rw
/DISCARD/ : { *(.note.*) *(.comment) *(.eh_frame) }
}