/* Linker script for user programs: a static executable loaded at 4 MiB into user space (USER_START = 0x80_0000_0000, see src/memory.rs). Each part starts on its own page so it can get its own page permissions: code = read+execute, rodata = read-only, data/bss = read+write. The `large` code model (see build.rs) names its sections .ltext, .lrodata, .ldata and .lbss, so those must be listed too -- otherwise the linker places them wherever it likes (e.g. code in a non-executable segment). */ ENTRY(_start) PHDRS { text PT_LOAD FLAGS(5); /* R-X */ rodata PT_LOAD FLAGS(4); /* R-- */ data PT_LOAD FLAGS(6); /* RW- */ } SECTIONS { . = 0x8000400000; .text : ALIGN(4K) { *(.text .text.* .ltext .ltext.*) } :text .rodata : ALIGN(4K) { *(.rodata .rodata.* .lrodata .lrodata.*) } :rodata .data : ALIGN(4K) { *(.data .data.* .ldata .ldata.* .got .got.*) } :data .bss : ALIGN(8) { *(.bss .bss.* .lbss .lbss.* COMMON) } :data /DISCARD/ : { *(.comment) *(.eh_frame*) *(.note*) } }