| 1 | /* |
|---|
| 2 | * Default linker script for moxiebox. |
|---|
| 3 | * |
|---|
| 4 | * Copyright (C) 2014 Anthony Green |
|---|
| 5 | * |
|---|
| 6 | * The authors hereby grant permission to use, copy, modify, |
|---|
| 7 | * distribute, and license this software and its documentation for any |
|---|
| 8 | * purpose, provided that existing copyright notices are retained in |
|---|
| 9 | * all copies and that this notice is included verbatim in any |
|---|
| 10 | * distributions. No written agreement, license, or royalty fee is |
|---|
| 11 | * required for any of the authorized uses. Modifications to this |
|---|
| 12 | * software may be copyrighted by their authors and need not follow |
|---|
| 13 | * the licensing terms described here, provided that the new terms are |
|---|
| 14 | * clearly indicated on the first page of each file where they apply. |
|---|
| 15 | */ |
|---|
| 16 | |
|---|
| 17 | OUTPUT_FORMAT("elf32-littlemoxie") |
|---|
| 18 | OUTPUT_ARCH(moxie) |
|---|
| 19 | ENTRY(_start) |
|---|
| 20 | SECTIONS |
|---|
| 21 | { |
|---|
| 22 | /* Read-only sections, merged into text segment: */ |
|---|
| 23 | . = 0x00001000; |
|---|
| 24 | .interp : { *(.interp) } |
|---|
| 25 | .hash : { *(.hash) } |
|---|
| 26 | .dynsym : { *(.dynsym) } |
|---|
| 27 | .dynstr : { *(.dynstr) } |
|---|
| 28 | .gnu.version : { *(.gnu.version) } |
|---|
| 29 | .gnu.version_d : { *(.gnu.version_d) } |
|---|
| 30 | .gnu.version_r : { *(.gnu.version_r) } |
|---|
| 31 | .rel.init : { *(.rel.init) } |
|---|
| 32 | .rela.init : { *(.rela.init) } |
|---|
| 33 | .rel.text : |
|---|
| 34 | { |
|---|
| 35 | *(.rel.text) |
|---|
| 36 | *(.rel.text.*) |
|---|
| 37 | *(.rel.gnu.linkonce.t*) |
|---|
| 38 | } |
|---|
| 39 | .rela.text : |
|---|
| 40 | { |
|---|
| 41 | *(.rela.text) |
|---|
| 42 | *(.rela.text.*) |
|---|
| 43 | *(.rela.gnu.linkonce.t*) |
|---|
| 44 | } |
|---|
| 45 | .rel.fini : { *(.rel.fini) } |
|---|
| 46 | .rela.fini : { *(.rela.fini) } |
|---|
| 47 | .rel.rodata : |
|---|
| 48 | { |
|---|
| 49 | *(.rel.rodata) |
|---|
| 50 | *(.rel.rodata.*) |
|---|
| 51 | *(.rel.gnu.linkonce.r*) |
|---|
| 52 | } |
|---|
| 53 | .rela.rodata : |
|---|
| 54 | { |
|---|
| 55 | *(.rela.rodata) |
|---|
| 56 | *(.rela.rodata.*) |
|---|
| 57 | *(.rela.gnu.linkonce.r*) |
|---|
| 58 | } |
|---|
| 59 | .rel.data : |
|---|
| 60 | { |
|---|
| 61 | *(.rel.data) |
|---|
| 62 | *(.rel.data.*) |
|---|
| 63 | *(.rel.gnu.linkonce.d*) |
|---|
| 64 | } |
|---|
| 65 | .rela.data : |
|---|
| 66 | { |
|---|
| 67 | *(.rela.data) |
|---|
| 68 | *(.rela.data.*) |
|---|
| 69 | *(.rela.gnu.linkonce.d*) |
|---|
| 70 | } |
|---|
| 71 | .rel.ctors : { *(.rel.ctors) } |
|---|
| 72 | .rela.ctors : { *(.rela.ctors) } |
|---|
| 73 | .rel.dtors : { *(.rel.dtors) } |
|---|
| 74 | .rela.dtors : { *(.rela.dtors) } |
|---|
| 75 | .rel.got : { *(.rel.got) } |
|---|
| 76 | .rela.got : { *(.rela.got) } |
|---|
| 77 | .rel.sdata : |
|---|
| 78 | { |
|---|
| 79 | *(.rel.sdata) |
|---|
| 80 | *(.rel.sdata.*) |
|---|
| 81 | *(.rel.gnu.linkonce.s*) |
|---|
| 82 | } |
|---|
| 83 | .rela.sdata : |
|---|
| 84 | { |
|---|
| 85 | *(.rela.sdata) |
|---|
| 86 | *(.rela.sdata.*) |
|---|
| 87 | *(.rela.gnu.linkonce.s*) |
|---|
| 88 | } |
|---|
| 89 | .rel.sbss : { *(.rel.sbss) } |
|---|
| 90 | .rela.sbss : { *(.rela.sbss) } |
|---|
| 91 | .rel.bss : { *(.rel.bss) } |
|---|
| 92 | .rela.bss : { *(.rela.bss) } |
|---|
| 93 | .rel.plt : { *(.rel.plt) } |
|---|
| 94 | .rela.plt : { *(.rela.plt) } |
|---|
| 95 | .plt : { *(.plt) } |
|---|
| 96 | .text : |
|---|
| 97 | { |
|---|
| 98 | *(.text) |
|---|
| 99 | *(.text.*) |
|---|
| 100 | *(.stub) |
|---|
| 101 | /* .gnu.warning sections are handled specially by elf32.em. */ |
|---|
| 102 | *(.gnu.warning) |
|---|
| 103 | *(.gnu.linkonce.t*) |
|---|
| 104 | *(.glue_7t) *(.glue_7) |
|---|
| 105 | } =0 |
|---|
| 106 | .init : |
|---|
| 107 | { |
|---|
| 108 | KEEP (*(.init)) |
|---|
| 109 | } =0 |
|---|
| 110 | _etext = .; |
|---|
| 111 | PROVIDE (etext = .); |
|---|
| 112 | .fini : |
|---|
| 113 | { |
|---|
| 114 | KEEP (*(.fini)) |
|---|
| 115 | } =0 |
|---|
| 116 | .rodata : { *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) } |
|---|
| 117 | .rodata1 : { *(.rodata1) } |
|---|
| 118 | .eh_frame_hdr : { *(.eh_frame_hdr) } |
|---|
| 119 | /* Adjust the address for the data segment. We want to adjust up to |
|---|
| 120 | the same address within the page on the next page up. */ |
|---|
| 121 | . = ALIGN(256) + (. & (256 - 1)); |
|---|
| 122 | .data : |
|---|
| 123 | { |
|---|
| 124 | *(.data) |
|---|
| 125 | *(.data.*) |
|---|
| 126 | *(.gnu.linkonce.d*) |
|---|
| 127 | SORT(CONSTRUCTORS) |
|---|
| 128 | } |
|---|
| 129 | .data1 : { *(.data1) } |
|---|
| 130 | .eh_frame : { KEEP (*(.eh_frame)) } |
|---|
| 131 | .gcc_except_table : { *(.gcc_except_table) } |
|---|
| 132 | .ctors : |
|---|
| 133 | { |
|---|
| 134 | /* gcc uses crtbegin.o to find the start of |
|---|
| 135 | the constructors, so we make sure it is |
|---|
| 136 | first. Because this is a wildcard, it |
|---|
| 137 | doesn't matter if the user does not |
|---|
| 138 | actually link against crtbegin.o; the |
|---|
| 139 | linker won't look for a file to match a |
|---|
| 140 | wildcard. The wildcard also means that it |
|---|
| 141 | doesn't matter which directory crtbegin.o |
|---|
| 142 | is in. */ |
|---|
| 143 | KEEP (*crtbegin.o(.ctors)) |
|---|
| 144 | /* We don't want to include the .ctor section from |
|---|
| 145 | from the crtend.o file until after the sorted ctors. |
|---|
| 146 | The .ctor section from the crtend file contains the |
|---|
| 147 | end of ctors marker and it must be last */ |
|---|
| 148 | KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors)) |
|---|
| 149 | KEEP (*(SORT(.ctors.*))) |
|---|
| 150 | KEEP (*(.ctors)) |
|---|
| 151 | } |
|---|
| 152 | .dtors : |
|---|
| 153 | { |
|---|
| 154 | KEEP (*crtbegin.o(.dtors)) |
|---|
| 155 | KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors)) |
|---|
| 156 | KEEP (*(SORT(.dtors.*))) |
|---|
| 157 | KEEP (*(.dtors)) |
|---|
| 158 | } |
|---|
| 159 | .jcr : { KEEP (*(.jcr)) } |
|---|
| 160 | .got : { *(.got.plt) *(.got) } |
|---|
| 161 | .dynamic : { *(.dynamic) } |
|---|
| 162 | /* We want the small data sections together, so single-instruction offsets |
|---|
| 163 | can access them all, and initialized data all before uninitialized, so |
|---|
| 164 | we can shorten the on-disk segment size. */ |
|---|
| 165 | .sdata : |
|---|
| 166 | { |
|---|
| 167 | *(.sdata) |
|---|
| 168 | *(.sdata.*) |
|---|
| 169 | *(.gnu.linkonce.s.*) |
|---|
| 170 | } |
|---|
| 171 | _edata = .; |
|---|
| 172 | PROVIDE (edata = .); |
|---|
| 173 | __bss_start = .; |
|---|
| 174 | __bss_start__ = .; |
|---|
| 175 | .sbss : |
|---|
| 176 | { |
|---|
| 177 | *(.dynsbss) |
|---|
| 178 | *(.sbss) |
|---|
| 179 | *(.sbss.*) |
|---|
| 180 | *(.scommon) |
|---|
| 181 | } |
|---|
| 182 | .bss : |
|---|
| 183 | { |
|---|
| 184 | *(.dynbss) |
|---|
| 185 | *(.bss) |
|---|
| 186 | *(.bss.*) |
|---|
| 187 | *(COMMON) |
|---|
| 188 | /* Align here to ensure that the .bss section occupies space up to |
|---|
| 189 | _end. Align after .bss to ensure correct alignment even if the |
|---|
| 190 | .bss section disappears because there are no input sections. */ |
|---|
| 191 | . = ALIGN(32 / 8); |
|---|
| 192 | } |
|---|
| 193 | . = ALIGN(32 / 8); |
|---|
| 194 | _end = .; |
|---|
| 195 | _bss_end__ = . ; __bss_end__ = . ; __end__ = . ; |
|---|
| 196 | PROVIDE (end = .); |
|---|
| 197 | /* Stabs debugging sections. */ |
|---|
| 198 | .stab 0 : { *(.stab) } |
|---|
| 199 | .stabstr 0 : { *(.stabstr) } |
|---|
| 200 | .stab.excl 0 : { *(.stab.excl) } |
|---|
| 201 | .stab.exclstr 0 : { *(.stab.exclstr) } |
|---|
| 202 | .stab.index 0 : { *(.stab.index) } |
|---|
| 203 | .stab.indexstr 0 : { *(.stab.indexstr) } |
|---|
| 204 | .comment 0 : { *(.comment) } |
|---|
| 205 | /* DWARF debug sections. |
|---|
| 206 | Symbols in the DWARF debugging sections are relative to the beginning |
|---|
| 207 | of the section so we begin them at 0. */ |
|---|
| 208 | /* DWARF 1 */ |
|---|
| 209 | .debug 0 : { *(.debug) } |
|---|
| 210 | .line 0 : { *(.line) } |
|---|
| 211 | /* GNU DWARF 1 extensions */ |
|---|
| 212 | .debug_srcinfo 0 : { *(.debug_srcinfo) } |
|---|
| 213 | .debug_sfnames 0 : { *(.debug_sfnames) } |
|---|
| 214 | /* DWARF 1.1 and DWARF 2 */ |
|---|
| 215 | .debug_aranges 0 : { *(.debug_aranges) } |
|---|
| 216 | .debug_pubnames 0 : { *(.debug_pubnames) } |
|---|
| 217 | /* DWARF 2 */ |
|---|
| 218 | .debug_info 0 : { *(.debug_info) } |
|---|
| 219 | .debug_abbrev 0 : { *(.debug_abbrev) } |
|---|
| 220 | .debug_line 0 : { *(.debug_line) } |
|---|
| 221 | .debug_frame 0 : { *(.debug_frame) } |
|---|
| 222 | .debug_str 0 : { *(.debug_str) } |
|---|
| 223 | .debug_loc 0 : { *(.debug_loc) } |
|---|
| 224 | .debug_macinfo 0 : { *(.debug_macinfo) } |
|---|
| 225 | .debug_ranges 0 : { *(.debug_ranges) } |
|---|
| 226 | /* SGI/MIPS DWARF 2 extensions */ |
|---|
| 227 | .debug_weaknames 0 : { *(.debug_weaknames) } |
|---|
| 228 | .debug_funcnames 0 : { *(.debug_funcnames) } |
|---|
| 229 | .debug_typenames 0 : { *(.debug_typenames) } |
|---|
| 230 | .debug_varnames 0 : { *(.debug_varnames) } |
|---|
| 231 | /* These must appear regardless of . */ |
|---|
| 232 | } |
|---|