[444] | 1 | /* |
---|
| 2 | |
---|
| 3 | Copyright (c) 2005,2008 Red Hat Incorporated. |
---|
| 4 | All rights reserved. |
---|
| 5 | |
---|
| 6 | Redistribution and use in source and binary forms, with or without |
---|
| 7 | modification, are permitted provided that the following conditions are met: |
---|
| 8 | |
---|
| 9 | Redistributions of source code must retain the above copyright |
---|
| 10 | notice, this list of conditions and the following disclaimer. |
---|
| 11 | |
---|
| 12 | Redistributions in binary form must reproduce the above copyright |
---|
| 13 | notice, this list of conditions and the following disclaimer in the |
---|
| 14 | documentation and/or other materials provided with the distribution. |
---|
| 15 | |
---|
| 16 | The name of Red Hat Incorporated may not be used to endorse |
---|
| 17 | or promote products derived from this software without specific |
---|
| 18 | prior written permission. |
---|
| 19 | |
---|
| 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
| 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
| 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
---|
| 23 | DISCLAIMED. IN NO EVENT SHALL RED HAT INCORPORATED BE LIABLE FOR ANY |
---|
| 24 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
---|
| 25 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
---|
| 26 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
---|
| 27 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
---|
| 28 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
---|
| 29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 30 | |
---|
| 31 | */ |
---|
| 32 | |
---|
| 33 | /* Default linker script, for normal executables */ |
---|
| 34 | OUTPUT_FORMAT("elf32-m32c", "elf32-m32c", |
---|
| 35 | "elf32-m32c") |
---|
| 36 | OUTPUT_ARCH(m32c) |
---|
| 37 | ENTRY(_start) |
---|
| 38 | INPUT(-lm32cgloss) |
---|
| 39 | /* Do we need any of these for elf? |
---|
| 40 | __DYNAMIC = 0; */ |
---|
| 41 | MEMORY { |
---|
| 42 | RAM (w) : ORIGIN = RAMSTART, LENGTH = RAMSIZE |
---|
| 43 | ROM (r) : ORIGIN = ROMSTART, LENGTH = ROMSIZE |
---|
| 44 | VEC (r) : ORIGIN = VECSTART, LENGTH = 32 |
---|
| 45 | RESETVEC (r) : ORIGIN = RESETSTART, LENGTH = 4 |
---|
| 46 | } |
---|
| 47 | SECTIONS |
---|
| 48 | { |
---|
| 49 | /* There are three cases we care about: First, RW data that must be |
---|
| 50 | in the low 64k. This will always be copied from ROM. Second, RO |
---|
| 51 | data that must be in the low 64k. This may be copied from ROM if |
---|
| 52 | the ROM is above 64k. Third, anything that does not need to be |
---|
| 53 | in the first 64k. Chips normally only have two memory regions; |
---|
| 54 | low ram and either high or low rom. We map the low rom needs |
---|
| 55 | into one of the actual regions. */ |
---|
| 56 | |
---|
| 57 | /* .text goes first so the rom image of ram data will follow it. */ |
---|
| 58 | .text : |
---|
| 59 | { |
---|
| 60 | *(.text .stub .text.* .gnu.linkonce.t.*) |
---|
| 61 | KEEP (*(.text.*personality*)) |
---|
| 62 | /* .gnu.warning sections are handled specially by elf32.em. */ |
---|
| 63 | *(.gnu.warning) |
---|
| 64 | *(.interp .hash .dynsym .dynstr .gnu.version*) |
---|
| 65 | PROVIDE (__etext = .); |
---|
| 66 | PROVIDE (_etext = .); |
---|
| 67 | PROVIDE (etext = .); |
---|
| 68 | . = ALIGN(2); |
---|
| 69 | PROVIDE(__romdatastart = .); /* IF_ROCOPY */ |
---|
| 70 | } > ROM =0 |
---|
| 71 | |
---|
| 72 | /* rodata will either be part of data, or will be in low rom. So we |
---|
| 73 | might be spanning it, or we might not. This lets us include it |
---|
| 74 | in our calculations when appropriate. */ |
---|
| 75 | |
---|
| 76 | .rodata : { |
---|
| 77 | . = ALIGN(2); |
---|
| 78 | PROVIDE(__datastart = .); /* IF_ROCOPY */ |
---|
| 79 | *(.plt) |
---|
| 80 | KEEP (*(.init)) |
---|
| 81 | KEEP (*(.fini)) |
---|
| 82 | *(.rodata .rodata.* .gnu.linkonce.r.*) |
---|
| 83 | *(.rodata1) |
---|
| 84 | *(.eh_frame_hdr) |
---|
| 85 | KEEP (*(.eh_frame)) |
---|
| 86 | KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) |
---|
| 87 | . = ALIGN(2); |
---|
| 88 | PROVIDE(__romdatastart = .); /* IF_ROROM */ |
---|
| 89 | } > LOWROM |
---|
| 90 | |
---|
| 91 | .data : { |
---|
| 92 | . = ALIGN(32 / 8); |
---|
| 93 | PROVIDE (__datastart = .); /* IF_ROROM */ |
---|
| 94 | PROVIDE (__preinit_array_start = .); |
---|
| 95 | KEEP (*(.preinit_array)) |
---|
| 96 | PROVIDE (__preinit_array_end = .); |
---|
| 97 | PROVIDE (__init_array_start = .); |
---|
| 98 | KEEP (*(.init_array)) |
---|
| 99 | PROVIDE (__init_array_end = .); |
---|
| 100 | PROVIDE (__fini_array_start = .); |
---|
| 101 | KEEP (*(.fini_array)) |
---|
| 102 | PROVIDE (__fini_array_end = .); |
---|
| 103 | |
---|
| 104 | /* gcc uses crtbegin.o to find the start of |
---|
| 105 | the constructors, so we make sure it is |
---|
| 106 | first. Because this is a wildcard, it |
---|
| 107 | doesn't matter if the user does not |
---|
| 108 | actually link against crtbegin.o; the |
---|
| 109 | linker won't look for a file to match a |
---|
| 110 | wildcard. The wildcard also means that it |
---|
| 111 | doesn't matter which directory crtbegin.o |
---|
| 112 | is in. */ |
---|
| 113 | KEEP (*crtbegin*.o(.ctors)) |
---|
| 114 | /* We don't want to include the .ctor section from |
---|
| 115 | from the crtend.o file until after the sorted ctors. |
---|
| 116 | The .ctor section from the crtend file contains the |
---|
| 117 | end of ctors marker and it must be last */ |
---|
| 118 | KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors)) |
---|
| 119 | KEEP (*(SORT(.ctors.*))) |
---|
| 120 | KEEP (*(.ctors)) |
---|
| 121 | |
---|
| 122 | KEEP (*crtbegin*.o(.dtors)) |
---|
| 123 | KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors)) |
---|
| 124 | KEEP (*(SORT(.dtors.*))) |
---|
| 125 | KEEP (*(.dtors)) |
---|
| 126 | |
---|
| 127 | KEEP (*(.jcr)) |
---|
| 128 | *(.data.rel.ro.local) *(.data.rel.ro*) |
---|
| 129 | *(.dynamic) |
---|
| 130 | |
---|
| 131 | *(.data .data.* .gnu.linkonce.d.*) |
---|
| 132 | KEEP (*(.gnu.linkonce.d.*personality*)) |
---|
| 133 | SORT(CONSTRUCTORS) |
---|
| 134 | *(.data1) |
---|
| 135 | *(.got.plt) *(.got) |
---|
| 136 | PROVIDE (__var_vect_start = .); |
---|
| 137 | *(.var_vects) |
---|
| 138 | |
---|
| 139 | . = ALIGN(2); |
---|
| 140 | _edata = .; |
---|
| 141 | PROVIDE (edata = .); |
---|
| 142 | PROVIDE (__dataend = .); |
---|
| 143 | } > RAM AT>ROM |
---|
| 144 | |
---|
| 145 | /* Note that __romdatacopysize may be ZERO for the simulator, which |
---|
| 146 | knows how to intialize RAM directly. It should ONLY be used for |
---|
| 147 | copying data from ROM to RAM; if you need to know the size of the |
---|
| 148 | data section, subtract the end symbol from the start symbol. */ |
---|
| 149 | /* Note that crt0 assumes this is even; all the start/stop symbols |
---|
| 150 | are also assumed word-aligned. */ |
---|
| 151 | PROVIDE (__romdatacopysize = SIZEOF(.rodata) + SIZEOF(.data)); |
---|
| 152 | |
---|
| 153 | .bss : { |
---|
| 154 | . = ALIGN(2); |
---|
| 155 | PROVIDE (__bssstart = .); |
---|
| 156 | *(.dynbss) |
---|
| 157 | *(.bss .bss.* .gnu.linkonce.b.*) |
---|
| 158 | *(COMMON) |
---|
| 159 | . = ALIGN(2); |
---|
| 160 | PROVIDE (__bssend = .); |
---|
| 161 | _end = .; |
---|
| 162 | PROVIDE (end = .); |
---|
| 163 | } > RAM |
---|
| 164 | PROVIDE (__bsssize = SIZEOF(.bss)); |
---|
| 165 | |
---|
| 166 | .stack (RAMSTART + RAMSIZE - 2) : |
---|
| 167 | { |
---|
| 168 | PROVIDE (__stack = .); |
---|
| 169 | *(.stack) |
---|
| 170 | } |
---|
| 171 | |
---|
| 172 | .vec : { |
---|
| 173 | *(.vec) |
---|
| 174 | } > VEC |
---|
| 175 | .resetvec : { |
---|
| 176 | *(.resetvec) |
---|
| 177 | } > RESETVEC |
---|
| 178 | |
---|
| 179 | /* The rest are all not normally part of the runtime image. */ |
---|
| 180 | |
---|
| 181 | /* Stabs debugging sections. */ |
---|
| 182 | .stab 0 : { *(.stab) } |
---|
| 183 | .stabstr 0 : { *(.stabstr) } |
---|
| 184 | .stab.excl 0 : { *(.stab.excl) } |
---|
| 185 | .stab.exclstr 0 : { *(.stab.exclstr) } |
---|
| 186 | .stab.index 0 : { *(.stab.index) } |
---|
| 187 | .stab.indexstr 0 : { *(.stab.indexstr) } |
---|
| 188 | .comment 0 : { *(.comment) } |
---|
| 189 | /* DWARF debug sections. |
---|
| 190 | Symbols in the DWARF debugging sections are relative to the beginning |
---|
| 191 | of the section so we begin them at 0. */ |
---|
| 192 | /* DWARF 1 */ |
---|
| 193 | .debug 0 : { *(.debug) } |
---|
| 194 | .line 0 : { *(.line) } |
---|
| 195 | /* GNU DWARF 1 extensions */ |
---|
| 196 | .debug_srcinfo 0 : { *(.debug_srcinfo) } |
---|
| 197 | .debug_sfnames 0 : { *(.debug_sfnames) } |
---|
| 198 | /* DWARF 1.1 and DWARF 2 */ |
---|
| 199 | .debug_aranges 0 : { *(.debug_aranges) } |
---|
| 200 | .debug_pubnames 0 : { *(.debug_pubnames) } |
---|
| 201 | /* DWARF 2 */ |
---|
| 202 | .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } |
---|
| 203 | .debug_abbrev 0 : { *(.debug_abbrev) } |
---|
| 204 | .debug_line 0 : { *(.debug_line) } |
---|
| 205 | .debug_frame 0 : { *(.debug_frame) } |
---|
| 206 | .debug_str 0 : { *(.debug_str) } |
---|
| 207 | .debug_loc 0 : { *(.debug_loc) } |
---|
| 208 | .debug_macinfo 0 : { *(.debug_macinfo) } |
---|
| 209 | /* SGI/MIPS DWARF 2 extensions */ |
---|
| 210 | .debug_weaknames 0 : { *(.debug_weaknames) } |
---|
| 211 | .debug_funcnames 0 : { *(.debug_funcnames) } |
---|
| 212 | .debug_typenames 0 : { *(.debug_typenames) } |
---|
| 213 | .debug_varnames 0 : { *(.debug_varnames) } |
---|
| 214 | /DISCARD/ : { *(.note.GNU-stack) } |
---|
| 215 | } |
---|