gcc_csky.ld 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. /*
  2. * Copyright (C) 2017 C-SKY Microsystems Co., Ltd. All rights reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /******************************************************************************
  17. * @file gcc_csky.h
  18. * @brief csky linker file for PHOBOS
  19. * @version V1.0
  20. * @date 02. June 2017
  21. ******************************************************************************/
  22. MEMORY
  23. {
  24. ROM : ORIGIN = 0x0 , LENGTH = 0x1FFF /* ROM 8KB*/
  25. EFLASH : ORIGIN = 0x10000000 , LENGTH = 0x3FFFF /* E-FLASH 256KB*/
  26. SRAM : ORIGIN = 0x20000000 , LENGTH = 0x18000 /* on-chip SRAM 128KB*/
  27. }
  28. PROVIDE (__StackTop = 0x20020000 - 0x8);
  29. PROVIDE (Stack_Size = 0x1000);
  30. /*
  31. PROVIDE (__heap_start = 0x20018000);
  32. PROVIDE (__heap_end = 0x2001a000);
  33. PROVIDE (Heap_Size = 0x2000);
  34. */
  35. REGION_ALIAS("REGION_TEXT", SRAM);
  36. REGION_ALIAS("REGION_RODATA", SRAM);
  37. REGION_ALIAS("REGION_CUSTOM1", SRAM);
  38. REGION_ALIAS("REGION_CUSTOM2", SRAM);
  39. REGION_ALIAS("REGION_DATA", SRAM);
  40. REGION_ALIAS("REGION_BSS", SRAM);
  41. ENTRY(Reset_Handler)
  42. SECTIONS
  43. {
  44. .text : AT(ADDR(.text)){
  45. . = ALIGN(0x4) ;
  46. *(.vectors)
  47. __stext = . ;
  48. *(.text)
  49. *(.text*)
  50. *(.text.*)
  51. *(.gnu.warning)
  52. *(.stub)
  53. *(.gnu.linkonce.t*)
  54. *(.glue_7t)
  55. *(.glue_7)
  56. *(.jcr)
  57. *(.init)
  58. *(.fini)
  59. . = ALIGN (4) ;
  60. PROVIDE(__ctbp = .);
  61. *(.call_table_data)
  62. *(.call_table_text)
  63. /* section information for finsh shell */
  64. . = ALIGN(4);
  65. __fsymtab_start = .;
  66. KEEP(*(FSymTab))
  67. __fsymtab_end = .;
  68. . = ALIGN(4);
  69. __vsymtab_start = .;
  70. KEEP(*(VSymTab))
  71. __vsymtab_end = .;
  72. . = ALIGN(4);
  73. /* section information for initial. */
  74. . = ALIGN(4);
  75. __rt_init_start = .;
  76. KEEP(*(SORT(.rti_fn*)))
  77. __rt_init_end = .;
  78. . = ALIGN(4);
  79. . = ALIGN(0x10) ;
  80. __etext = . ;
  81. } > REGION_TEXT
  82. .rodata : AT(LOADADDR(.text) + SIZEOF(.text)){
  83. . = ALIGN(0x4) ;
  84. __srodata = .;
  85. *(.rdata)
  86. *(.rdata*)
  87. *(.rdata1)
  88. *(.rdata.*)
  89. *(.rodata)
  90. *(.rodata1)
  91. *(.rodata*)
  92. *(.rodata.*)
  93. *(.rodata.str1.4)
  94. . = ALIGN(0x4) ;
  95. __erodata = .;
  96. } > REGION_RODATA
  97. .data : AT(LOADADDR(.rodata) + SIZEOF(.rodata)){
  98. . = ALIGN(0x4) ;
  99. __sdata = . ;
  100. __data_start__ = . ;
  101. data_start = . ;
  102. *(.got.plt)
  103. *(.got)
  104. *(.gnu.linkonce.r*)
  105. *(.data)
  106. *(.data*)
  107. *(.data1)
  108. *(.data.*)
  109. *(.gnu.linkonce.d*)
  110. *(.data1)
  111. *(.gcc_except_table)
  112. *(.gcc_except_table*)
  113. __start_init_call = .;
  114. *(.initcall.init)
  115. __stop_init_call = .;
  116. __start_cmd = .;
  117. *(.bootloaddata.cmd)
  118. . = ALIGN(4) ;
  119. __stop_cmd = .;
  120. *(.sdata)
  121. *(.sdata.*)
  122. *(.gnu.linkonce.s.*)
  123. *(__libc_atexit)
  124. *(__libc_subinit)
  125. *(__libc_subfreeres)
  126. *(.note.ABI-tag)
  127. . = ALIGN(0x4) ;
  128. __edata = .;
  129. __data_end__ = .;
  130. } > REGION_DATA
  131. .bss : {
  132. . = ALIGN(0x4) ;
  133. __sbss = ALIGN(0x4) ;
  134. __bss_start__ = . ;
  135. *(.dynsbss)
  136. *(.sbss)
  137. *(.sbss.*)
  138. *(.scommon)
  139. *(.dynbss)
  140. *(.bss)
  141. *(.bss.*)
  142. *(COMMON)
  143. . = ALIGN(0x4) ;
  144. __ebss = . ;
  145. __end = . ;
  146. end = . ;
  147. __bss_end__ = .;
  148. } > REGION_BSS
  149. .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } > REGION_BSS
  150. .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table .gcc_except_table.*) } > REGION_BSS
  151. .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
  152. .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table .gcc_except_table.*) }
  153. .eh_frame_hdr : { *(.eh_frame_hdr) }
  154. .preinit_array :
  155. {
  156. PROVIDE_HIDDEN (__preinit_array_start = .);
  157. KEEP (*(.preinit_array))
  158. PROVIDE_HIDDEN (__preinit_array_end = .);
  159. }
  160. .init_array :
  161. {
  162. PROVIDE_HIDDEN (__init_array_start = .);
  163. KEEP (*(SORT(.init_array.*)))
  164. KEEP (*(.init_array))
  165. PROVIDE_HIDDEN (__init_array_end = .);
  166. }
  167. .fini_array :
  168. {
  169. PROVIDE_HIDDEN (__fini_array_start = .);
  170. KEEP (*(.fini_array))
  171. KEEP (*(SORT(.fini_array.*)))
  172. PROVIDE_HIDDEN (__fini_array_end = .);
  173. }
  174. .ctors :
  175. {
  176. KEEP (*crtbegin.o(.ctors))
  177. KEEP (*crtbegin?.o(.ctors))
  178. KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .ctors))
  179. KEEP (*(SORT(.ctors.*)))
  180. KEEP (*(.ctors))
  181. } > REGION_BSS
  182. .dtors :
  183. {
  184. KEEP (*crtbegin.o(.dtors))
  185. KEEP (*crtbegin?.o(.dtors))
  186. KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors))
  187. KEEP (*(SORT(.dtors.*)))
  188. KEEP (*(.dtors))
  189. } > REGION_BSS
  190. .junk 0 : { *(.rel*) *(.rela*) }
  191. .stab 0 : { *(.stab) }
  192. .stabstr 0 : { *(.stabstr) }
  193. .stab.excl 0 : { *(.stab.excl) }
  194. .stab.exclstr 0 : { *(.stab.exclstr) }
  195. .stab.index 0 : { *(.stab.index) }
  196. .stab.indexstr 0 : { *(.stab.indexstr) }
  197. .comment 0 : { *(.comment) }
  198. .debug 0 : { *(.debug) }
  199. .line 0 : { *(.line) }
  200. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  201. .debug_sfnames 0 : { *(.debug_sfnames) }
  202. .debug_aranges 0 : { *(.debug_aranges) }
  203. .debug_pubnames 0 : { *(.debug_pubnames) }
  204. .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
  205. .debug_abbrev 0 : { *(.debug_abbrev) }
  206. .debug_line 0 : { *(.debug_line) }
  207. .debug_frame 0 : { *(.debug_frame) }
  208. .debug_str 0 : { *(.debug_str) }
  209. .debug_loc 0 : { *(.debug_loc) }
  210. .debug_macinfo 0 : { *(.debug_macinfo) }
  211. .debug_weaknames 0 : { *(.debug_weaknames) }
  212. .debug_funcnames 0 : { *(.debug_funcnames) }
  213. .debug_typenames 0 : { *(.debug_typenames) }
  214. .debug_varnames 0 : { *(.debug_varnames) }
  215. .debug_pubtypes 0 : { *(.debug_pubtypes) }
  216. .debug_ranges 0 : { *(.debug_ranges) }
  217. .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
  218. /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }
  219. }