u-boot.lds 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  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. *(.text*)
  44. }
  45. #ifdef CONFIG_ARMV7_NONSEC
  46. /* Align the secure section only if we're going to use it in situ */
  47. .__secure_start :
  48. #ifndef CONFIG_ARMV7_SECURE_BASE
  49. ALIGN(CONSTANT(COMMONPAGESIZE))
  50. #endif
  51. {
  52. KEEP(*(.__secure_start))
  53. }
  54. #ifndef CONFIG_ARMV7_SECURE_BASE
  55. #define CONFIG_ARMV7_SECURE_BASE
  56. #define __ARMV7_PSCI_STACK_IN_RAM
  57. #endif
  58. .secure_text CONFIG_ARMV7_SECURE_BASE :
  59. AT(ADDR(.__secure_start) + SIZEOF(.__secure_start))
  60. {
  61. *(._secure.text)
  62. }
  63. .secure_data : AT(LOADADDR(.secure_text) + SIZEOF(.secure_text))
  64. {
  65. *(._secure.data)
  66. }
  67. #ifdef CONFIG_ARMV7_PSCI
  68. .secure_stack ALIGN(ADDR(.secure_data) + SIZEOF(.secure_data),
  69. CONSTANT(COMMONPAGESIZE)) (NOLOAD) :
  70. #ifdef __ARMV7_PSCI_STACK_IN_RAM
  71. AT(ADDR(.secure_stack))
  72. #else
  73. AT(LOADADDR(.secure_data) + SIZEOF(.secure_data))
  74. #endif
  75. {
  76. KEEP(*(.__secure_stack_start))
  77. /* Skip addreses for stack */
  78. . = . + CONFIG_ARMV7_PSCI_NR_CPUS * ARM_PSCI_STACK_SIZE;
  79. /* Align end of stack section to page boundary */
  80. . = ALIGN(CONSTANT(COMMONPAGESIZE));
  81. KEEP(*(.__secure_stack_end))
  82. #ifdef CONFIG_ARMV7_SECURE_MAX_SIZE
  83. /*
  84. * We are not checking (__secure_end - __secure_start) here,
  85. * as these are the load addresses, and do not include the
  86. * stack section. Instead, use the end of the stack section
  87. * and the start of the text section.
  88. */
  89. ASSERT((. - ADDR(.secure_text)) <= CONFIG_ARMV7_SECURE_MAX_SIZE,
  90. "Error: secure section exceeds secure memory size");
  91. #endif
  92. }
  93. #ifndef __ARMV7_PSCI_STACK_IN_RAM
  94. /* Reset VMA but don't allocate space if we have secure SRAM */
  95. . = LOADADDR(.secure_stack);
  96. #endif
  97. #endif
  98. .__secure_end : AT(ADDR(.__secure_end)) {
  99. *(.__secure_end)
  100. LONG(0x1d1071c); /* Must output something to reset LMA */
  101. }
  102. #endif
  103. . = ALIGN(4);
  104. .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
  105. . = ALIGN(4);
  106. .data : {
  107. *(.data*)
  108. }
  109. . = ALIGN(4);
  110. . = .;
  111. . = ALIGN(4);
  112. .u_boot_list : {
  113. KEEP(*(SORT(.u_boot_list*)));
  114. }
  115. . = ALIGN(4);
  116. .__efi_runtime_start : {
  117. *(.__efi_runtime_start)
  118. }
  119. .efi_runtime : {
  120. *(efi_runtime_text)
  121. *(efi_runtime_data)
  122. }
  123. .__efi_runtime_stop : {
  124. *(.__efi_runtime_stop)
  125. }
  126. .efi_runtime_rel_start :
  127. {
  128. *(.__efi_runtime_rel_start)
  129. }
  130. .efi_runtime_rel : {
  131. *(.relefi_runtime_text)
  132. *(.relefi_runtime_data)
  133. }
  134. .efi_runtime_rel_stop :
  135. {
  136. *(.__efi_runtime_rel_stop)
  137. }
  138. . = ALIGN(4);
  139. .image_copy_end :
  140. {
  141. *(.__image_copy_end)
  142. }
  143. .rel_dyn_start :
  144. {
  145. *(.__rel_dyn_start)
  146. }
  147. .rel.dyn : {
  148. *(.rel*)
  149. }
  150. .rel_dyn_end :
  151. {
  152. *(.__rel_dyn_end)
  153. }
  154. .end :
  155. {
  156. *(.__end)
  157. }
  158. _image_binary_end = .;
  159. /*
  160. * Deprecated: this MMU section is used by pxa at present but
  161. * should not be used by new boards/CPUs.
  162. */
  163. . = ALIGN(4096);
  164. .mmutable : {
  165. *(.mmutable)
  166. }
  167. /*
  168. * Compiler-generated __bss_start and __bss_end, see arch/arm/lib/bss.c
  169. * __bss_base and __bss_limit are for linker only (overlay ordering)
  170. */
  171. .bss_start __rel_dyn_start (OVERLAY) : {
  172. KEEP(*(.__bss_start));
  173. __bss_base = .;
  174. }
  175. .bss __bss_base (OVERLAY) : {
  176. *(.bss*)
  177. . = ALIGN(4);
  178. __bss_limit = .;
  179. }
  180. .bss_end __bss_limit (OVERLAY) : {
  181. KEEP(*(.__bss_end));
  182. }
  183. .dynsym _image_binary_end : { *(.dynsym) }
  184. .dynbss : { *(.dynbss) }
  185. .dynstr : { *(.dynstr*) }
  186. .dynamic : { *(.dynamic*) }
  187. .plt : { *(.plt*) }
  188. .interp : { *(.interp*) }
  189. .gnu.hash : { *(.gnu.hash) }
  190. .gnu : { *(.gnu*) }
  191. .ARM.exidx : { *(.ARM.exidx*) }
  192. .gnu.linkonce.armexidx : { *(.gnu.linkonce.armexidx.*) }
  193. }