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