gd32450i-eval.lds.STMDISCO 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  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. #if defined(PHYS_ALIAS_OFFSET)
  22. . = PHYS_ALIAS_OFFSET + TEXT_OFFSET;
  23. #else
  24. . = PAGE_OFFSET + TEXT_OFFSET;
  25. #endif
  26. #endif
  27. .init : { /* Init code and data */
  28. _stext = .;
  29. _sinittext = .;
  30. HEAD_TEXT
  31. #if !defined(CONFIG_M2S_CACHE) && !defined(CONFIG_KERNEL_IN_ENVM)
  32. INIT_TEXT
  33. #endif
  34. _einittext = .;
  35. #if !defined(CONFIG_INITRAMFS_IS_LARGE)
  36. /*
  37. * In case the kernel links in a built-in initramfs
  38. * and that initramfs is large enough, there is a symbol
  39. * in .proc.info.init that makes a relative reference
  40. * (in an assembly-level file) to a symbol in the kernel text.
  41. * The initramfs being large, that relative reference
  42. * doesn't work because the linker is not able to fit
  43. * in the relative offset into the 24 bit offset field.
  44. * The solution (well, part of it) is to move .proc.info.init
  45. * closer to the kernel text section.
  46. */
  47. __proc_info_begin = .;
  48. *(.proc.info.init)
  49. __proc_info_end = .;
  50. #endif
  51. __arch_info_begin = .;
  52. *(.arch.info.init)
  53. __arch_info_end = .;
  54. __tagtable_begin = .;
  55. *(.taglist.init)
  56. __tagtable_end = .;
  57. #if !defined(CONFIG_M2S_CACHE) && !defined(CONFIG_KERNEL_IN_ENVM)
  58. INIT_SETUP(16)
  59. #endif
  60. __early_begin = .;
  61. *(.early_param.init)
  62. __early_end = .;
  63. #if !defined(CONFIG_M2S_CACHE) && !defined(CONFIG_KERNEL_IN_ENVM)
  64. INIT_CALLS
  65. CON_INITCALL
  66. SECURITY_INITCALL
  67. INIT_RAM_FS
  68. #endif
  69. #ifndef CONFIG_XIP_KERNEL
  70. __init_begin = _stext;
  71. INIT_DATA
  72. #endif
  73. }
  74. PERCPU(PAGE_SIZE)
  75. #ifndef CONFIG_XIP_KERNEL
  76. . = ALIGN(PAGE_SIZE);
  77. __init_end = .;
  78. #endif
  79. /*
  80. * unwind exit sections must be discarded before the rest of the
  81. * unwind sections get included.
  82. */
  83. /DISCARD/ : {
  84. *(.ARM.exidx.exit.text)
  85. *(.ARM.extab.exit.text)
  86. #ifndef CONFIG_HOTPLUG_CPU
  87. *(.ARM.exidx.cpuexit.text)
  88. *(.ARM.extab.cpuexit.text)
  89. #endif
  90. #ifndef CONFIG_HOTPLUG
  91. *(.ARM.exidx.devexit.text)
  92. *(.ARM.extab.devexit.text)
  93. #endif
  94. #ifndef CONFIG_MMU
  95. *(.fixup)
  96. *(__ex_table)
  97. #endif
  98. }
  99. /*
  100. * On Microsemi SmartFusion2, kernel code is linked into
  101. * an alias address region, which is cacheable. Anything that
  102. * is not code MUST reside in the non-cached address region.
  103. */
  104. #if defined(CONFIG_M2S_CACHE)
  105. _non_cached_start = .;
  106. .cached m2s_phys_to_cached(_non_cached_start) : {
  107. _cached_init = .;
  108. INIT_TEXT
  109. INIT_SETUP(16)
  110. INIT_CALLS
  111. CON_INITCALL
  112. SECURITY_INITCALL
  113. *(.text)
  114. SCHED_TEXT
  115. LOCK_TEXT
  116. KPROBES_TEXT
  117. _cached_end = .;
  118. }
  119. . = _non_cached_start + SIZEOF(.cached);
  120. #endif
  121. /*
  122. * In case we run parts of the kernel in embedded Flash,
  123. * relocate critical kernel code to that fast Flash.
  124. */
  125. #ifdef CONFIG_KERNEL_IN_ENVM
  126. _envm_loc = .;
  127. .envm ENVM_PHYS_OFFSET + CONFIG_KERNEL_IN_ENVM_OFFSET * 1024 : {
  128. _envm_start = .;
  129. #if CONFIG_KERNEL_IN_ENVM_SIZE>0
  130. INIT_TEXT
  131. INIT_SETUP(16)
  132. INIT_CALLS
  133. CON_INITCALL
  134. SECURITY_INITCALL
  135. INIT_RAM_FS
  136. __exception_text_start = .;
  137. *(.exception.text*)
  138. *(.exception.rodata*)
  139. __exception_text_end = .;
  140. SCHED_TEXT
  141. LOCK_TEXT
  142. KPROBES_TEXT
  143. usr/built-in.o(.text)
  144. usr/built-in.o(.rodata*)
  145. init/built-in.o(.text)
  146. init/built-in.o(.rodata*)
  147. mm/built-in.o(.text)
  148. mm/built-in.o(.rodata*)
  149. arch/arm/mm/built-in.o(.text)
  150. arch/arm/mm/built-in.o(.rodata*)
  151. arch/arm/common/built-in.o(.text)
  152. arch/arm/common/built-in.o(.rodata*)
  153. arch/arm/lib/lib.a(.text)
  154. arch/arm/lib/lib.a(.rodata*)
  155. arch/arm/lib/built-in.o(.text)
  156. arch/arm/lib/built-in.o(.rodata*)
  157. lib/built-in.o(.text)
  158. lib/built-in.o(.rodata*)
  159. #if CONFIG_KERNEL_IN_ENVM_SIZE>128
  160. kernel/built-in.o(.text)
  161. kernel/built-in.o(.rodata*)
  162. ipc/built-in.o(.text)
  163. ipc/built-in.o(.rodata*)
  164. block/built-in.o(.text)
  165. block/built-in.o(.rodata*)
  166. security/built-in.o(.text)
  167. security/built-in.o(.rodata*)
  168. crypto/built-in.o(.text)
  169. crypto/built-in.o(.rodata*)
  170. firmware/built-in.o(.text)
  171. firmware/built-in.o(.rodata*)
  172. #if CONFIG_KERNEL_IN_ENVM_SIZE>384
  173. drivers/built-in.o(.text)
  174. drivers/built-in.o(.rodata*)
  175. fs/built-in.o(.text)
  176. fs/built-in.o(.rodata*)
  177. net/built-in.o(.text)
  178. net/built-in.o(.rodata*)
  179. #endif /* CONFIG_KERNEL_IN_ENVM_SIZE>384 */
  180. #endif /* CONFIG_KERNEL_IN_ENVM_SIZE>128 */
  181. #endif /* CONFIG_KERNEL_IN_ENVM_SIZE>0 */
  182. _envm_end = .;
  183. }
  184. . = _envm_loc;
  185. #endif /* CONFIG_KERNEL_IN_ENVM */
  186. .text : { /* Real text segment */
  187. _text = .; /* Text and read-only data */
  188. __exception_text_start = .;
  189. *(.exception.text)
  190. __exception_text_end = .;
  191. #if defined(CONFIG_INITRAMFS_IS_LARGE)
  192. __proc_info_begin = .;
  193. *(.proc.info.init)
  194. __proc_info_end = .;
  195. #endif
  196. TEXT_TEXT
  197. SCHED_TEXT
  198. LOCK_TEXT
  199. KPROBES_TEXT
  200. #ifdef CONFIG_MMU
  201. *(.fixup)
  202. #endif
  203. *(.gnu.warning)
  204. *(.rodata)
  205. *(.rodata.*)
  206. *(.glue_7)
  207. *(.glue_7t)
  208. *(.got) /* Global offset table */
  209. }
  210. RO_DATA(PAGE_SIZE)
  211. _etext = .; /* End of text and rodata section */
  212. #ifdef CONFIG_ARM_UNWIND
  213. /*
  214. * Stack unwinding tables
  215. */
  216. . = ALIGN(8);
  217. .ARM.unwind_idx : {
  218. __start_unwind_idx = .;
  219. *(.ARM.exidx*)
  220. __stop_unwind_idx = .;
  221. }
  222. .ARM.unwind_tab : {
  223. __start_unwind_tab = .;
  224. *(.ARM.extab*)
  225. __stop_unwind_tab = .;
  226. }
  227. #endif
  228. #ifdef CONFIG_XIP_KERNEL
  229. __data_loc = ALIGN(4); /* location in binary */
  230. . = PAGE_OFFSET + TEXT_OFFSET;
  231. #else
  232. . = ALIGN(THREAD_SIZE);
  233. __data_loc = .;
  234. #endif
  235. .data : AT(__data_loc) {
  236. _data = .; /* address in memory */
  237. _sdata = .;
  238. /*
  239. * first, the init task union, aligned
  240. * to an 8192 byte boundary.
  241. */
  242. INIT_TASK_DATA(THREAD_SIZE)
  243. #ifdef CONFIG_XIP_KERNEL
  244. . = ALIGN(PAGE_SIZE);
  245. __init_begin = .;
  246. INIT_DATA
  247. . = ALIGN(PAGE_SIZE);
  248. __init_end = .;
  249. #endif
  250. NOSAVE_DATA
  251. CACHELINE_ALIGNED_DATA(32)
  252. /*
  253. * The exception fixup table (might need resorting at runtime)
  254. */
  255. . = ALIGN(32);
  256. __start___ex_table = .;
  257. #ifdef CONFIG_MMU
  258. *(__ex_table)
  259. #endif
  260. __stop___ex_table = .;
  261. /*
  262. * and the usual data section
  263. */
  264. DATA_DATA
  265. CONSTRUCTORS
  266. _edata = .;
  267. }
  268. _edata_loc = __data_loc + SIZEOF(.data);
  269. #ifdef SRAM_PHYS_OFFSET
  270. /*
  271. * SRAM code for Flash/SDRAM issue, see errata 2.8.7
  272. */
  273. . = ALIGN(PAGE_SIZE);
  274. __sram_loc = .;
  275. .sram SRAM_PHYS_OFFSET + vector_table_end - vector_table : AT(__sram_loc) {
  276. _sram_start = .;
  277. *(.sram.text)
  278. *(.sram.data)
  279. _sram_end = .;
  280. }
  281. _esram_loc = __sram_loc + SIZEOF(.sram);
  282. . = _esram_loc;
  283. . = ALIGN(4);
  284. #endif
  285. #ifdef CONFIG_HAVE_TCM
  286. /*
  287. * We align everything to a page boundary so we can
  288. * free it after init has commenced and TCM contents have
  289. * been copied to its destination.
  290. */
  291. .tcm_start : {
  292. . = ALIGN(PAGE_SIZE);
  293. __tcm_start = .;
  294. __itcm_start = .;
  295. }
  296. /*
  297. * Link these to the ITCM RAM
  298. * Put VMA to the TCM address and LMA to the common RAM
  299. * and we'll upload the contents from RAM to TCM and free
  300. * the used RAM after that.
  301. */
  302. .text_itcm ITCM_OFFSET : AT(__itcm_start)
  303. {
  304. __sitcm_text = .;
  305. *(.tcm.text)
  306. *(.tcm.rodata)
  307. . = ALIGN(4);
  308. __eitcm_text = .;
  309. }
  310. /*
  311. * Reset the dot pointer, this is needed to create the
  312. * relative __dtcm_start below (to be used as extern in code).
  313. */
  314. . = ADDR(.tcm_start) + SIZEOF(.tcm_start) + SIZEOF(.text_itcm);
  315. .dtcm_start : {
  316. __dtcm_start = .;
  317. }
  318. /* TODO: add remainder of ITCM as well, that can be used for data! */
  319. .data_dtcm DTCM_OFFSET : AT(__dtcm_start)
  320. {
  321. . = ALIGN(4);
  322. __sdtcm_data = .;
  323. *(.tcm.data)
  324. . = ALIGN(4);
  325. __edtcm_data = .;
  326. }
  327. /* Reset the dot pointer or the linker gets confused */
  328. . = ADDR(.dtcm_start) + SIZEOF(.data_dtcm);
  329. /* End marker for freeing TCM copy in linked object */
  330. .tcm_end : AT(ADDR(.dtcm_start) + SIZEOF(.data_dtcm)){
  331. . = ALIGN(PAGE_SIZE);
  332. __tcm_end = .;
  333. }
  334. #endif
  335. BSS_SECTION(0, 0, 0)
  336. _end = .;
  337. STABS_DEBUG
  338. .comment 0 : { *(.comment) }
  339. /* Default discards */
  340. DISCARDS
  341. }
  342. /*
  343. * These must never be empty
  344. * If you have to comment these two assert statements out, your
  345. * binutils is too old (for other reasons as well)
  346. */
  347. ASSERT((__proc_info_end - __proc_info_begin), "missing CPU support")
  348. ASSERT((__arch_info_end - __arch_info_begin), "no machine record defined")