OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") OUTPUT_ARCH(i386) /*STARTUP(crt0.o)*/ MEMORY { state(WXAIL) : ORIGIN = 0x0, LENGTH = 512K } _RESERVED_START = 512; _RESERVED_END = 4096; 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: { . = ORIGIN(state); _reg_start = .; /* BOCHS BINARY IMAGE DOES NOT INCLUDE REGISTERS */ _reg_end = .; } > state RAM 0x0 : AT (ADDR (REG) + SIZEOF(REG)) { /* Next comes ram portion of the address space */ _ram_contents_start = .; /* FIRST 512 BYTES are reserved for system specific DATA -- match 6502 layout */ . = _RESERVED_START - SIZEOF(REG); _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 = .; /* end of all loaded segments */ _load_end = .; /* HEAP can start after THIS */ _heap_start = .; /* Last 4096 bytes of the Image is reserved for system specific areas such as memory mapped io registers and system specific vectors such as 6502 reset, nmi, etc. This is where we will initialize the stack too. */ . = LENGTH(state) - _RESERVED_END - SIZEOF(REG); _IO_MEM = .; _stack_start = .; /* advance the point to the end of the memory so that we fill out the rest of the availble state with ram */ . = LENGTH(state) - SIZEOF(REG); _ram_contents_end = .; } > state }