link.ld 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
  2. OUTPUT_ARCH(arm)
  3. ENTRY(_start)
  4. SECTIONS
  5. {
  6. . = (DEFINED(PROGRAM_LOAD_ADDRESS)) ? (PROGRAM_LOAD_ADDRESS) : 0xc0200000;
  7. /*
  8. ************************************************************
  9. ** NOCACHE_BUFFER for HW & SW
  10. ************************************************************
  11. */
  12. . = ALIGN(4);
  13. .nocache_buffer :
  14. {
  15. PROVIDE(__nocache_buffer_start__ = .);
  16. *(.nocache_buffer*)
  17. KEEP(*(.nocache_buffer))
  18. . = ALIGN(1M);
  19. PROVIDE(__nocache_buffer_end__ = .);
  20. }
  21. . = 0xC0300000;
  22. __text_start = .;
  23. .text :
  24. {
  25. _stext = .;
  26. KEEP(*(.ARM1176START))
  27. KEEP(*(.ARM1176INIT))
  28. KEEP(*(.ARM1176IVT))
  29. *(.init)
  30. *(.text*)
  31. *(.stub)
  32. *(.gnu.warning)
  33. *(.gnu.linkonce.t*)
  34. /* section information for finsh shell */
  35. . = ALIGN(4);
  36. __fsymtab_start = .;
  37. KEEP(*(FSymTab))
  38. __fsymtab_end = .;
  39. . = ALIGN(4);
  40. __vsymtab_start = .;
  41. KEEP(*(VSymTab))
  42. __vsymtab_end = .;
  43. . = ALIGN(4);
  44. . = ALIGN(4);
  45. __rt_init_start = .;
  46. KEEP(*(SORT(.rti_fn*)))
  47. __rt_init_end = .;
  48. . = ALIGN(4);
  49. /* section information for modules */
  50. . = ALIGN(4);
  51. __rtmsymtab_start = .;
  52. KEEP(*(RTMSymTab))
  53. __rtmsymtab_end = .;
  54. _etext = .;
  55. }
  56. PROVIDE(_etext = .);
  57. __text_end = .;
  58. /*
  59. ************************************************************
  60. ** add ro data sections
  61. ************************************************************
  62. */
  63. . = ALIGN(4);
  64. __rodata_start = .;
  65. .rodata :
  66. {
  67. *(.rodata*)
  68. . = ALIGN(4);
  69. *(.gnu.linkonce.r*)
  70. *(.eh_frame)
  71. }
  72. PROVIDE(_end_readonly = .);
  73. /*
  74. ************************************************************
  75. ** add rw data sections
  76. ************************************************************
  77. */
  78. .data :
  79. {
  80. *(.data*)
  81. . = ALIGN(4);
  82. *(.gnu.linkonce.d*) CONSTRUCTORS
  83. }
  84. /*
  85. ************************************************************
  86. ** .bss section which is used for uninitialized data
  87. ************************************************************
  88. */
  89. . = ALIGN(1024);
  90. .bss :
  91. {
  92. PROVIDE(__bss_start__ = .);
  93. *(.bss*)
  94. *(COMMON)
  95. PROVIDE(__bss_end__ = .);
  96. }
  97. /*
  98. ************************************************************
  99. ** .ctors .dtors are used for c++ constructors/destructors
  100. ************************************************************
  101. */
  102. .ctors :
  103. {
  104. PROVIDE(__ctors_start__ = .);
  105. KEEP(*(SORT(.ctors.*)))
  106. KEEP(*(.ctors))
  107. PROVIDE(__ctors_end__ = .);
  108. }
  109. .dtors :
  110. {
  111. PROVIDE(__dtors_start__ = .);
  112. KEEP(*(SORT(.dtors.*)) )
  113. KEEP(*(.dtors) )
  114. PROVIDE(__dtors_end__ = .);
  115. }
  116. /*
  117. ************************************************************
  118. ** ARM extensions
  119. ************************************************************
  120. */
  121. .ARM.attributes :
  122. {
  123. *(.ARM.attributes)
  124. *(.ARM.extab*)
  125. PROVIDE(__exidx_start = .);
  126. *(.ARM.exidx*)
  127. PROVIDE(__exidx_end = .);
  128. }
  129. /*
  130. ************************************************************
  131. ** _end marks the end of code
  132. ************************************************************
  133. */
  134. . = ALIGN(4);
  135. PROVIDE(_end = .);
  136. PROVIDE(end = .);
  137. /*
  138. ************************************************************
  139. ** The ".stack" section is used for user stacks, we use the
  140. ** memory sizes given by the make symbol PROGRAM_STACK_BYTES.
  141. ** The variables "__stack_end__" and "__stack_start__"
  142. ** mark the stack buffer to be used by libc functions.
  143. ************************************************************
  144. */
  145. . = ALIGN(8);
  146. .stack :
  147. {
  148. PROVIDE(__stack_end__ = .);
  149. . += PROGRAM_STACK_BYTES;
  150. PROVIDE(__stack_start__ = .);
  151. }
  152. /*
  153. ************************************************************
  154. ** The ".heap" section is used for dynamic data, we use the
  155. ** memory sizes given by the make symbols PROGRAM_HEAP_BYTES.
  156. ** The variables "__heap_start__" and "__heap_end__"
  157. ** mark the heap memory to be used by libc "malloc()"
  158. ** functions.
  159. ************************************************************
  160. */
  161. . = ALIGN(8);
  162. .heap :
  163. {
  164. PROVIDE(__heap_start__ = .);
  165. . += PROGRAM_HEAP_BYTES;
  166. . = ALIGN(1M);
  167. PROVIDE(__heap_end__ = .);
  168. }
  169. /*
  170. ************************************************************
  171. ** Stabs debugging sections.
  172. ************************************************************
  173. */
  174. .stab 0 : { *(.stab) }
  175. .stabstr 0 : { *(.stabstr) }
  176. .stab.excl 0 : { *(.stab.excl) }
  177. .stab.exclstr 0 : { *(.stab.exclstr) }
  178. .stab.index 0 : { *(.stab.index) }
  179. .stab.indexstr 0 : { *(.stab.indexstr) }
  180. .comment 0 : { *(.comment) }
  181. /*
  182. ************************************************************
  183. ** DWARF 1
  184. ************************************************************
  185. */
  186. .debug 0 : { *(.debug) }
  187. .line 0 : { *(.line) }
  188. /*
  189. ************************************************************
  190. ** GNU DWARF 1 extensions
  191. ************************************************************
  192. */
  193. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  194. .debug_sfnames 0 : { *(.debug_sfnames) }
  195. /*
  196. ************************************************************
  197. ** DWARF 1.1 and DWARF 2
  198. ************************************************************
  199. */
  200. .debug_aranges 0 : { *(.debug_aranges) }
  201. .debug_pubnames 0 : { *(.debug_pubnames) }
  202. /*
  203. ************************************************************
  204. ** DWARF 2
  205. ************************************************************
  206. */
  207. .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
  208. .debug_abbrev 0 : { *(.debug_abbrev) }
  209. .debug_line 0 : { *(.debug_line) }
  210. .debug_frame 0 : { *(.debug_frame) }
  211. .debug_str 0 : { *(.debug_str) }
  212. .debug_loc 0 : { *(.debug_loc) }
  213. .debug_macinfo 0 : { *(.debug_macinfo) }
  214. .debug_ranges 0 : { *(.debug_ranges) }
  215. /*
  216. ************************************************************
  217. ** SGI/MIPS DWARF 2 extensions
  218. ************************************************************
  219. */
  220. .debug_weaknames 0 : { *(.debug_weaknames) }
  221. .debug_funcnames 0 : { *(.debug_funcnames) }
  222. .debug_typenames 0 : { *(.debug_typenames) }
  223. .debug_varnames 0 : { *(.debug_varnames) }
  224. }