vmlinux.lds.S 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. /* ld script to make ARM Linux kernel
  2. * taken from the i386 version by Russell King
  3. * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>
  4. */
  5. #include <asm-generic/vmlinux.lds.h>
  6. #include <asm/thread_info.h>
  7. #include <asm/memory.h>
  8. #include <asm/page.h>
  9. OUTPUT_ARCH(arm)
  10. ENTRY(stext)
  11. #ifndef __ARMEB__
  12. jiffies = jiffies_64;
  13. #else
  14. jiffies = jiffies_64 + 4;
  15. #endif
  16. SECTIONS
  17. {
  18. #ifdef CONFIG_XIP_KERNEL
  19. . = XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR);
  20. #else
  21. . = PAGE_OFFSET + TEXT_OFFSET;
  22. #endif
  23. .text.head : {
  24. _stext = .;
  25. _sinittext = .;
  26. *(.text.head)
  27. }
  28. .init : { /* Init code and data */
  29. INIT_TEXT
  30. _einittext = .;
  31. __proc_info_begin = .;
  32. *(.proc.info.init)
  33. __proc_info_end = .;
  34. __arch_info_begin = .;
  35. *(.arch.info.init)
  36. __arch_info_end = .;
  37. __tagtable_begin = .;
  38. *(.taglist.init)
  39. __tagtable_end = .;
  40. . = ALIGN(16);
  41. __setup_start = .;
  42. *(.init.setup)
  43. __setup_end = .;
  44. __early_begin = .;
  45. *(.early_param.init)
  46. __early_end = .;
  47. __initcall_start = .;
  48. INITCALLS
  49. __initcall_end = .;
  50. __con_initcall_start = .;
  51. *(.con_initcall.init)
  52. __con_initcall_end = .;
  53. __security_initcall_start = .;
  54. *(.security_initcall.init)
  55. __security_initcall_end = .;
  56. #ifdef CONFIG_BLK_DEV_INITRD
  57. . = ALIGN(32);
  58. __initramfs_start = .;
  59. usr/built-in.o(.init.ramfs)
  60. __initramfs_end = .;
  61. #endif
  62. . = ALIGN(PAGE_SIZE);
  63. __per_cpu_load = .;
  64. __per_cpu_start = .;
  65. *(.data.percpu.page_aligned)
  66. *(.data.percpu)
  67. *(.data.percpu.shared_aligned)
  68. __per_cpu_end = .;
  69. #ifndef CONFIG_XIP_KERNEL
  70. __init_begin = _stext;
  71. INIT_DATA
  72. . = ALIGN(PAGE_SIZE);
  73. __init_end = .;
  74. #endif
  75. }
  76. /DISCARD/ : { /* Exit code and data */
  77. EXIT_TEXT
  78. EXIT_DATA
  79. *(.exitcall.exit)
  80. *(.discard)
  81. *(.ARM.exidx.exit.text)
  82. *(.ARM.extab.exit.text)
  83. #ifndef CONFIG_HOTPLUG_CPU
  84. *(.ARM.exidx.cpuexit.text)
  85. *(.ARM.extab.cpuexit.text)
  86. #endif
  87. #ifndef CONFIG_HOTPLUG
  88. *(.ARM.exidx.devexit.text)
  89. *(.ARM.extab.devexit.text)
  90. #endif
  91. #ifndef CONFIG_MMU
  92. *(.fixup)
  93. *(__ex_table)
  94. #endif
  95. }
  96. .text : { /* Real text segment */
  97. _text = .; /* Text and read-only data */
  98. __exception_text_start = .;
  99. *(.exception.text)
  100. __exception_text_end = .;
  101. TEXT_TEXT
  102. SCHED_TEXT
  103. LOCK_TEXT
  104. KPROBES_TEXT
  105. #ifdef CONFIG_MMU
  106. *(.fixup)
  107. #endif
  108. *(.gnu.warning)
  109. *(.rodata)
  110. *(.rodata.*)
  111. *(.glue_7)
  112. *(.glue_7t)
  113. *(.got) /* Global offset table */
  114. }
  115. RO_DATA(PAGE_SIZE)
  116. _etext = .; /* End of text and rodata section */
  117. #ifdef CONFIG_ARM_UNWIND
  118. /*
  119. * Stack unwinding tables
  120. */
  121. . = ALIGN(8);
  122. .ARM.unwind_idx : {
  123. __start_unwind_idx = .;
  124. *(.ARM.exidx*)
  125. __stop_unwind_idx = .;
  126. }
  127. .ARM.unwind_tab : {
  128. __start_unwind_tab = .;
  129. *(.ARM.extab*)
  130. __stop_unwind_tab = .;
  131. }
  132. #endif
  133. #ifdef CONFIG_XIP_KERNEL
  134. __data_loc = ALIGN(4); /* location in binary */
  135. . = PAGE_OFFSET + TEXT_OFFSET;
  136. #else
  137. . = ALIGN(THREAD_SIZE);
  138. __data_loc = .;
  139. #endif
  140. .data : AT(__data_loc) {
  141. _data = .; /* address in memory */
  142. _sdata = .;
  143. /*
  144. * first, the init task union, aligned
  145. * to an 8192 byte boundary.
  146. */
  147. *(.data.init_task)
  148. #ifdef CONFIG_XIP_KERNEL
  149. . = ALIGN(PAGE_SIZE);
  150. __init_begin = .;
  151. INIT_DATA
  152. . = ALIGN(PAGE_SIZE);
  153. __init_end = .;
  154. #endif
  155. . = ALIGN(PAGE_SIZE);
  156. __nosave_begin = .;
  157. *(.data.nosave)
  158. . = ALIGN(PAGE_SIZE);
  159. __nosave_end = .;
  160. /*
  161. * then the cacheline aligned data
  162. */
  163. . = ALIGN(32);
  164. *(.data.cacheline_aligned)
  165. /*
  166. * The exception fixup table (might need resorting at runtime)
  167. */
  168. . = ALIGN(32);
  169. __start___ex_table = .;
  170. #ifdef CONFIG_MMU
  171. *(__ex_table)
  172. #endif
  173. __stop___ex_table = .;
  174. /*
  175. * and the usual data section
  176. */
  177. DATA_DATA
  178. CONSTRUCTORS
  179. _edata = .;
  180. }
  181. _edata_loc = __data_loc + SIZEOF(.data);
  182. #ifdef CONFIG_HAVE_TCM
  183. /*
  184. * We align everything to a page boundary so we can
  185. * free it after init has commenced and TCM contents have
  186. * been copied to its destination.
  187. */
  188. .tcm_start : {
  189. . = ALIGN(PAGE_SIZE);
  190. __tcm_start = .;
  191. __itcm_start = .;
  192. }
  193. /*
  194. * Link these to the ITCM RAM
  195. * Put VMA to the TCM address and LMA to the common RAM
  196. * and we'll upload the contents from RAM to TCM and free
  197. * the used RAM after that.
  198. */
  199. .text_itcm ITCM_OFFSET : AT(__itcm_start)
  200. {
  201. __sitcm_text = .;
  202. *(.tcm.text)
  203. *(.tcm.rodata)
  204. . = ALIGN(4);
  205. __eitcm_text = .;
  206. }
  207. /*
  208. * Reset the dot pointer, this is needed to create the
  209. * relative __dtcm_start below (to be used as extern in code).
  210. */
  211. . = ADDR(.tcm_start) + SIZEOF(.tcm_start) + SIZEOF(.text_itcm);
  212. .dtcm_start : {
  213. __dtcm_start = .;
  214. }
  215. /* TODO: add remainder of ITCM as well, that can be used for data! */
  216. .data_dtcm DTCM_OFFSET : AT(__dtcm_start)
  217. {
  218. . = ALIGN(4);
  219. __sdtcm_data = .;
  220. *(.tcm.data)
  221. . = ALIGN(4);
  222. __edtcm_data = .;
  223. }
  224. /* Reset the dot pointer or the linker gets confused */
  225. . = ADDR(.dtcm_start) + SIZEOF(.data_dtcm);
  226. /* End marker for freeing TCM copy in linked object */
  227. .tcm_end : AT(ADDR(.dtcm_start) + SIZEOF(.data_dtcm)){
  228. . = ALIGN(PAGE_SIZE);
  229. __tcm_end = .;
  230. }
  231. #endif
  232. .bss : {
  233. __bss_start = .; /* BSS */
  234. *(.bss)
  235. *(COMMON)
  236. __bss_stop = .;
  237. _end = .;
  238. }
  239. /* Stabs debugging sections. */
  240. .stab 0 : { *(.stab) }
  241. .stabstr 0 : { *(.stabstr) }
  242. .stab.excl 0 : { *(.stab.excl) }
  243. .stab.exclstr 0 : { *(.stab.exclstr) }
  244. .stab.index 0 : { *(.stab.index) }
  245. .stab.indexstr 0 : { *(.stab.indexstr) }
  246. .comment 0 : { *(.comment) }
  247. }
  248. /*
  249. * These must never be empty
  250. * If you have to comment these two assert statements out, your
  251. * binutils is too old (for other reasons as well)
  252. */
  253. ASSERT((__proc_info_end - __proc_info_begin), "missing CPU support")
  254. ASSERT((__arch_info_end - __arch_info_begin), "no machine record defined")