vmlinux.lds.S 4.9 KB

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