sp_min.ld.S 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. /*
  2. * Copyright (c) 2016-2023, Arm Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <common/bl_common.ld.h>
  7. #include <lib/xlat_tables/xlat_tables_defs.h>
  8. OUTPUT_FORMAT(elf32-littlearm)
  9. OUTPUT_ARCH(arm)
  10. ENTRY(sp_min_vector_table)
  11. MEMORY {
  12. RAM (rwx): ORIGIN = BL32_BASE, LENGTH = BL32_LIMIT - BL32_BASE
  13. }
  14. #ifdef PLAT_SP_MIN_EXTRA_LD_SCRIPT
  15. # include <plat_sp_min.ld.S>
  16. #endif /* PLAT_SP_MIN_EXTRA_LD_SCRIPT */
  17. SECTIONS {
  18. RAM_REGION_START = ORIGIN(RAM);
  19. RAM_REGION_LENGTH = LENGTH(RAM);
  20. . = BL32_BASE;
  21. ASSERT(. == ALIGN(PAGE_SIZE),
  22. "BL32_BASE address is not aligned on a page boundary.")
  23. #if SEPARATE_CODE_AND_RODATA
  24. .text . : {
  25. ASSERT(. == ALIGN(PAGE_SIZE),
  26. ".text address is not aligned on a page boundary.");
  27. __TEXT_START__ = .;
  28. *entrypoint.o(.text*)
  29. *(SORT_BY_ALIGNMENT(.text*))
  30. *(.vectors)
  31. __TEXT_END_UNALIGNED__ = .;
  32. . = ALIGN(PAGE_SIZE);
  33. __TEXT_END__ = .;
  34. } >RAM
  35. /* .ARM.extab and .ARM.exidx are only added because Clang needs them */
  36. .ARM.extab . : {
  37. *(.ARM.extab* .gnu.linkonce.armextab.*)
  38. } >RAM
  39. .ARM.exidx . : {
  40. *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  41. } >RAM
  42. .rodata . : {
  43. __RODATA_START__ = .;
  44. *(SORT_BY_ALIGNMENT(.rodata*))
  45. RODATA_COMMON
  46. . = ALIGN(8);
  47. # include <lib/el3_runtime/pubsub_events.h>
  48. __RODATA_END_UNALIGNED__ = .;
  49. . = ALIGN(PAGE_SIZE);
  50. __RODATA_END__ = .;
  51. } >RAM
  52. #else /* SEPARATE_CODE_AND_RODATA */
  53. .ro . : {
  54. ASSERT(. == ALIGN(PAGE_SIZE),
  55. ".ro address is not aligned on a page boundary.");
  56. __RO_START__ = .;
  57. *entrypoint.o(.text*)
  58. *(SORT_BY_ALIGNMENT(.text*))
  59. *(SORT_BY_ALIGNMENT(.rodata*))
  60. RODATA_COMMON
  61. . = ALIGN(8);
  62. # include <lib/el3_runtime/pubsub_events.h>
  63. *(.vectors)
  64. __RO_END_UNALIGNED__ = .;
  65. /*
  66. * Memory page(s) mapped to this section will be marked as device
  67. * memory. No other unexpected data must creep in. Ensure that the rest
  68. * of the current memory page is unused.
  69. */
  70. . = ALIGN(PAGE_SIZE);
  71. __RO_END__ = .;
  72. } >RAM
  73. #endif /* SEPARATE_CODE_AND_RODATA */
  74. ASSERT(__CPU_OPS_END__ > __CPU_OPS_START__,
  75. "cpu_ops not defined for this platform.")
  76. __RW_START__ = .;
  77. DATA_SECTION >RAM
  78. RELA_SECTION >RAM
  79. #ifdef BL32_PROGBITS_LIMIT
  80. ASSERT(. <= BL32_PROGBITS_LIMIT, "BL32 progbits has exceeded its limit.")
  81. #endif /* BL32_PROGBITS_LIMIT */
  82. STACK_SECTION >RAM
  83. BSS_SECTION >RAM
  84. XLAT_TABLE_SECTION >RAM
  85. __BSS_SIZE__ = SIZEOF(.bss);
  86. #if USE_COHERENT_MEM
  87. /*
  88. * The base address of the coherent memory section must be page-aligned to
  89. * guarantee that the coherent data are stored on their own pages and are
  90. * not mixed with normal data. This is required to set up the correct
  91. * memory attributes for the coherent data page tables.
  92. */
  93. .coherent_ram (NOLOAD) : ALIGN(PAGE_SIZE) {
  94. __COHERENT_RAM_START__ = .;
  95. /*
  96. * Bakery locks are stored in coherent memory. Each lock's data is
  97. * contiguous and fully allocated by the compiler.
  98. */
  99. *(.bakery_lock)
  100. *(.tzfw_coherent_mem)
  101. __COHERENT_RAM_END_UNALIGNED__ = .;
  102. /*
  103. * Memory page(s) mapped to this section will be marked as device
  104. * memory. No other unexpected data must creep in. Ensure that the rest
  105. * of the current memory page is unused.
  106. */
  107. . = ALIGN(PAGE_SIZE);
  108. __COHERENT_RAM_END__ = .;
  109. } >RAM
  110. __COHERENT_RAM_UNALIGNED_SIZE__ =
  111. __COHERENT_RAM_END_UNALIGNED__ - __COHERENT_RAM_START__;
  112. #endif /* USE_COHERENT_MEM */
  113. __RW_END__ = .;
  114. __BL32_END__ = .;
  115. /DISCARD/ : {
  116. *(.dynsym .dynstr .hash .gnu.hash)
  117. }
  118. ASSERT(. <= BL32_LIMIT, "BL32 image has exceeded its limit.")
  119. RAM_REGION_END = .;
  120. }