sp_min.ld.S 3.6 KB

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