[96462044] | 1 | /* |
---|
| 2 | * This file contains GNU linker directives for an general SH4 |
---|
| 3 | * board. |
---|
| 4 | * |
---|
| 5 | * Variations in memory size and allocation can be made by |
---|
| 6 | * overriding some values with linker command-line arguments. |
---|
| 7 | * |
---|
| 8 | * Copyright (C) 2000 OKTET Ltd., St.-Petersburg, Russia |
---|
| 9 | * Author: Victor V. Vengerov <vvv@oktet.ru> |
---|
| 10 | * |
---|
| 11 | * The license and distribution terms for this file may be |
---|
| 12 | * found in the file LICENSE in this distribution or at |
---|
| 13 | * |
---|
| 14 | * http://www.OARcorp.com/rtems/license.html. |
---|
| 15 | * |
---|
| 16 | * $Id$ |
---|
| 17 | */ |
---|
| 18 | |
---|
| 19 | |
---|
| 20 | OUTPUT_FORMAT("elf32-shl", "elf32-shl", |
---|
| 21 | "elf32-shl") |
---|
| 22 | OUTPUT_ARCH(sh) |
---|
| 23 | ENTRY(_start) |
---|
| 24 | /* Do we need any of these for elf? |
---|
| 25 | __DYNAMIC = 0; */ |
---|
| 26 | |
---|
| 27 | _HeapSize = DEFINED(_HeapSize) ? _HeapSize : (2 * 1024 * 1024); |
---|
| 28 | _WorkspaceSize = DEFINED(_WorkspaceSize) ? _WorkspaceSize : (1024 * 1024); |
---|
| 29 | |
---|
| 30 | /* |
---|
| 31 | * Area assignments: |
---|
| 32 | * Area 0: Flash memory, SRAM interface |
---|
| 33 | * Area 1: GDC |
---|
| 34 | * Area 2: SDRAM |
---|
| 35 | * Area 3-6: unused |
---|
| 36 | */ |
---|
| 37 | MEMORY |
---|
| 38 | { |
---|
| 39 | /* |
---|
| 40 | * Real values |
---|
| 41 | */ |
---|
| 42 | ram : o = 0x88000000, l = 8M |
---|
| 43 | rom : o = 0x80000000, l = 4M |
---|
| 44 | /* |
---|
| 45 | * Fake values to test from gdb |
---|
| 46 | */ |
---|
| 47 | /* |
---|
| 48 | ram : o = 0x88100000, l = 4M |
---|
| 49 | rom : o = 0x88500000, l = 3M |
---|
| 50 | */ |
---|
| 51 | } |
---|
| 52 | |
---|
| 53 | SECTIONS |
---|
| 54 | { |
---|
| 55 | /* Read-only sections, merged into text segment: */ |
---|
| 56 | .init : |
---|
| 57 | { |
---|
| 58 | KEEP (*(.init)) |
---|
| 59 | } =0 |
---|
| 60 | .text : |
---|
| 61 | { |
---|
| 62 | *(.text) |
---|
| 63 | *(.text.*) |
---|
| 64 | /* .gnu.warning sections are handled specially by elf32.em. */ |
---|
| 65 | *(.gnu.warning) |
---|
| 66 | *(.gnu.linkonce.t*) |
---|
| 67 | } > rom |
---|
| 68 | _etext = .; |
---|
| 69 | PROVIDE (etext = .); |
---|
| 70 | .fini : |
---|
| 71 | { |
---|
| 72 | KEEP (*(.fini)) |
---|
| 73 | } =0 |
---|
| 74 | .rodata : |
---|
| 75 | { |
---|
| 76 | *(.rodata) |
---|
| 77 | *(.rodata.*) |
---|
| 78 | *(.gnu.linkonce.r*) |
---|
| 79 | . = ALIGN(32); |
---|
| 80 | } > rom |
---|
| 81 | .ctors : |
---|
| 82 | { |
---|
| 83 | ___ctors = .; |
---|
| 84 | /* gcc uses crtbegin.o to find the start of |
---|
| 85 | the constructors, so we make sure it is |
---|
| 86 | first. Because this is a wildcard, it |
---|
| 87 | doesn't matter if the user does not |
---|
| 88 | actually link against crtbegin.o; the |
---|
| 89 | linker won't look for a file to match a |
---|
| 90 | wildcard. The wildcard also means that it |
---|
| 91 | doesn't matter which directory crtbegin.o |
---|
| 92 | is in. */ |
---|
| 93 | KEEP (*crtbegin.o(.ctors)) |
---|
| 94 | /* We don't want to include the .ctor section from |
---|
| 95 | from the crtend.o file until after the sorted ctors. |
---|
| 96 | The .ctor section from the crtend file contains the |
---|
| 97 | end of ctors marker and it must be last */ |
---|
| 98 | KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors)) |
---|
| 99 | KEEP (*(SORT(.ctors.*))) |
---|
| 100 | KEEP (*(.ctors)) |
---|
| 101 | ___ctors_end = .; |
---|
| 102 | } > rom |
---|
| 103 | .dtors : |
---|
| 104 | { |
---|
| 105 | ___dtors = .; |
---|
| 106 | KEEP (*crtbegin.o(.dtors)) |
---|
| 107 | KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors)) |
---|
| 108 | KEEP (*(SORT(.dtors.*))) |
---|
| 109 | KEEP (*(.dtors)) |
---|
| 110 | ___dtors_end = .; |
---|
| 111 | copy_start_in_rom = .; |
---|
| 112 | } > rom |
---|
| 113 | |
---|
| 114 | /* Adjust the address for the data segment. We want to adjust up to |
---|
| 115 | the same address within the page on the next page up. */ |
---|
| 116 | . = ALIGN(128) + (. & (128 - 1)); |
---|
| 117 | .data : AT(LOADADDR(.dtors) + SIZEOF(.dtors)) |
---|
| 118 | { |
---|
| 119 | copy_start = .; |
---|
| 120 | *(.data) |
---|
| 121 | *(.data.*) |
---|
| 122 | *(.gnu.linkonce.d*) |
---|
| 123 | SORT(CONSTRUCTORS) |
---|
| 124 | copy_end = .; |
---|
| 125 | } > ram |
---|
| 126 | .eh_frame : { *(.eh_frame) } > ram |
---|
| 127 | /* We want the small data sections together, so single-instruction offsets |
---|
| 128 | can access them all, and initialized data all before uninitialized, so |
---|
| 129 | we can shorten the on-disk segment size. */ |
---|
| 130 | .bss : |
---|
| 131 | { |
---|
| 132 | __bss_start = .; |
---|
| 133 | *(.dynbss) |
---|
| 134 | *(.bss) |
---|
| 135 | *(.bss.*) |
---|
| 136 | *(COMMON) |
---|
| 137 | /* Align here to ensure that the .bss section occupies space up to |
---|
| 138 | _end. Align after .bss to ensure correct alignment even if the |
---|
| 139 | .bss section disappears because there are no input sections. */ |
---|
| 140 | . = ALIGN(32 / 8); |
---|
| 141 | __bss_end = .; |
---|
| 142 | } > ram |
---|
| 143 | |
---|
| 144 | . = ALIGN(16); |
---|
| 145 | _HeapStart = . ; |
---|
| 146 | . = . + _HeapSize ; |
---|
| 147 | PROVIDE( _HeapEnd = . ); |
---|
| 148 | |
---|
| 149 | . = ALIGN(16); |
---|
| 150 | _WorkSpaceStart = . ; |
---|
| 151 | . = . + _WorkspaceSize ; |
---|
| 152 | PROVIDE(_WorkSpaceEnd = .); |
---|
| 153 | |
---|
| 154 | . = ALIGN(16); |
---|
| 155 | .stack . : { |
---|
| 156 | stack_start = .; |
---|
| 157 | . = . + 4096; |
---|
| 158 | stack_end = .; |
---|
| 159 | } |
---|
| 160 | |
---|
| 161 | . = ALIGN(16); |
---|
| 162 | _CPU_Interrupt_stack_low = . ; |
---|
| 163 | _CPU_Interrupt_stack_high = _CPU_Interrupt_stack_low + 4096 ; |
---|
| 164 | |
---|
| 165 | /* Stabs debugging sections. */ |
---|
| 166 | .stab 0 : { *(.stab) } |
---|
| 167 | .stabstr 0 : { *(.stabstr) } |
---|
| 168 | .stab.excl 0 : { *(.stab.excl) } |
---|
| 169 | .stab.exclstr 0 : { *(.stab.exclstr) } |
---|
| 170 | .stab.index 0 : { *(.stab.index) } |
---|
| 171 | .stab.indexstr 0 : { *(.stab.indexstr) } |
---|
| 172 | .comment 0 : { *(.comment) } |
---|
| 173 | /* DWARF debug sections. |
---|
| 174 | Symbols in the DWARF debugging sections are relative to the beginning |
---|
| 175 | of the section so we begin them at 0. */ |
---|
| 176 | /* DWARF 1 */ |
---|
| 177 | .debug 0 : { *(.debug) } |
---|
| 178 | .line 0 : { *(.line) } |
---|
| 179 | /* GNU DWARF 1 extensions */ |
---|
| 180 | .debug_srcinfo 0 : { *(.debug_srcinfo) } |
---|
| 181 | .debug_sfnames 0 : { *(.debug_sfnames) } |
---|
| 182 | /* DWARF 1.1 and DWARF 2 */ |
---|
| 183 | .debug_aranges 0 : { *(.debug_aranges) } |
---|
| 184 | .debug_pubnames 0 : { *(.debug_pubnames) } |
---|
| 185 | /* DWARF 2 */ |
---|
| 186 | .debug_info 0 : { *(.debug_info) } |
---|
| 187 | .debug_abbrev 0 : { *(.debug_abbrev) } |
---|
| 188 | .debug_line 0 : { *(.debug_line) } |
---|
| 189 | .debug_frame 0 : { *(.debug_frame) } |
---|
| 190 | .debug_str 0 : { *(.debug_str) } |
---|
| 191 | .debug_loc 0 : { *(.debug_loc) } |
---|
| 192 | .debug_macinfo 0 : { *(.debug_macinfo) } |
---|
| 193 | /* SGI/MIPS DWARF 2 extensions */ |
---|
| 194 | .debug_weaknames 0 : { *(.debug_weaknames) } |
---|
| 195 | .debug_funcnames 0 : { *(.debug_funcnames) } |
---|
| 196 | .debug_typenames 0 : { *(.debug_typenames) } |
---|
| 197 | .debug_varnames 0 : { *(.debug_varnames) } |
---|
| 198 | .stack : { _stack = .; *(.stack) } |
---|
| 199 | /* These must appear regardless of . */ |
---|
| 200 | } |
---|