u-boot.lds 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright (c) 2004-2008 Texas Instruments
  4. *
  5. * (C) Copyright 2002
  6. * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
  7. */
  8. #include <config.h>
  9. #include <asm/psci.h>
  10. OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
  11. OUTPUT_ARCH(arm)
  12. ENTRY(_start)
  13. SECTIONS
  14. {
  15. #ifndef CONFIG_CMDLINE
  16. /DISCARD/ : { *(.u_boot_list_2_cmd_*) }
  17. #endif
  18. #if defined(CONFIG_ARMV7_SECURE_BASE) && defined(CONFIG_ARMV7_NONSEC)
  19. /*
  20. * If CONFIG_ARMV7_SECURE_BASE is true, secure code will not
  21. * bundle with u-boot, and code offsets are fixed. Secure zone
  22. * only needs to be copied from the loading address to
  23. * CONFIG_ARMV7_SECURE_BASE, which is the linking and running
  24. * address for secure code.
  25. *
  26. * If CONFIG_ARMV7_SECURE_BASE is undefined, the secure zone will
  27. * be included in u-boot address space, and some absolute address
  28. * were used in secure code. The absolute addresses of the secure
  29. * code also needs to be relocated along with the accompanying u-boot
  30. * code.
  31. *
  32. * So DISCARD is only for CONFIG_ARMV7_SECURE_BASE.
  33. */
  34. /DISCARD/ : { *(.rel._secure*) }
  35. #endif
  36. . = 0x00000000;
  37. . = ALIGN(4);
  38. .text :
  39. {
  40. *(.__image_copy_start)
  41. *(.vectors)
  42. CPUDIR/start.o (.text*)
  43. }
  44. /* This needs to come before *(.text*) */
  45. .__efi_runtime_start : {
  46. *(.__efi_runtime_start)
  47. }
  48. .efi_runtime : {
  49. *(.text.efi_runtime*)
  50. *(.rodata.efi_runtime*)
  51. *(.data.efi_runtime*)
  52. }
  53. .__efi_runtime_stop : {
  54. *(.__efi_runtime_stop)
  55. }
  56. .text_rest :
  57. {
  58. *(.text*)
  59. }
  60. #ifdef CONFIG_ARMV7_NONSEC
  61. /* Align the secure section only if we're going to use it in situ */
  62. .__secure_start
  63. #ifndef CONFIG_ARMV7_SECURE_BASE
  64. ALIGN(CONSTANT(COMMONPAGESIZE))
  65. #endif
  66. : {
  67. KEEP(*(.__secure_start))
  68. }
  69. #ifndef CONFIG_ARMV7_SECURE_BASE
  70. #define CONFIG_ARMV7_SECURE_BASE
  71. #define __ARMV7_PSCI_STACK_IN_RAM
  72. #endif
  73. .secure_text CONFIG_ARMV7_SECURE_BASE :
  74. AT(ADDR(.__secure_start) + SIZEOF(.__secure_start))
  75. {
  76. *(._secure.text)
  77. }
  78. .secure_data : AT(LOADADDR(.secure_text) + SIZEOF(.secure_text))
  79. {
  80. *(._secure.data)
  81. }
  82. #ifdef CONFIG_ARMV7_PSCI
  83. .secure_stack ALIGN(ADDR(.secure_data) + SIZEOF(.secure_data),
  84. CONSTANT(COMMONPAGESIZE)) (NOLOAD) :
  85. #ifdef __ARMV7_PSCI_STACK_IN_RAM
  86. AT(ADDR(.secure_stack))
  87. #else
  88. AT(LOADADDR(.secure_data) + SIZEOF(.secure_data))
  89. #endif
  90. {
  91. KEEP(*(.__secure_stack_start))
  92. /* Skip addreses for stack */
  93. . = . + CONFIG_ARMV7_PSCI_NR_CPUS * ARM_PSCI_STACK_SIZE;
  94. /* Align end of stack section to page boundary */
  95. . = ALIGN(CONSTANT(COMMONPAGESIZE));
  96. KEEP(*(.__secure_stack_end))
  97. #ifdef CONFIG_ARMV7_SECURE_MAX_SIZE
  98. /*
  99. * We are not checking (__secure_end - __secure_start) here,
  100. * as these are the load addresses, and do not include the
  101. * stack section. Instead, use the end of the stack section
  102. * and the start of the text section.
  103. */
  104. ASSERT((. - ADDR(.secure_text)) <= CONFIG_ARMV7_SECURE_MAX_SIZE,
  105. "Error: secure section exceeds secure memory size");
  106. #endif
  107. }
  108. #ifndef __ARMV7_PSCI_STACK_IN_RAM
  109. /* Reset VMA but don't allocate space if we have secure SRAM */
  110. . = LOADADDR(.secure_stack);
  111. #endif
  112. #endif
  113. .__secure_end : AT(ADDR(.__secure_end)) {
  114. *(.__secure_end)
  115. LONG(0x1d1071c); /* Must output something to reset LMA */
  116. }
  117. #endif
  118. . = ALIGN(4);
  119. .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
  120. . = ALIGN(4);
  121. .data : {
  122. *(.data*)
  123. }
  124. . = ALIGN(4);
  125. . = .;
  126. . = ALIGN(4);
  127. .u_boot_list : {
  128. KEEP(*(SORT(.u_boot_list*)));
  129. }
  130. . = ALIGN(4);
  131. .efi_runtime_rel_start :
  132. {
  133. *(.__efi_runtime_rel_start)
  134. }
  135. .efi_runtime_rel : {
  136. *(.rel*.efi_runtime)
  137. *(.rel*.efi_runtime.*)
  138. }
  139. .efi_runtime_rel_stop :
  140. {
  141. *(.__efi_runtime_rel_stop)
  142. }
  143. . = ALIGN(4);
  144. .image_copy_end :
  145. {
  146. *(.__image_copy_end)
  147. }
  148. .rel_dyn_start :
  149. {
  150. *(.__rel_dyn_start)
  151. }
  152. .rel.dyn : {
  153. *(.rel*)
  154. }
  155. .rel_dyn_end :
  156. {
  157. *(.__rel_dyn_end)
  158. }
  159. .end :
  160. {
  161. *(.__end)
  162. }
  163. _image_binary_end = .;
  164. /*
  165. * Deprecated: this MMU section is used by pxa at present but
  166. * should not be used by new boards/CPUs.
  167. */
  168. . = ALIGN(4096);
  169. .mmutable : {
  170. *(.mmutable)
  171. }
  172. /*
  173. * Compiler-generated __bss_start and __bss_end, see arch/arm/lib/bss.c
  174. * __bss_base and __bss_limit are for linker only (overlay ordering)
  175. */
  176. .bss_start __rel_dyn_start (OVERLAY) : {
  177. KEEP(*(.__bss_start));
  178. __bss_base = .;
  179. }
  180. .bss __bss_base (OVERLAY) : {
  181. *(.bss*)
  182. . = ALIGN(4);
  183. __bss_limit = .;
  184. }
  185. .bss_end __bss_limit (OVERLAY) : {
  186. KEEP(*(.__bss_end));
  187. }
  188. .dynsym _image_binary_end : { *(.dynsym) }
  189. .dynbss : { *(.dynbss) }
  190. .dynstr : { *(.dynstr*) }
  191. .dynamic : { *(.dynamic*) }
  192. .plt : { *(.plt*) }
  193. .interp : { *(.interp*) }
  194. .gnu.hash : { *(.gnu.hash) }
  195. .gnu : { *(.gnu*) }
  196. .ARM.exidx : { *(.ARM.exidx*) }
  197. .gnu.linkonce.armexidx : { *(.gnu.linkonce.armexidx.*) }
  198. }