vmlinux.lds.S 5.4 KB

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