OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") OUTPUT_ARCH(i386) MEMORY { state(WXAIL) : ORIGIN = 0x0, LENGTH = 1M } SECTIONS { /* Following for good measure to remove these from the output but -s flag to gcc (strip) removes the comment and -Wl,--build-id=none removes the identity info */ /DISCARD/ : { *(.note.gnu.build-id); *(.comment); } REG 0x0: { _reg_start = .; /* reserve 16 integers for the registers */ LONG(0x0); /* r0 */ LONG(0x0); /* r1 */ LONG(0x0); /* r2 */ LONG(0x0); /* r3 */ LONG(0x0); /* r4 */ LONG(0x0); /* r5 */ LONG(0x0); /* r6 */ LONG(0x0); /* r7 */ LONG(0x0); /* r8 */ LONG(0x0); /* r9 */ LONG(0x0); /* r10 */ LONG(0x0); /* r11 */ LONG(0x0); /* r12 */ LONG(0x0); /* r13 */ LONG(0x0); /* r14 */ LONG(0x0); /* r15 */ _reg_end = .; } > state RAM 0x0 : AT (ADDR (REG) + SIZEOF(REG)) { /* Next comes ram portion of the address space */ _ram_contents_start = .; _text_start = .; *(.text); _text_end = .; _rodata_start = .; *(.rodata); _rodata_end = .; _data_start = .; *(.data); _data_end = .; _bss_start = .; *(.bss); _bss_end = .; _eh_frame_start = .; *(.eh_frame); _eh_frame_end = .; /* little dangerous but I am going to catch all other sections generated and put in here in case I have missed something */ _bilge_start = .; *(*); _bilge_end = .; _ram_contents_end = .; /* advance the point to the end of the memory so that we fill out the rest of the availble state with ram */ . = 1M - SIZEOF(REG); } > state }