1/* Linker script for ARM 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 -lcs3arm) 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) 34EXTERN(__cs3_start_asm __cs3_start_asm_sim) 35/* Bring in the interrupt routines & vector */ 36INCLUDE arm-names.inc 37EXTERN(__cs3_interrupt_vector_arm) 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 ASSERT (. == __cs3_region_start_ram, ".cs3.region-head.ram not permitted"); 59 __cs3_interrupt_vector = __cs3_interrupt_vector_arm; 60 *(.cs3.interrupt_vector) 61 /* Make sure we pulled in an interrupt vector. */ 62 ASSERT (. != __cs3_interrupt_vector_arm, "No interrupt vector"); 63 64 PROVIDE(__cs3_reset = __cs3_reset_generic); 65 *(.cs3.reset) 66 __cs3_start_asm_sim = DEFINED(__cs3_start_asm) ? __cs3_start_asm : __cs3_start_asm_sim; 67 68 *(.text.cs3.init) 69 *(.text .text.* .gnu.linkonce.t.*) 70 *(.plt) 71 *(.gnu.warning) 72 *(.glue_7t) *(.glue_7) *(.vfp11_veneer) 73 74 *(.ARM.extab* .gnu.linkonce.armextab.*) 75 *(.gcc_except_table) 76 } >ram 77 .eh_frame_hdr : ALIGN (4) 78 { 79 KEEP (*(.eh_frame_hdr)) 80 *(.eh_frame_entry .eh_frame_entry.*) 81 } >ram 82 .eh_frame : ALIGN (4) 83 { 84 KEEP (*(.eh_frame)) *(.eh_frame.*) 85 } >ram 86 /* .ARM.exidx is sorted, so has to go in its own output section. */ 87 PROVIDE_HIDDEN (__exidx_start = .); 88 .ARM.exidx : 89 { 90 *(.ARM.exidx* .gnu.linkonce.armexidx.*) 91 } >ram 92 PROVIDE_HIDDEN (__exidx_end = .); 93 .rodata : ALIGN (4) 94 { 95 *(.rodata .rodata.* .gnu.linkonce.r.*) 96 97 . = ALIGN(4); 98 KEEP(*(.init)) 99 100 . = ALIGN(4); 101 __preinit_array_start = .; 102 KEEP (*(.preinit_array)) 103 __preinit_array_end = .; 104 105 . = ALIGN(4); 106 __init_array_start = .; 107 KEEP (*(SORT(.init_array.*))) 108 KEEP (*(.init_array)) 109 __init_array_end = .; 110 111 . = ALIGN(4); 112 KEEP(*(.fini)) 113 114 . = ALIGN(4); 115 __fini_array_start = .; 116 KEEP (*(.fini_array)) 117 KEEP (*(SORT(.fini_array.*))) 118 __fini_array_end = .; 119 120 . = ALIGN(0x4); 121 KEEP (*crtbegin.o(.ctors)) 122 KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) 123 KEEP (*(SORT(.ctors.*))) 124 KEEP (*crtend.o(.ctors)) 125 126 . = ALIGN(0x4); 127 KEEP (*crtbegin.o(.dtors)) 128 KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) 129 KEEP (*(SORT(.dtors.*))) 130 KEEP (*crtend.o(.dtors)) 131 132 . = ALIGN(4); 133 __cs3_regions = .; 134 LONG (0) 135 LONG (__cs3_region_init_ram) 136 LONG (__cs3_region_start_ram) 137 LONG (__cs3_region_init_size_ram) 138 LONG (__cs3_region_zero_size_ram) 139 __cs3_regions_end = .; 140 . = ALIGN (8); 141 _etext = .; 142 } >ram 143 144 ASSERT (!(__cs3_region_init_ram & 7), "__cs3_region_init_ram not aligned") 145 ASSERT (!(__cs3_region_start_ram & 7), "__cs3_region_start_ram not aligned") 146 ASSERT (!(__cs3_region_init_size_ram & 7), "__cs3_region_init_size_ram not aligned") 147 ASSERT (!(__cs3_region_zero_size_ram & 7), "__cs3_region_zero_size_ram not aligned") 148 .data : ALIGN (8) 149 { 150 KEEP(*(.jcr)) 151 *(.got.plt) *(.got) 152 *(.shdata) 153 *(.data .data.* .gnu.linkonce.d.*) 154 . = ALIGN (8); 155 *(.ram) 156 . = ALIGN (8); 157 _edata = .; 158 } >ram 159 .bss : ALIGN (8) 160 { 161 *(.shbss) 162 *(.bss .bss.* .gnu.linkonce.b.*) 163 *(COMMON) 164 . = ALIGN (8); 165 *(.ram.b .bss.ram) 166 . = ALIGN (8); 167 _end = .; 168 __end = .; 169 } >ram 170 __cs3_region_init_ram = __cs3_region_start_ram; 171 __cs3_region_init_size_ram = _edata - __cs3_region_start_ram; 172 __cs3_region_zero_size_ram = _end - _edata; 173 /* Default to 1M of heap */ 174 __cs3_region_size_ram = ALIGN (1024) - __cs3_region_start_ram + 1M; 175 176 .stab 0 (NOLOAD) : { *(.stab) } 177 .stabstr 0 (NOLOAD) : { *(.stabstr) } 178 /* DWARF debug sections. 179 * Symbols in the DWARF debugging sections are relative to 180 * the beginning of the section so we begin them at 0. 181 */ 182 /* DWARF 1 */ 183 .debug 0 : { *(.debug) } 184 .line 0 : { *(.line) } 185 /* GNU DWARF 1 extensions */ 186 .debug_srcinfo 0 : { *(.debug_srcinfo) } 187 .debug_sfnames 0 : { *(.debug_sfnames) } 188 /* DWARF 1.1 and DWARF 2 */ 189 .debug_aranges 0 : { *(.debug_aranges) } 190 .debug_pubnames 0 : { *(.debug_pubnames) } 191 /* DWARF 2 */ 192 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } 193 .debug_abbrev 0 : { *(.debug_abbrev) } 194 .debug_line 0 : { *(.debug_line) } 195 .debug_frame 0 : { *(.debug_frame) } 196 .debug_str 0 : { *(.debug_str) } 197 .debug_loc 0 : { *(.debug_loc) } 198 .debug_macinfo 0 : { *(.debug_macinfo) } 199 /* DWARF 2.1 */ 200 .debug_ranges 0 : { *(.debug_ranges) } 201 /* SGI/MIPS DWARF 2 extensions */ 202 .debug_weaknames 0 : { *(.debug_weaknames) } 203 .debug_funcnames 0 : { *(.debug_funcnames) } 204 .debug_typenames 0 : { *(.debug_typenames) } 205 .debug_varnames 0 : { *(.debug_varnames) } 206 207 .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) } 208 .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) } 209 /DISCARD/ : { *(.note.GNU-stack) } 210} 211/* checksum: 3f05797a4e5565d6867048587a */ 212