vmlinux.lds.S 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  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. *(.glue_7)
  129. *(.glue_7t)
  130. . = ALIGN(4);
  131. *(.got) /* Global offset table */
  132. ARM_CPU_KEEP(PROC_INFO)
  133. }
  134. RO_DATA(PAGE_SIZE)
  135. #ifdef CONFIG_ARM_UNWIND
  136. /*
  137. * Stack unwinding tables
  138. */
  139. . = ALIGN(8);
  140. .ARM.unwind_idx : {
  141. __start_unwind_idx = .;
  142. *(.ARM.exidx*)
  143. __stop_unwind_idx = .;
  144. }
  145. .ARM.unwind_tab : {
  146. __start_unwind_tab = .;
  147. *(.ARM.extab*)
  148. __stop_unwind_tab = .;
  149. }
  150. #endif
  151. _etext = .; /* End of text and rodata section */
  152. #ifdef CONFIG_XIP_KERNEL
  153. __data_loc = ALIGN(4); /* location in binary */
  154. . = PAGE_OFFSET + TEXT_OFFSET;
  155. #else
  156. . = ALIGN(THREAD_SIZE);
  157. __data_loc = .;
  158. #endif
  159. .data : AT(__data_loc) {
  160. _data = .; /* address in memory */
  161. _sdata = .;
  162. /*
  163. * first, the init task union, aligned
  164. * to an 8192 byte boundary.
  165. */
  166. INIT_TASK_DATA(THREAD_SIZE)
  167. #ifdef CONFIG_XIP_KERNEL
  168. . = ALIGN(PAGE_SIZE);
  169. __init_begin = .;
  170. INIT_DATA
  171. ARM_EXIT_KEEP(EXIT_DATA)
  172. . = ALIGN(PAGE_SIZE);
  173. __init_end = .;
  174. #endif
  175. NOSAVE_DATA
  176. CACHELINE_ALIGNED_DATA(32)
  177. READ_MOSTLY_DATA(32)
  178. /*
  179. * The exception fixup table (might need resorting at runtime)
  180. */
  181. . = ALIGN(32);
  182. __start___ex_table = .;
  183. #ifdef CONFIG_MMU
  184. *(__ex_table)
  185. #endif
  186. __stop___ex_table = .;
  187. /*
  188. * and the usual data section
  189. */
  190. DATA_DATA
  191. CONSTRUCTORS
  192. _edata = .;
  193. }
  194. _edata_loc = __data_loc + SIZEOF(.data);
  195. #ifdef CONFIG_HAVE_TCM
  196. /*
  197. * We align everything to a page boundary so we can
  198. * free it after init has commenced and TCM contents have
  199. * been copied to its destination.
  200. */
  201. .tcm_start : {
  202. . = ALIGN(PAGE_SIZE);
  203. __tcm_start = .;
  204. __itcm_start = .;
  205. }
  206. /*
  207. * Link these to the ITCM RAM
  208. * Put VMA to the TCM address and LMA to the common RAM
  209. * and we'll upload the contents from RAM to TCM and free
  210. * the used RAM after that.
  211. */
  212. .text_itcm ITCM_OFFSET : AT(__itcm_start)
  213. {
  214. __sitcm_text = .;
  215. *(.tcm.text)
  216. *(.tcm.rodata)
  217. . = ALIGN(4);
  218. __eitcm_text = .;
  219. }
  220. /*
  221. * Reset the dot pointer, this is needed to create the
  222. * relative __dtcm_start below (to be used as extern in code).
  223. */
  224. . = ADDR(.tcm_start) + SIZEOF(.tcm_start) + SIZEOF(.text_itcm);
  225. .dtcm_start : {
  226. __dtcm_start = .;
  227. }
  228. /* TODO: add remainder of ITCM as well, that can be used for data! */
  229. .data_dtcm DTCM_OFFSET : AT(__dtcm_start)
  230. {
  231. . = ALIGN(4);
  232. __sdtcm_data = .;
  233. *(.tcm.data)
  234. . = ALIGN(4);
  235. __edtcm_data = .;
  236. }
  237. /* Reset the dot pointer or the linker gets confused */
  238. . = ADDR(.dtcm_start) + SIZEOF(.data_dtcm);
  239. /* End marker for freeing TCM copy in linked object */
  240. .tcm_end : AT(ADDR(.dtcm_start) + SIZEOF(.data_dtcm)){
  241. . = ALIGN(PAGE_SIZE);
  242. __tcm_end = .;
  243. }
  244. #endif
  245. NOTES
  246. BSS_SECTION(0, 0, 0)
  247. _end = .;
  248. STABS_DEBUG
  249. .comment 0 : { *(.comment) }
  250. /* Default discards */
  251. DISCARDS
  252. }
  253. /*
  254. * These must never be empty
  255. * If you have to comment these two assert statements out, your
  256. * binutils is too old (for other reasons as well)
  257. */
  258. ASSERT((__proc_info_end - __proc_info_begin), "missing CPU support")
  259. ASSERT((__arch_info_end - __arch_info_begin), "no machine record defined")