vmlinux.lds.S 4.7 KB

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