rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") |
| 2 | OUTPUT_ARCH(arm) |
| 3 | |
| 4 | ENTRY(_start) |
| 5 | SECTIONS |
| 6 | { |
| 7 | . = %ROMBASE%; |
| 8 | |
| 9 | /* text/read-only data */ |
| 10 | .text : { |
| 11 | KEEP(*(.text.boot.vectab1)) |
| 12 | KEEP(*(.text.boot.vectab2)) |
| 13 | KEEP(*(.text.boot)) |
| 14 | *(.text* .sram.text.glue_7* .gnu.linkonce.t.*) |
| 15 | } |
| 16 | |
| 17 | .interp : { *(.interp) } |
| 18 | .hash : { *(.hash) } |
| 19 | .dynsym : { *(.dynsym) } |
| 20 | .dynstr : { *(.dynstr) } |
| 21 | .rel.text : { *(.rel.text) *(.rel.gnu.linkonce.t*) } |
| 22 | .rela.text : { *(.rela.text) *(.rela.gnu.linkonce.t*) } |
| 23 | .rel.data : { *(.rel.data) *(.rel.gnu.linkonce.d*) } |
| 24 | .rela.data : { *(.rela.data) *(.rela.gnu.linkonce.d*) } |
| 25 | .rel.rodata : { *(.rel.rodata) *(.rel.gnu.linkonce.r*) } |
| 26 | .rela.rodata : { *(.rela.rodata) *(.rela.gnu.linkonce.r*) } |
| 27 | .rel.got : { *(.rel.got) } |
| 28 | .rela.got : { *(.rela.got) } |
| 29 | .rel.ctors : { *(.rel.ctors) } |
| 30 | .rela.ctors : { *(.rela.ctors) } |
| 31 | .rel.dtors : { *(.rel.dtors) } |
| 32 | .rela.dtors : { *(.rela.dtors) } |
| 33 | .rel.init : { *(.rel.init) } |
| 34 | .rela.init : { *(.rela.init) } |
| 35 | .rel.fini : { *(.rel.fini) } |
| 36 | .rela.fini : { *(.rela.fini) } |
| 37 | .rel.bss : { *(.rel.bss) } |
| 38 | .rela.bss : { *(.rela.bss) } |
| 39 | .rel.plt : { *(.rel.plt) } |
| 40 | .rela.plt : { *(.rela.plt) } |
| 41 | .init : { *(.init) } =0x9090 |
| 42 | .plt : { *(.plt) } |
| 43 | |
| 44 | /* .ARM.exidx is sorted, so has to go in its own output section. */ |
| 45 | __exidx_start = .; |
| 46 | .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } |
| 47 | __exidx_end = .; |
| 48 | |
| 49 | .rodata : ALIGN(4) { |
| 50 | __rodata_start = .; |
| 51 | __fault_handler_table_start = .; |
| 52 | KEEP(*(.rodata.fault_handler_table)) |
| 53 | __fault_handler_table_end = .; |
| 54 | *(.rodata .rodata.* .gnu.linkonce.r.*) |
| 55 | } |
| 56 | |
| 57 | /* fake section for .data to anchor off of |
| 58 | * needed because extra linker scripts tend to insert sections |
| 59 | * just after .rodata |
| 60 | */ |
| 61 | .dummy_post_rodata : { |
| 62 | /* end of rodata, start of data area */ |
| 63 | __rodata_end = . ; |
| 64 | __data_start_rom = .; |
| 65 | } |
| 66 | |
| 67 | /* in two segment binaries, the data starts at the bottom of ram (MEMBASE) |
| 68 | * bump us forward to the start of ram |
| 69 | */ |
| 70 | . = %MEMBASE%; |
| 71 | |
| 72 | /* start .data segment, force the physical address to be AT() __data_start_rom */ |
| 73 | .data : AT ( ADDR (.dummy_post_rodata) + SIZEOF (.dummy_post_rodata) ) ALIGN(4) { |
| 74 | __data_start = .; |
| 75 | *(.data .data.* .gnu.linkonce.d.*) |
| 76 | } |
| 77 | |
| 78 | /* code that is located in ram */ |
| 79 | .sram.text : ALIGN(4) { |
| 80 | KEEP (*(.sram.text*)) |
| 81 | } |
| 82 | .ctors : ALIGN(4) { |
| 83 | __ctor_list = .; |
| 84 | KEEP(*(.ctors .init_array)) |
| 85 | __ctor_end = .; |
| 86 | } |
| 87 | .dtors : ALIGN(4) { |
| 88 | __dtor_list = .; |
| 89 | KEEP(*(.dtors .fini_array)) |
| 90 | __dtor_end = .; |
| 91 | } |
| 92 | .got : { *(.got.plt) *(.got) } |
| 93 | .dynamic : { *(.dynamic) } |
| 94 | |
| 95 | /* |
| 96 | * extra linker scripts tend to insert sections just after .data, |
| 97 | * so we want to make sure this symbol comes after anything inserted above, |
| 98 | * but not aligned to the next section necessarily. |
| 99 | */ |
| 100 | .dummy_post_data : { |
| 101 | __data_end = .; |
| 102 | } |
| 103 | |
| 104 | /* unintialized data (in same segment as writable data) */ |
| 105 | .bss : ALIGN(4) { |
| 106 | KEEP(*(.bss.prebss.*)) |
| 107 | . = ALIGN(4); |
| 108 | __bss_start = .; |
| 109 | *(.bss .bss.*) |
| 110 | *(.gnu.linkonce.b.*) |
| 111 | *(COMMON) |
| 112 | . = ALIGN(4); |
| 113 | __bss_end = .; |
| 114 | } |
| 115 | |
| 116 | _end = .; |
| 117 | |
| 118 | . = %MEMBASE% + %MEMSIZE%; |
| 119 | _end_of_ram = .; |
| 120 | |
| 121 | /* Strip unnecessary stuff */ |
| 122 | /DISCARD/ : { *(.comment .note .eh_frame) } |
| 123 | } |