1c11ba852SSoby Mathew/* 2665e71b8SMasahiro Yamada * Copyright (c) 2016-2020, 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> 2014e09cc4SHeiko Stuebner#endif 21c11ba852SSoby Mathew 22c11ba852SSoby MathewSECTIONS 23c11ba852SSoby Mathew{ 24c11ba852SSoby Mathew . = BL32_BASE; 25a2aedac2SAntonio Nino Diaz ASSERT(. == ALIGN(PAGE_SIZE), 26c11ba852SSoby Mathew "BL32_BASE address is not aligned on a page boundary.") 27c11ba852SSoby Mathew 28c11ba852SSoby Mathew#if SEPARATE_CODE_AND_RODATA 29c11ba852SSoby Mathew .text . : { 30c11ba852SSoby Mathew __TEXT_START__ = .; 31c11ba852SSoby Mathew *entrypoint.o(.text*) 32*b1f596b6SYann Gautier *(SORT_BY_ALIGNMENT(.text*)) 333bdf0e5dSYatharth Kochar *(.vectors) 345629b2b1SRoberto Vargas . = ALIGN(PAGE_SIZE); 35c11ba852SSoby Mathew __TEXT_END__ = .; 36c11ba852SSoby Mathew } >RAM 37c11ba852SSoby Mathew 38ad925094SRoberto Vargas /* .ARM.extab and .ARM.exidx are only added because Clang need them */ 39ad925094SRoberto Vargas .ARM.extab . : { 40ad925094SRoberto Vargas *(.ARM.extab* .gnu.linkonce.armextab.*) 41ad925094SRoberto Vargas } >RAM 42ad925094SRoberto Vargas 43ad925094SRoberto Vargas .ARM.exidx . : { 44ad925094SRoberto Vargas *(.ARM.exidx* .gnu.linkonce.armexidx.*) 45ad925094SRoberto Vargas } >RAM 46ad925094SRoberto Vargas 47c11ba852SSoby Mathew .rodata . : { 48c11ba852SSoby Mathew __RODATA_START__ = .; 49*b1f596b6SYann Gautier *(SORT_BY_ALIGNMENT(.rodata*)) 50c11ba852SSoby Mathew 510a0a7a9aSMasahiro Yamada RODATA_COMMON 52c11ba852SSoby Mathew 538e743bcdSJeenu Viswambharan /* Place pubsub sections for events */ 548e743bcdSJeenu Viswambharan . = ALIGN(8); 5509d40e0eSAntonio Nino Diaz#include <lib/el3_runtime/pubsub_events.h> 568e743bcdSJeenu Viswambharan 575629b2b1SRoberto Vargas . = ALIGN(PAGE_SIZE); 58c11ba852SSoby Mathew __RODATA_END__ = .; 59c11ba852SSoby Mathew } >RAM 60c11ba852SSoby Mathew#else 61c11ba852SSoby Mathew ro . : { 62c11ba852SSoby Mathew __RO_START__ = .; 63c11ba852SSoby Mathew *entrypoint.o(.text*) 64*b1f596b6SYann Gautier *(SORT_BY_ALIGNMENT(.text*)) 65*b1f596b6SYann Gautier *(SORT_BY_ALIGNMENT(.rodata*)) 66c11ba852SSoby Mathew 670a0a7a9aSMasahiro Yamada RODATA_COMMON 68c11ba852SSoby Mathew 698e743bcdSJeenu Viswambharan /* Place pubsub sections for events */ 708e743bcdSJeenu Viswambharan . = ALIGN(8); 7109d40e0eSAntonio Nino Diaz#include <lib/el3_runtime/pubsub_events.h> 728e743bcdSJeenu Viswambharan 733bdf0e5dSYatharth Kochar *(.vectors) 74c11ba852SSoby Mathew __RO_END_UNALIGNED__ = .; 75c11ba852SSoby Mathew 76c11ba852SSoby Mathew /* 77c11ba852SSoby Mathew * Memory page(s) mapped to this section will be marked as 78c11ba852SSoby Mathew * read-only, executable. No RW data from the next section must 79*b1f596b6SYann Gautier * creep in. Ensure the rest of the current memory page is unused. 80c11ba852SSoby Mathew */ 815629b2b1SRoberto Vargas . = ALIGN(PAGE_SIZE); 82c11ba852SSoby Mathew __RO_END__ = .; 83c11ba852SSoby Mathew } >RAM 84c11ba852SSoby Mathew#endif 85c11ba852SSoby Mathew 86c11ba852SSoby Mathew ASSERT(__CPU_OPS_END__ > __CPU_OPS_START__, 87c11ba852SSoby Mathew "cpu_ops not defined for this platform.") 88c11ba852SSoby Mathew /* 89c11ba852SSoby Mathew * Define a linker symbol to mark start of the RW memory area for this 90c11ba852SSoby Mathew * image. 91c11ba852SSoby Mathew */ 92c11ba852SSoby Mathew __RW_START__ = . ; 93c11ba852SSoby Mathew 94caa3e7e0SMasahiro Yamada DATA_SECTION >RAM 95c11ba852SSoby Mathew 965744e874SSoby Mathew#ifdef BL32_PROGBITS_LIMIT 975744e874SSoby Mathew ASSERT(. <= BL32_PROGBITS_LIMIT, "BL32 progbits has exceeded its limit.") 985744e874SSoby Mathew#endif 995744e874SSoby Mathew 100a926a9f6SMasahiro Yamada STACK_SECTION >RAM 101a7739bc7SMasahiro Yamada BSS_SECTION >RAM 102665e71b8SMasahiro Yamada XLAT_TABLE_SECTION >RAM 103c11ba852SSoby Mathew 104c11ba852SSoby Mathew __BSS_SIZE__ = SIZEOF(.bss); 105c11ba852SSoby Mathew 106c11ba852SSoby Mathew#if USE_COHERENT_MEM 107c11ba852SSoby Mathew /* 108c11ba852SSoby Mathew * The base address of the coherent memory section must be page-aligned (4K) 109c11ba852SSoby Mathew * to guarantee that the coherent data are stored on their own pages and 110c11ba852SSoby Mathew * are not mixed with normal data. This is required to set up the correct 111c11ba852SSoby Mathew * memory attributes for the coherent data page tables. 112c11ba852SSoby Mathew */ 113a2aedac2SAntonio Nino Diaz coherent_ram (NOLOAD) : ALIGN(PAGE_SIZE) { 114c11ba852SSoby Mathew __COHERENT_RAM_START__ = .; 115c11ba852SSoby Mathew /* 116c11ba852SSoby Mathew * Bakery locks are stored in coherent memory 117c11ba852SSoby Mathew * 118c11ba852SSoby Mathew * Each lock's data is contiguous and fully allocated by the compiler 119c11ba852SSoby Mathew */ 120c11ba852SSoby Mathew *(bakery_lock) 121c11ba852SSoby Mathew *(tzfw_coherent_mem) 122c11ba852SSoby Mathew __COHERENT_RAM_END_UNALIGNED__ = .; 123c11ba852SSoby Mathew /* 124c11ba852SSoby Mathew * Memory page(s) mapped to this section will be marked 125c11ba852SSoby Mathew * as device memory. No other unexpected data must creep in. 126c11ba852SSoby Mathew * Ensure the rest of the current memory page is unused. 127c11ba852SSoby Mathew */ 1285629b2b1SRoberto Vargas . = ALIGN(PAGE_SIZE); 129c11ba852SSoby Mathew __COHERENT_RAM_END__ = .; 130c11ba852SSoby Mathew } >RAM 131c11ba852SSoby Mathew 132c11ba852SSoby Mathew __COHERENT_RAM_UNALIGNED_SIZE__ = 133c11ba852SSoby Mathew __COHERENT_RAM_END_UNALIGNED__ - __COHERENT_RAM_START__; 134c11ba852SSoby Mathew#endif 135c11ba852SSoby Mathew 136c11ba852SSoby Mathew /* 137*b1f596b6SYann Gautier * Define a linker symbol to mark the end of the RW memory area for this 138c11ba852SSoby Mathew * image. 139c11ba852SSoby Mathew */ 140c11ba852SSoby Mathew __RW_END__ = .; 141c11ba852SSoby Mathew 142c11ba852SSoby Mathew __BL32_END__ = .; 143c11ba852SSoby Mathew} 144