vmlinux.lds.S 4.8 KB

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