rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | OUTPUT_FORMAT("elf32-bigmips", "elf32-bigmips", "elf32-littlemips") |
| 2 | OUTPUT_ARCH(mips) |
| 3 | |
| 4 | ENTRY(_start) |
| 5 | SECTIONS |
| 6 | { |
| 7 | . = %KERNEL_BASE% + %KERNEL_LOAD_OFFSET%; |
| 8 | |
| 9 | /* text/read-only data */ |
| 10 | .text : { |
| 11 | KEEP(*(.text.vectab)) |
| 12 | KEEP(*(.text.boot)) |
| 13 | *(.text* .gnu.linkonce.t.*) |
| 14 | } |
| 15 | |
| 16 | .interp : { *(.interp) } |
| 17 | .hash : { *(.hash) } |
| 18 | .dynsym : { *(.dynsym) } |
| 19 | .dynstr : { *(.dynstr) } |
| 20 | .rel.text : { *(.rel.text) *(.rel.gnu.linkonce.t*) } |
| 21 | .rela.text : { *(.rela.text) *(.rela.gnu.linkonce.t*) } |
| 22 | .rel.data : { *(.rel.data) *(.rel.gnu.linkonce.d*) } |
| 23 | .rela.data : { *(.rela.data) *(.rela.gnu.linkonce.d*) } |
| 24 | .rel.rodata : { *(.rel.rodata) *(.rel.gnu.linkonce.r*) } |
| 25 | .rela.rodata : { *(.rela.rodata) *(.rela.gnu.linkonce.r*) } |
| 26 | .rel.got : { *(.rel.got) } |
| 27 | .rela.got : { *(.rela.got) } |
| 28 | .rel.ctors : { *(.rel.ctors) } |
| 29 | .rela.ctors : { *(.rela.ctors) } |
| 30 | .rel.dtors : { *(.rel.dtors) } |
| 31 | .rela.dtors : { *(.rela.dtors) } |
| 32 | .rel.init : { *(.rel.init) } |
| 33 | .rela.init : { *(.rela.init) } |
| 34 | .rel.fini : { *(.rel.fini) } |
| 35 | .rela.fini : { *(.rela.fini) } |
| 36 | .rel.bss : { *(.rel.bss) } |
| 37 | .rela.bss : { *(.rela.bss) } |
| 38 | .rel.plt : { *(.rel.plt) } |
| 39 | .rela.plt : { *(.rela.plt) } |
| 40 | .init : { *(.init) } |
| 41 | .plt : { *(.plt) } |
| 42 | |
| 43 | .rodata : ALIGN(4) { |
| 44 | __rodata_start = .; |
| 45 | *(.rodata .rodata.* .gnu.linkonce.r.*) |
| 46 | } |
| 47 | |
| 48 | .sdata2 : ALIGN(4) { |
| 49 | _SDATA2_START__ = .; |
| 50 | *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) |
| 51 | _SDATA2_END__ = .; |
| 52 | } |
| 53 | |
| 54 | .sbss2 : ALIGN(4) { |
| 55 | /* read only small variables without initial value */ |
| 56 | _SBSS2_START__ = .; |
| 57 | *(.sbss2*) |
| 58 | _SBSS2_END__ = .; |
| 59 | } |
| 60 | |
| 61 | /* |
| 62 | * extra linker scripts tend to insert sections just after .rodata, |
| 63 | * so we want to make sure this symbol comes after anything inserted above, |
| 64 | * but not aligned to the next section necessarily. |
| 65 | */ |
| 66 | .dummy_post_rodata : { |
| 67 | __rodata_end = .; |
| 68 | } |
| 69 | |
| 70 | .data : ALIGN(4) { |
| 71 | /* writable data */ |
| 72 | __data_start_rom = .; |
| 73 | /* in one segment binaries, the rom data address is on top of the ram data address */ |
| 74 | __data_start = .; |
| 75 | *(.data .data.* .gnu.linkonce.d.*) |
| 76 | __ctor_list = .; |
| 77 | KEEP(*(.ctors .init_array)) |
| 78 | __ctor_end = .; |
| 79 | __dtor_list = .; |
| 80 | KEEP(*(.dtors .fini_array)) |
| 81 | __dtor_end = .; |
| 82 | *(.got*) |
| 83 | *(.dynamic) |
| 84 | |
| 85 | } |
| 86 | |
| 87 | .sdata : { |
| 88 | /* read-write small data with initial value */ |
| 89 | _SDATA_START__ = .; |
| 90 | *(.sdata .sdata.* .gnu.linkonce.s.*) |
| 91 | _SDATA_END__ = .; |
| 92 | } |
| 93 | |
| 94 | /* |
| 95 | * extra linker scripts tend to insert sections just after .data, |
| 96 | * so we want to make sure this symbol comes after anything inserted above, |
| 97 | * but not aligned to the next section necessarily. |
| 98 | */ |
| 99 | .dummy_post_data : { |
| 100 | __data_end = .; |
| 101 | } |
| 102 | |
| 103 | . = ALIGN(4); |
| 104 | __bss_start = .; |
| 105 | |
| 106 | .sbss : { |
| 107 | /* read-write small variables without initial value */ |
| 108 | _sbss_start__ = .; |
| 109 | *(.dynsbss) |
| 110 | *(.sbss .sbss.* .gnu.linkonce.sb.*) |
| 111 | *(.scommon) |
| 112 | _sbss_end__ = .; |
| 113 | } |
| 114 | |
| 115 | /* unintialized data (in same segment as writable data) */ |
| 116 | .bss : { |
| 117 | /* regular bss */ |
| 118 | *(.dynbss) |
| 119 | *(.bss .bss.*) |
| 120 | *(.gnu.linkonce.b.*) |
| 121 | *(COMMON) |
| 122 | } |
| 123 | |
| 124 | . = ALIGN(4); |
| 125 | __bss_end = .; |
| 126 | |
| 127 | _end = .; |
| 128 | |
| 129 | . = %KERNEL_BASE% + %MEMSIZE%; |
| 130 | _end_of_ram = .; |
| 131 | |
| 132 | /* Strip unnecessary stuff */ |
| 133 | /DISCARD/ : { *(.comment .note .eh_frame) } |
| 134 | } |
| 135 | |