rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | OUTPUT_FORMAT("elf32-or1k", "elf32-or1k", "elf32-or1k") |
| 2 | OUTPUT_ARCH(or1k) |
| 3 | |
| 4 | ENTRY(_start) |
| 5 | SECTIONS |
| 6 | { |
| 7 | . = %KERNEL_BASE% + %KERNEL_LOAD_OFFSET%; |
| 8 | |
| 9 | _start = .; |
| 10 | |
| 11 | /* vector table goes at 0 */ |
| 12 | .vectors : AT(0) { |
| 13 | KEEP(*(.vectors)) |
| 14 | } |
| 15 | |
| 16 | /* text/read-only data */ |
| 17 | /* set the load address to physical MEMBASE */ |
| 18 | .text : AT(%MEMBASE% + %KERNEL_LOAD_OFFSET% + SIZEOF(.vectors)) { |
| 19 | KEEP(*(.text.boot)) |
| 20 | *(.text* .gnu.linkonce.t.*) |
| 21 | } |
| 22 | |
| 23 | .interp : { *(.interp) } |
| 24 | .hash : { *(.hash) } |
| 25 | .dynsym : { *(.dynsym) } |
| 26 | .dynstr : { *(.dynstr) } |
| 27 | .rel.text : { *(.rel.text) *(.rel.gnu.linkonce.t*) } |
| 28 | .rela.text : { *(.rela.text) *(.rela.gnu.linkonce.t*) } |
| 29 | .rel.data : { *(.rel.data) *(.rel.gnu.linkonce.d*) } |
| 30 | .rela.data : { *(.rela.data) *(.rela.gnu.linkonce.d*) } |
| 31 | .rel.rodata : { *(.rel.rodata) *(.rel.gnu.linkonce.r*) } |
| 32 | .rela.rodata : { *(.rela.rodata) *(.rela.gnu.linkonce.r*) } |
| 33 | .rel.got : { *(.rel.got) } |
| 34 | .rela.got : { *(.rela.got) } |
| 35 | .rel.ctors : { *(.rel.ctors) } |
| 36 | .rela.ctors : { *(.rela.ctors) } |
| 37 | .rel.dtors : { *(.rel.dtors) } |
| 38 | .rela.dtors : { *(.rela.dtors) } |
| 39 | .rel.init : { *(.rel.init) } |
| 40 | .rela.init : { *(.rela.init) } |
| 41 | .rel.fini : { *(.rel.fini) } |
| 42 | .rela.fini : { *(.rela.fini) } |
| 43 | .rel.bss : { *(.rel.bss) } |
| 44 | .rela.bss : { *(.rela.bss) } |
| 45 | .rel.plt : { *(.rel.plt) } |
| 46 | .rela.plt : { *(.rela.plt) } |
| 47 | .init : { *(.init) } |
| 48 | .plt : { *(.plt) } |
| 49 | |
| 50 | .rodata : ALIGN(4) { |
| 51 | __rodata_start = .; |
| 52 | *(.rodata .rodata.* .gnu.linkonce.r.*) |
| 53 | . = ALIGN(4); |
| 54 | __rodata_end = .; |
| 55 | } |
| 56 | |
| 57 | |
| 58 | .data : ALIGN(4) { |
| 59 | /* writable data */ |
| 60 | __data_start_rom = .; |
| 61 | /* in one segment binaries, the rom data address is on top of the ram data address */ |
| 62 | __data_start = .; |
| 63 | *(.data .data.* .gnu.linkonce.d.*) |
| 64 | __ctor_list = .; |
| 65 | KEEP(*(.ctors .init_array)) |
| 66 | __ctor_end = .; |
| 67 | __dtor_list = .; |
| 68 | KEEP(*(.dtors .fini_array)) |
| 69 | __dtor_end = .; |
| 70 | *(.got*) |
| 71 | *(.dynamic) |
| 72 | |
| 73 | __data_end = .; |
| 74 | } |
| 75 | |
| 76 | |
| 77 | /* unintialized data (in same segment as writable data) */ |
| 78 | .bss : ALIGN(4) { |
| 79 | KEEP(*(.bss.prebss.*)) |
| 80 | . = ALIGN(4); |
| 81 | __bss_start = .; |
| 82 | *(.bss .bss.*) |
| 83 | *(.gnu.linkonce.b.*) |
| 84 | *(COMMON) |
| 85 | . = ALIGN(4); |
| 86 | __bss_end = .; |
| 87 | } |
| 88 | |
| 89 | _end = .; |
| 90 | |
| 91 | . = %KERNEL_BASE% + %MEMSIZE%; |
| 92 | _end_of_ram = .; |
| 93 | |
| 94 | /* Strip unnecessary stuff */ |
| 95 | /DISCARD/ : { *(.comment .note .eh_frame) } |
| 96 | } |