vmlinux.lds.S 5.2 KB

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