u-boot.lds 4.6 KB

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