sp_min.ld.S 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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. __TEXT_START__ = .;
  26. *entrypoint.o(.text*)
  27. *(SORT_BY_ALIGNMENT(.text*))
  28. *(.vectors)
  29. __TEXT_END_UNALIGNED__ = .;
  30. . = ALIGN(PAGE_SIZE);
  31. __TEXT_END__ = .;
  32. } >RAM
  33. /* .ARM.extab and .ARM.exidx are only added because Clang needs them */
  34. .ARM.extab . : {
  35. *(.ARM.extab* .gnu.linkonce.armextab.*)
  36. } >RAM
  37. .ARM.exidx . : {
  38. *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  39. } >RAM
  40. .rodata . : {
  41. __RODATA_START__ = .;
  42. *(SORT_BY_ALIGNMENT(.rodata*))
  43. RODATA_COMMON
  44. . = ALIGN(8);
  45. # include <lib/el3_runtime/pubsub_events.h>
  46. __RODATA_END_UNALIGNED__ = .;
  47. . = ALIGN(PAGE_SIZE);
  48. __RODATA_END__ = .;
  49. } >RAM
  50. #else /* SEPARATE_CODE_AND_RODATA */
  51. .ro . : {
  52. __RO_START__ = .;
  53. *entrypoint.o(.text*)
  54. *(SORT_BY_ALIGNMENT(.text*))
  55. *(SORT_BY_ALIGNMENT(.rodata*))
  56. RODATA_COMMON
  57. . = ALIGN(8);
  58. # include <lib/el3_runtime/pubsub_events.h>
  59. *(.vectors)
  60. __RO_END_UNALIGNED__ = .;
  61. /*
  62. * Memory page(s) mapped to this section will be marked as device
  63. * memory. No other unexpected data must creep in. Ensure that the rest
  64. * of the current memory page is unused.
  65. */
  66. . = ALIGN(PAGE_SIZE);
  67. __RO_END__ = .;
  68. } >RAM
  69. #endif /* SEPARATE_CODE_AND_RODATA */
  70. ASSERT(__CPU_OPS_END__ > __CPU_OPS_START__,
  71. "cpu_ops not defined for this platform.")
  72. __RW_START__ = .;
  73. DATA_SECTION >RAM
  74. RELA_SECTION >RAM
  75. #ifdef BL32_PROGBITS_LIMIT
  76. ASSERT(. <= BL32_PROGBITS_LIMIT, "BL32 progbits has exceeded its limit.")
  77. #endif /* BL32_PROGBITS_LIMIT */
  78. STACK_SECTION >RAM
  79. BSS_SECTION >RAM
  80. XLAT_TABLE_SECTION >RAM
  81. __BSS_SIZE__ = SIZEOF(.bss);
  82. #if USE_COHERENT_MEM
  83. /*
  84. * The base address of the coherent memory section must be page-aligned to
  85. * guarantee that the coherent data are stored on their own pages and are
  86. * not mixed with normal data. This is required to set up the correct
  87. * memory attributes for the coherent data page tables.
  88. */
  89. .coherent_ram (NOLOAD) : ALIGN(PAGE_SIZE) {
  90. __COHERENT_RAM_START__ = .;
  91. /*
  92. * Bakery locks are stored in coherent memory. Each lock's data is
  93. * contiguous and fully allocated by the compiler.
  94. */
  95. *(.bakery_lock)
  96. *(.tzfw_coherent_mem)
  97. __COHERENT_RAM_END_UNALIGNED__ = .;
  98. /*
  99. * Memory page(s) mapped to this section will be marked as device
  100. * memory. No other unexpected data must creep in. Ensure that the rest
  101. * of the current memory page is unused.
  102. */
  103. . = ALIGN(PAGE_SIZE);
  104. __COHERENT_RAM_END__ = .;
  105. } >RAM
  106. __COHERENT_RAM_UNALIGNED_SIZE__ =
  107. __COHERENT_RAM_END_UNALIGNED__ - __COHERENT_RAM_START__;
  108. #endif /* USE_COHERENT_MEM */
  109. __RW_END__ = .;
  110. __BL32_END__ = .;
  111. /DISCARD/ : {
  112. *(.dynsym .dynstr .hash .gnu.hash)
  113. }
  114. ASSERT(. <= BL32_LIMIT, "BL32 image has exceeded its limit.")
  115. RAM_REGION_END = .;
  116. }