vmlinux.lds.S 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  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. #define PROC_INFO \
  10. VMLINUX_SYMBOL(__proc_info_begin) = .; \
  11. *(.proc.info.init) \
  12. VMLINUX_SYMBOL(__proc_info_end) = .;
  13. #ifdef CONFIG_HOTPLUG_CPU
  14. #define ARM_CPU_DISCARD(x)
  15. #define ARM_CPU_KEEP(x) x
  16. #else
  17. #define ARM_CPU_DISCARD(x) x
  18. #define ARM_CPU_KEEP(x)
  19. #endif
  20. #if defined(CONFIG_SMP_ON_UP) && !defined(CONFIG_DEBUG_SPINLOCK)
  21. #define ARM_EXIT_KEEP(x) x
  22. #else
  23. #define ARM_EXIT_KEEP(x)
  24. #endif
  25. OUTPUT_ARCH(arm)
  26. ENTRY(stext)
  27. #ifndef __ARMEB__
  28. jiffies = jiffies_64;
  29. #else
  30. jiffies = jiffies_64 + 4;
  31. #endif
  32. SECTIONS
  33. {
  34. /*
  35. * unwind exit sections must be discarded before the rest of the
  36. * unwind sections get included.
  37. */
  38. /DISCARD/ : {
  39. *(.ARM.exidx.exit.text)
  40. *(.ARM.extab.exit.text)
  41. ARM_CPU_DISCARD(*(.ARM.exidx.cpuexit.text))
  42. ARM_CPU_DISCARD(*(.ARM.extab.cpuexit.text))
  43. #ifndef CONFIG_HOTPLUG
  44. *(.ARM.exidx.devexit.text)
  45. *(.ARM.extab.devexit.text)
  46. #endif
  47. #ifndef CONFIG_MMU
  48. *(.fixup)
  49. *(__ex_table)
  50. #endif
  51. #ifndef CONFIG_SMP_ON_UP
  52. *(.alt.smp.init)
  53. #endif
  54. }
  55. #ifdef CONFIG_XIP_KERNEL
  56. . = XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR);
  57. #else
  58. . = PAGE_OFFSET + TEXT_OFFSET;
  59. #endif
  60. .head.text : {
  61. _stext = .;
  62. HEAD_TEXT
  63. }
  64. INIT_TEXT_SECTION(8)
  65. .exit.text : {
  66. ARM_EXIT_KEEP(EXIT_TEXT)
  67. }
  68. .init.proc.info : {
  69. ARM_CPU_DISCARD(PROC_INFO)
  70. }
  71. .init.arch.info : {
  72. __arch_info_begin = .;
  73. *(.arch.info.init)
  74. __arch_info_end = .;
  75. }
  76. .init.tagtable : {
  77. __tagtable_begin = .;
  78. *(.taglist.init)
  79. __tagtable_end = .;
  80. }
  81. #ifdef CONFIG_SMP_ON_UP
  82. .init.smpalt : {
  83. __smpalt_begin = .;
  84. *(.alt.smp.init)
  85. __smpalt_end = .;
  86. }
  87. #endif
  88. .init.pv_table : {
  89. __pv_table_begin = .;
  90. *(.pv_table)
  91. __pv_table_end = .;
  92. }
  93. .init.data : {
  94. #ifndef CONFIG_XIP_KERNEL
  95. INIT_DATA
  96. #endif
  97. INIT_SETUP(16)
  98. INIT_CALLS
  99. CON_INITCALL
  100. SECURITY_INITCALL
  101. INIT_RAM_FS
  102. }
  103. #ifndef CONFIG_XIP_KERNEL
  104. .exit.data : {
  105. ARM_EXIT_KEEP(EXIT_DATA)
  106. }
  107. #endif
  108. PERCPU_SECTION(32)
  109. #ifndef CONFIG_XIP_KERNEL
  110. __init_begin = _stext;
  111. . = ALIGN(PAGE_SIZE);
  112. __init_end = .;
  113. #endif
  114. .text : { /* Real text segment */
  115. _text = .; /* Text and read-only data */
  116. __exception_text_start = .;
  117. *(.exception.text)
  118. __exception_text_end = .;
  119. IRQENTRY_TEXT
  120. TEXT_TEXT
  121. SCHED_TEXT
  122. LOCK_TEXT
  123. KPROBES_TEXT
  124. #ifdef CONFIG_MMU
  125. *(.fixup)
  126. #endif
  127. *(.gnu.warning)
  128. *(.rodata)
  129. *(.rodata.*)
  130. *(.glue_7)
  131. *(.glue_7t)
  132. . = ALIGN(4);
  133. *(.got) /* Global offset table */
  134. ARM_CPU_KEEP(PROC_INFO)
  135. }
  136. RO_DATA(PAGE_SIZE)
  137. #ifdef CONFIG_ARM_UNWIND
  138. /*
  139. * Stack unwinding tables
  140. */
  141. . = ALIGN(8);
  142. .ARM.unwind_idx : {
  143. __start_unwind_idx = .;
  144. *(.ARM.exidx*)
  145. __stop_unwind_idx = .;
  146. }
  147. .ARM.unwind_tab : {
  148. __start_unwind_tab = .;
  149. *(.ARM.extab*)
  150. __stop_unwind_tab = .;
  151. }
  152. #endif
  153. _etext = .; /* End of text and rodata section */
  154. #ifdef CONFIG_XIP_KERNEL
  155. __data_loc = ALIGN(4); /* location in binary */
  156. . = PAGE_OFFSET + TEXT_OFFSET;
  157. #else
  158. . = ALIGN(THREAD_SIZE);
  159. __data_loc = .;
  160. #endif
  161. .data : AT(__data_loc) {
  162. _data = .; /* address in memory */
  163. _sdata = .;
  164. /*
  165. * first, the init task union, aligned
  166. * to an 8192 byte boundary.
  167. */
  168. INIT_TASK_DATA(THREAD_SIZE)
  169. #ifdef CONFIG_XIP_KERNEL
  170. . = ALIGN(PAGE_SIZE);
  171. __init_begin = .;
  172. INIT_DATA
  173. ARM_EXIT_KEEP(EXIT_DATA)
  174. . = ALIGN(PAGE_SIZE);
  175. __init_end = .;
  176. #endif
  177. NOSAVE_DATA
  178. CACHELINE_ALIGNED_DATA(32)
  179. READ_MOSTLY_DATA(32)
  180. /*
  181. * The exception fixup table (might need resorting at runtime)
  182. */
  183. . = ALIGN(32);
  184. __start___ex_table = .;
  185. #ifdef CONFIG_MMU
  186. *(__ex_table)
  187. #endif
  188. __stop___ex_table = .;
  189. /*
  190. * and the usual data section
  191. */
  192. DATA_DATA
  193. CONSTRUCTORS
  194. _edata = .;
  195. }
  196. _edata_loc = __data_loc + SIZEOF(.data);
  197. #ifdef CONFIG_HAVE_TCM
  198. /*
  199. * We align everything to a page boundary so we can
  200. * free it after init has commenced and TCM contents have
  201. * been copied to its destination.
  202. */
  203. .tcm_start : {
  204. . = ALIGN(PAGE_SIZE);
  205. __tcm_start = .;
  206. __itcm_start = .;
  207. }
  208. /*
  209. * Link these to the ITCM RAM
  210. * Put VMA to the TCM address and LMA to the common RAM
  211. * and we'll upload the contents from RAM to TCM and free
  212. * the used RAM after that.
  213. */
  214. .text_itcm ITCM_OFFSET : AT(__itcm_start)
  215. {
  216. __sitcm_text = .;
  217. *(.tcm.text)
  218. *(.tcm.rodata)
  219. . = ALIGN(4);
  220. __eitcm_text = .;
  221. }
  222. /*
  223. * Reset the dot pointer, this is needed to create the
  224. * relative __dtcm_start below (to be used as extern in code).
  225. */
  226. . = ADDR(.tcm_start) + SIZEOF(.tcm_start) + SIZEOF(.text_itcm);
  227. .dtcm_start : {
  228. __dtcm_start = .;
  229. }
  230. /* TODO: add remainder of ITCM as well, that can be used for data! */
  231. .data_dtcm DTCM_OFFSET : AT(__dtcm_start)
  232. {
  233. . = ALIGN(4);
  234. __sdtcm_data = .;
  235. *(.tcm.data)
  236. . = ALIGN(4);
  237. __edtcm_data = .;
  238. }
  239. /* Reset the dot pointer or the linker gets confused */
  240. . = ADDR(.dtcm_start) + SIZEOF(.data_dtcm);
  241. /* End marker for freeing TCM copy in linked object */
  242. .tcm_end : AT(ADDR(.dtcm_start) + SIZEOF(.data_dtcm)){
  243. . = ALIGN(PAGE_SIZE);
  244. __tcm_end = .;
  245. }
  246. #endif
  247. NOTES
  248. BSS_SECTION(0, 0, 0)
  249. _end = .;
  250. STABS_DEBUG
  251. .comment 0 : { *(.comment) }
  252. /* Default discards */
  253. DISCARDS
  254. }
  255. /*
  256. * These must never be empty
  257. * If you have to comment these two assert statements out, your
  258. * binutils is too old (for other reasons as well)
  259. */
  260. ASSERT((__proc_info_end - __proc_info_begin), "missing CPU support")
  261. ASSERT((__arch_info_end - __arch_info_begin), "no machine record defined")