vmlinux.lds.S 4.7 KB

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