1/* Linker script for ARM M-profile Simulator 2 * 3 * Version: Sourcery CodeBench Lite 2013.11-24 4 * Support: https://sourcery.mentor.com/GNUToolchain/ 5 * 6 * Copyright (c) 2007-2010 CodeSourcery, Inc. 7 * Copyright (c) 2010-2013 Mentor Graphics, Inc. 8 * 9 * The authors hereby grant permission to use, copy, modify, distribute, 10 * and license this software and its documentation for any purpose, provided 11 * that existing copyright notices are retained in all copies and that this 12 * notice is included verbatim in any distributions. No written agreement, 13 * license, or royalty fee is required for any of the authorized uses. 14 * Modifications to this software may be copyrighted by their authors 15 * and need not follow the licensing terms described here, provided that 16 * the new terms are clearly indicated on the first page of each file where 17 * they apply. 18 */ 19OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") 20ENTRY(__cs3_reset) 21SEARCH_DIR(.) 22GROUP(-lgcc -lc -lcs3 -lcs3hosted -lcs3micro) 23 24MEMORY 25{ 26 ram (rwx) : ORIGIN = 0x0, LENGTH = 128M 27} 28 29/* These force the linker to search for particular symbols from 30 * the start of the link process and thus ensure the user's 31 * overrides are picked up 32 */ 33EXTERN(__cs3_reset __cs3_reset_generic_m) 34EXTERN(__cs3_start_asm __cs3_start_asm_sim) 35/* Bring in the interrupt routines & vector */ 36INCLUDE micro-names.inc 37EXTERN(__cs3_interrupt_vector_micro) 38EXTERN(__cs3_start_c main __cs3_stack __cs3_heap_end) 39/* force exit to be picked up in a hosted or os environment */ 40EXTERN(exit atexit) 41 42/* Provide fall-back values */ 43PROVIDE(__cs3_heap_start = _end); 44PROVIDE(__cs3_heap_end = __cs3_region_start_ram + __cs3_region_size_ram); 45PROVIDE(__cs3_region_num = (__cs3_regions_end - __cs3_regions) / 20); 46/* Ensure that newlib runs the finalizers */ 47__libc_fini = _fini; 48PROVIDE(__cs3_stack = __cs3_region_start_ram + __cs3_region_size_ram); 49 50SECTIONS 51{ 52 .text : 53 { 54 CREATE_OBJECT_SYMBOLS 55 __cs3_region_start_ram = .; 56 _ftext = .; 57 *(.cs3.region-head.ram) 58 __cs3_interrupt_vector = __cs3_interrupt_vector_micro; 59 *(.cs3.interrupt_vector) 60 /* Make sure we pulled in an interrupt vector. */ 61 ASSERT (. != __cs3_interrupt_vector_micro, "No interrupt vector"); 62 63 PROVIDE(__cs3_reset = __cs3_reset_generic_m); 64 *(.cs3.reset) 65 __cs3_start_asm_sim = DEFINED(__cs3_start_asm) ? __cs3_start_asm : __cs3_start_asm_sim; 66 67 *(.text.cs3.init) 68 *(.text .text.* .gnu.linkonce.t.*) 69 *(.plt) 70 *(.gnu.warning) 71 *(.glue_7t) *(.glue_7) *(.vfp11_veneer) 72 73 *(.ARM.extab* .gnu.linkonce.armextab.*) 74 *(.gcc_except_table) 75 } >ram 76 .eh_frame_hdr : ALIGN (4) 77 { 78 KEEP (*(.eh_frame_hdr)) 79 *(.eh_frame_entry .eh_frame_entry.*) 80 } >ram 81 .eh_frame : ALIGN (4) 82 { 83 KEEP (*(.eh_frame)) *(.eh_frame.*) 84 } >ram 85 /* .ARM.exidx is sorted, so has to go in its own output section. */ 86 PROVIDE_HIDDEN (__exidx_start = .); 87 .ARM.exidx : 88 { 89 *(.ARM.exidx* .gnu.linkonce.armexidx.*) 90 } >ram 91 PROVIDE_HIDDEN (__exidx_end = .); 92 .rodata : ALIGN (4) 93 { 94 *(.rodata .rodata.* .gnu.linkonce.r.*) 95 96 . = ALIGN(4); 97 KEEP(*(.init)) 98 99 . = ALIGN(4); 100 __preinit_array_start = .; 101 KEEP (*(.preinit_array)) 102 __preinit_array_end = .; 103 104 . = ALIGN(4); 105 __init_array_start = .; 106 KEEP (*(SORT(.init_array.*))) 107 KEEP (*(.init_array)) 108 __init_array_end = .; 109 110 . = ALIGN(4); 111 KEEP(*(.fini)) 112 113 . = ALIGN(4); 114 __fini_array_start = .; 115 KEEP (*(.fini_array)) 116 KEEP (*(SORT(.fini_array.*))) 117 __fini_array_end = .; 118 119 . = ALIGN(0x4); 120 KEEP (*crtbegin.o(.ctors)) 121 KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) 122 KEEP (*(SORT(.ctors.*))) 123 KEEP (*crtend.o(.ctors)) 124 125 . = ALIGN(0x4); 126 KEEP (*crtbegin.o(.dtors)) 127 KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) 128 KEEP (*(SORT(.dtors.*))) 129 KEEP (*crtend.o(.dtors)) 130 131 . = ALIGN(4); 132 __cs3_regions = .; 133 LONG (0) 134 LONG (__cs3_region_init_ram) 135 LONG (__cs3_region_start_ram) 136 LONG (__cs3_region_init_size_ram) 137 LONG (__cs3_region_zero_size_ram) 138 __cs3_regions_end = .; 139 . = ALIGN (8); 140 _etext = .; 141 } >ram 142 143 ASSERT (!(__cs3_region_init_ram & 7), "__cs3_region_init_ram not aligned") 144 ASSERT (!(__cs3_region_start_ram & 7), "__cs3_region_start_ram not aligned") 145 ASSERT (!(__cs3_region_init_size_ram & 7), "__cs3_region_init_size_ram not aligned") 146 ASSERT (!(__cs3_region_zero_size_ram & 7), "__cs3_region_zero_size_ram not aligned") 147 .data : ALIGN (8) 148 { 149 KEEP(*(.jcr)) 150 *(.got.plt) *(.got) 151 *(.shdata) 152 *(.data .data.* .gnu.linkonce.d.*) 153 . = ALIGN (8); 154 *(.ram) 155 . = ALIGN (8); 156 _edata = .; 157 } >ram 158 .bss : ALIGN (8) 159 { 160 *(.shbss) 161 *(.bss .bss.* .gnu.linkonce.b.*) 162 *(COMMON) 163 . = ALIGN (8); 164 *(.ram.b .bss.ram) 165 . = ALIGN (8); 166 _end = .; 167 __end = .; 168 } >ram 169 __cs3_region_init_ram = __cs3_region_start_ram; 170 __cs3_region_init_size_ram = _edata - __cs3_region_start_ram; 171 __cs3_region_zero_size_ram = _end - _edata; 172 /* Default to 1M of heap */ 173 __cs3_region_size_ram = ALIGN (1024) - __cs3_region_start_ram + 1M; 174 175 .stab 0 (NOLOAD) : { *(.stab) } 176 .stabstr 0 (NOLOAD) : { *(.stabstr) } 177 /* DWARF debug sections. 178 * Symbols in the DWARF debugging sections are relative to 179 * the beginning of the section so we begin them at 0. 180 */ 181 /* DWARF 1 */ 182 .debug 0 : { *(.debug) } 183 .line 0 : { *(.line) } 184 /* GNU DWARF 1 extensions */ 185 .debug_srcinfo 0 : { *(.debug_srcinfo) } 186 .debug_sfnames 0 : { *(.debug_sfnames) } 187 /* DWARF 1.1 and DWARF 2 */ 188 .debug_aranges 0 : { *(.debug_aranges) } 189 .debug_pubnames 0 : { *(.debug_pubnames) } 190 /* DWARF 2 */ 191 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } 192 .debug_abbrev 0 : { *(.debug_abbrev) } 193 .debug_line 0 : { *(.debug_line) } 194 .debug_frame 0 : { *(.debug_frame) } 195 .debug_str 0 : { *(.debug_str) } 196 .debug_loc 0 : { *(.debug_loc) } 197 .debug_macinfo 0 : { *(.debug_macinfo) } 198 /* DWARF 2.1 */ 199 .debug_ranges 0 : { *(.debug_ranges) } 200 /* SGI/MIPS DWARF 2 extensions */ 201 .debug_weaknames 0 : { *(.debug_weaknames) } 202 .debug_funcnames 0 : { *(.debug_funcnames) } 203 .debug_typenames 0 : { *(.debug_typenames) } 204 .debug_varnames 0 : { *(.debug_varnames) } 205 206 .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) } 207 .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) } 208 /DISCARD/ : { *(.note.GNU-stack) } 209} 210/* checksum: e4ec294781e78972a3d6d146a21 */ 211