1c11ba852SSoby Mathew/* 2da04341eSChris Kay * Copyright (c) 2016-2023, Arm Limited and Contributors. All rights reserved. 3c11ba852SSoby Mathew * 482cb2c1aSdp-arm * SPDX-License-Identifier: BSD-3-Clause 5c11ba852SSoby Mathew */ 6c11ba852SSoby Mathew 7665e71b8SMasahiro Yamada#include <common/bl_common.ld.h> 809d40e0eSAntonio Nino Diaz#include <lib/xlat_tables/xlat_tables_defs.h> 9c11ba852SSoby Mathew 10c11ba852SSoby MathewOUTPUT_FORMAT(elf32-littlearm) 11c11ba852SSoby MathewOUTPUT_ARCH(arm) 12c11ba852SSoby MathewENTRY(sp_min_vector_table) 13c11ba852SSoby Mathew 14c11ba852SSoby MathewMEMORY { 15c11ba852SSoby Mathew RAM (rwx): ORIGIN = BL32_BASE, LENGTH = BL32_LIMIT - BL32_BASE 16c11ba852SSoby Mathew} 17c11ba852SSoby Mathew 1814e09cc4SHeiko Stuebner#ifdef PLAT_SP_MIN_EXTRA_LD_SCRIPT 1914e09cc4SHeiko Stuebner# include <plat_sp_min.ld.S> 20f90fe02fSChris Kay#endif /* PLAT_SP_MIN_EXTRA_LD_SCRIPT */ 21c11ba852SSoby Mathew 22f90fe02fSChris KaySECTIONS { 23*fcb72e16SHarrison Mutai RAM_REGION_START = ORIGIN(RAM); 24*fcb72e16SHarrison Mutai RAM_REGION_LENGTH = LENGTH(RAM); 25c11ba852SSoby Mathew . = BL32_BASE; 26f90fe02fSChris Kay 27a2aedac2SAntonio Nino Diaz ASSERT(. == ALIGN(PAGE_SIZE), 28c11ba852SSoby Mathew "BL32_BASE address is not aligned on a page boundary.") 29c11ba852SSoby Mathew 30c11ba852SSoby Mathew#if SEPARATE_CODE_AND_RODATA 31c11ba852SSoby Mathew .text . : { 32c11ba852SSoby Mathew __TEXT_START__ = .; 33f90fe02fSChris Kay 34c11ba852SSoby Mathew *entrypoint.o(.text*) 35b1f596b6SYann Gautier *(SORT_BY_ALIGNMENT(.text*)) 363bdf0e5dSYatharth Kochar *(.vectors) 37f90fe02fSChris Kay 385629b2b1SRoberto Vargas . = ALIGN(PAGE_SIZE); 39f90fe02fSChris Kay 40c11ba852SSoby Mathew __TEXT_END__ = .; 41c11ba852SSoby Mathew } >RAM 42c11ba852SSoby Mathew 43f90fe02fSChris Kay /* .ARM.extab and .ARM.exidx are only added because Clang needs them */ 44ad925094SRoberto Vargas .ARM.extab . : { 45ad925094SRoberto Vargas *(.ARM.extab* .gnu.linkonce.armextab.*) 46ad925094SRoberto Vargas } >RAM 47ad925094SRoberto Vargas 48ad925094SRoberto Vargas .ARM.exidx . : { 49ad925094SRoberto Vargas *(.ARM.exidx* .gnu.linkonce.armexidx.*) 50ad925094SRoberto Vargas } >RAM 51ad925094SRoberto Vargas 52c11ba852SSoby Mathew .rodata . : { 53c11ba852SSoby Mathew __RODATA_START__ = .; 54b1f596b6SYann Gautier *(SORT_BY_ALIGNMENT(.rodata*)) 55c11ba852SSoby Mathew 560a0a7a9aSMasahiro Yamada RODATA_COMMON 57c11ba852SSoby Mathew 588e743bcdSJeenu Viswambharan . = ALIGN(8); 59f90fe02fSChris Kay 6009d40e0eSAntonio Nino Diaz# include <lib/el3_runtime/pubsub_events.h> 618e743bcdSJeenu Viswambharan 625629b2b1SRoberto Vargas . = ALIGN(PAGE_SIZE); 63f90fe02fSChris Kay 64c11ba852SSoby Mathew __RODATA_END__ = .; 65c11ba852SSoby Mathew } >RAM 66f90fe02fSChris Kay#else /* SEPARATE_CODE_AND_RODATA */ 67da04341eSChris Kay .ro . : { 68c11ba852SSoby Mathew __RO_START__ = .; 69f90fe02fSChris Kay 70c11ba852SSoby Mathew *entrypoint.o(.text*) 71b1f596b6SYann Gautier *(SORT_BY_ALIGNMENT(.text*)) 72b1f596b6SYann Gautier *(SORT_BY_ALIGNMENT(.rodata*)) 73c11ba852SSoby Mathew 740a0a7a9aSMasahiro Yamada RODATA_COMMON 75c11ba852SSoby Mathew 768e743bcdSJeenu Viswambharan . = ALIGN(8); 77f90fe02fSChris Kay 7809d40e0eSAntonio Nino Diaz# include <lib/el3_runtime/pubsub_events.h> 798e743bcdSJeenu Viswambharan 803bdf0e5dSYatharth Kochar *(.vectors) 81f90fe02fSChris Kay 82c11ba852SSoby Mathew __RO_END_UNALIGNED__ = .; 83c11ba852SSoby Mathew 84c11ba852SSoby Mathew /* 85f90fe02fSChris Kay * Memory page(s) mapped to this section will be marked as device 86f90fe02fSChris Kay * memory. No other unexpected data must creep in. Ensure that the rest 87f90fe02fSChris Kay * of the current memory page is unused. 88c11ba852SSoby Mathew */ 895629b2b1SRoberto Vargas . = ALIGN(PAGE_SIZE); 90f90fe02fSChris Kay 91c11ba852SSoby Mathew __RO_END__ = .; 92c11ba852SSoby Mathew } >RAM 93f90fe02fSChris Kay#endif /* SEPARATE_CODE_AND_RODATA */ 94c11ba852SSoby Mathew 95c11ba852SSoby Mathew ASSERT(__CPU_OPS_END__ > __CPU_OPS_START__, 96c11ba852SSoby Mathew "cpu_ops not defined for this platform.") 97f90fe02fSChris Kay 98c11ba852SSoby Mathew __RW_START__ = .; 99c11ba852SSoby Mathew 100caa3e7e0SMasahiro Yamada DATA_SECTION >RAM 1014324a14bSYann Gautier RELA_SECTION >RAM 102c11ba852SSoby Mathew 1035744e874SSoby Mathew#ifdef BL32_PROGBITS_LIMIT 1045744e874SSoby Mathew ASSERT(. <= BL32_PROGBITS_LIMIT, "BL32 progbits has exceeded its limit.") 105f90fe02fSChris Kay#endif /* BL32_PROGBITS_LIMIT */ 1065744e874SSoby Mathew 107a926a9f6SMasahiro Yamada STACK_SECTION >RAM 108a7739bc7SMasahiro Yamada BSS_SECTION >RAM 109665e71b8SMasahiro Yamada XLAT_TABLE_SECTION >RAM 110c11ba852SSoby Mathew 111c11ba852SSoby Mathew __BSS_SIZE__ = SIZEOF(.bss); 112c11ba852SSoby Mathew 113c11ba852SSoby Mathew#if USE_COHERENT_MEM 114c11ba852SSoby Mathew /* 115f90fe02fSChris Kay * The base address of the coherent memory section must be page-aligned to 116f90fe02fSChris Kay * guarantee that the coherent data are stored on their own pages and are 117f90fe02fSChris Kay * not mixed with normal data. This is required to set up the correct 118c11ba852SSoby Mathew * memory attributes for the coherent data page tables. 119c11ba852SSoby Mathew */ 120da04341eSChris Kay .coherent_ram (NOLOAD) : ALIGN(PAGE_SIZE) { 121c11ba852SSoby Mathew __COHERENT_RAM_START__ = .; 122f90fe02fSChris Kay 123c11ba852SSoby Mathew /* 124f90fe02fSChris Kay * Bakery locks are stored in coherent memory. Each lock's data is 125f90fe02fSChris Kay * contiguous and fully allocated by the compiler. 126c11ba852SSoby Mathew */ 127da04341eSChris Kay *(.bakery_lock) 128da04341eSChris Kay *(.tzfw_coherent_mem) 129f90fe02fSChris Kay 130c11ba852SSoby Mathew __COHERENT_RAM_END_UNALIGNED__ = .; 131f90fe02fSChris Kay 132c11ba852SSoby Mathew /* 133f90fe02fSChris Kay * Memory page(s) mapped to this section will be marked as device 134f90fe02fSChris Kay * memory. No other unexpected data must creep in. Ensure that the rest 135f90fe02fSChris Kay * of the current memory page is unused. 136c11ba852SSoby Mathew */ 1375629b2b1SRoberto Vargas . = ALIGN(PAGE_SIZE); 138f90fe02fSChris Kay 139c11ba852SSoby Mathew __COHERENT_RAM_END__ = .; 140c11ba852SSoby Mathew } >RAM 141c11ba852SSoby Mathew 142c11ba852SSoby Mathew __COHERENT_RAM_UNALIGNED_SIZE__ = 143c11ba852SSoby Mathew __COHERENT_RAM_END_UNALIGNED__ - __COHERENT_RAM_START__; 144f90fe02fSChris Kay#endif /* USE_COHERENT_MEM */ 145c11ba852SSoby Mathew 146c11ba852SSoby Mathew __RW_END__ = .; 147c11ba852SSoby Mathew __BL32_END__ = .; 148fdd97d7cSYann Gautier 1494324a14bSYann Gautier /DISCARD/ : { 1504324a14bSYann Gautier *(.dynsym .dynstr .hash .gnu.hash) 1514324a14bSYann Gautier } 1524324a14bSYann Gautier 153fdd97d7cSYann Gautier ASSERT(. <= BL32_LIMIT, "BL32 image has exceeded its limit.") 154*fcb72e16SHarrison Mutai RAM_REGION_END = .; 155c11ba852SSoby Mathew} 156