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