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. _text = .;
  62. HEAD_TEXT
  63. }
  64. .text : { /* Real text segment */
  65. _stext = .; /* Text and read-only data */
  66. __exception_text_start = .;
  67. *(.exception.text)
  68. __exception_text_end = .;
  69. IRQENTRY_TEXT
  70. TEXT_TEXT
  71. SCHED_TEXT
  72. LOCK_TEXT
  73. KPROBES_TEXT
  74. #ifdef CONFIG_MMU
  75. *(.fixup)
  76. #endif
  77. *(.gnu.warning)
  78. *(.glue_7)
  79. *(.glue_7t)
  80. . = ALIGN(4);
  81. *(.got) /* Global offset table */
  82. ARM_CPU_KEEP(PROC_INFO)
  83. }
  84. RO_DATA(PAGE_SIZE)
  85. #ifdef CONFIG_ARM_UNWIND
  86. /*
  87. * Stack unwinding tables
  88. */
  89. . = ALIGN(8);
  90. .ARM.unwind_idx : {
  91. __start_unwind_idx = .;
  92. *(.ARM.exidx*)
  93. __stop_unwind_idx = .;
  94. }
  95. .ARM.unwind_tab : {
  96. __start_unwind_tab = .;
  97. *(.ARM.extab*)
  98. __stop_unwind_tab = .;
  99. }
  100. #endif
  101. _etext = .; /* End of text and rodata section */
  102. #ifndef CONFIG_XIP_KERNEL
  103. . = ALIGN(PAGE_SIZE);
  104. __init_begin = .;
  105. #endif
  106. INIT_TEXT_SECTION(8)
  107. .exit.text : {
  108. ARM_EXIT_KEEP(EXIT_TEXT)
  109. }
  110. .init.proc.info : {
  111. ARM_CPU_DISCARD(PROC_INFO)
  112. }
  113. .init.arch.info : {
  114. __arch_info_begin = .;
  115. *(.arch.info.init)
  116. __arch_info_end = .;
  117. }
  118. .init.tagtable : {
  119. __tagtable_begin = .;
  120. *(.taglist.init)
  121. __tagtable_end = .;
  122. }
  123. #ifdef CONFIG_SMP_ON_UP
  124. .init.smpalt : {
  125. __smpalt_begin = .;
  126. *(.alt.smp.init)
  127. __smpalt_end = .;
  128. }
  129. #endif
  130. .init.pv_table : {
  131. __pv_table_begin = .;
  132. *(.pv_table)
  133. __pv_table_end = .;
  134. }
  135. .init.data : {
  136. #ifndef CONFIG_XIP_KERNEL
  137. INIT_DATA
  138. #endif
  139. INIT_SETUP(16)
  140. INIT_CALLS
  141. CON_INITCALL
  142. SECURITY_INITCALL
  143. INIT_RAM_FS
  144. }
  145. #ifndef CONFIG_XIP_KERNEL
  146. .exit.data : {
  147. ARM_EXIT_KEEP(EXIT_DATA)
  148. }
  149. #endif
  150. PERCPU_SECTION(32)
  151. #ifdef CONFIG_XIP_KERNEL
  152. __data_loc = ALIGN(4); /* location in binary */
  153. . = PAGE_OFFSET + TEXT_OFFSET;
  154. #else
  155. __init_end = .;
  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")