1c11ba852SSoby Mathew/* 24324a14bSYann Gautier * Copyright (c) 2016-2021, 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> 20*f90fe02fSChris Kay#endif /* PLAT_SP_MIN_EXTRA_LD_SCRIPT */ 21c11ba852SSoby Mathew 22*f90fe02fSChris KaySECTIONS { 23c11ba852SSoby Mathew . = BL32_BASE; 24*f90fe02fSChris Kay 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__ = .; 31*f90fe02fSChris Kay 32c11ba852SSoby Mathew *entrypoint.o(.text*) 33b1f596b6SYann Gautier *(SORT_BY_ALIGNMENT(.text*)) 343bdf0e5dSYatharth Kochar *(.vectors) 35*f90fe02fSChris Kay 365629b2b1SRoberto Vargas . = ALIGN(PAGE_SIZE); 37*f90fe02fSChris Kay 38c11ba852SSoby Mathew __TEXT_END__ = .; 39c11ba852SSoby Mathew } >RAM 40c11ba852SSoby Mathew 41*f90fe02fSChris Kay /* .ARM.extab and .ARM.exidx are only added because Clang needs them */ 42ad925094SRoberto Vargas .ARM.extab . : { 43ad925094SRoberto Vargas *(.ARM.extab* .gnu.linkonce.armextab.*) 44ad925094SRoberto Vargas } >RAM 45ad925094SRoberto Vargas 46ad925094SRoberto Vargas .ARM.exidx . : { 47ad925094SRoberto Vargas *(.ARM.exidx* .gnu.linkonce.armexidx.*) 48ad925094SRoberto Vargas } >RAM 49ad925094SRoberto Vargas 50c11ba852SSoby Mathew .rodata . : { 51c11ba852SSoby Mathew __RODATA_START__ = .; 52b1f596b6SYann Gautier *(SORT_BY_ALIGNMENT(.rodata*)) 53c11ba852SSoby Mathew 540a0a7a9aSMasahiro Yamada RODATA_COMMON 55c11ba852SSoby Mathew 568e743bcdSJeenu Viswambharan . = ALIGN(8); 57*f90fe02fSChris Kay 5809d40e0eSAntonio Nino Diaz# include <lib/el3_runtime/pubsub_events.h> 598e743bcdSJeenu Viswambharan 605629b2b1SRoberto Vargas . = ALIGN(PAGE_SIZE); 61*f90fe02fSChris Kay 62c11ba852SSoby Mathew __RODATA_END__ = .; 63c11ba852SSoby Mathew } >RAM 64*f90fe02fSChris Kay#else /* SEPARATE_CODE_AND_RODATA */ 65c11ba852SSoby Mathew ro . : { 66c11ba852SSoby Mathew __RO_START__ = .; 67*f90fe02fSChris Kay 68c11ba852SSoby Mathew *entrypoint.o(.text*) 69b1f596b6SYann Gautier *(SORT_BY_ALIGNMENT(.text*)) 70b1f596b6SYann Gautier *(SORT_BY_ALIGNMENT(.rodata*)) 71c11ba852SSoby Mathew 720a0a7a9aSMasahiro Yamada RODATA_COMMON 73c11ba852SSoby Mathew 748e743bcdSJeenu Viswambharan . = ALIGN(8); 75*f90fe02fSChris Kay 7609d40e0eSAntonio Nino Diaz# include <lib/el3_runtime/pubsub_events.h> 778e743bcdSJeenu Viswambharan 783bdf0e5dSYatharth Kochar *(.vectors) 79*f90fe02fSChris Kay 80c11ba852SSoby Mathew __RO_END_UNALIGNED__ = .; 81c11ba852SSoby Mathew 82c11ba852SSoby Mathew /* 83*f90fe02fSChris Kay * Memory page(s) mapped to this section will be marked as device 84*f90fe02fSChris Kay * memory. No other unexpected data must creep in. Ensure that the rest 85*f90fe02fSChris Kay * of the current memory page is unused. 86c11ba852SSoby Mathew */ 875629b2b1SRoberto Vargas . = ALIGN(PAGE_SIZE); 88*f90fe02fSChris Kay 89c11ba852SSoby Mathew __RO_END__ = .; 90c11ba852SSoby Mathew } >RAM 91*f90fe02fSChris Kay#endif /* SEPARATE_CODE_AND_RODATA */ 92c11ba852SSoby Mathew 93c11ba852SSoby Mathew ASSERT(__CPU_OPS_END__ > __CPU_OPS_START__, 94c11ba852SSoby Mathew "cpu_ops not defined for this platform.") 95*f90fe02fSChris Kay 96c11ba852SSoby Mathew __RW_START__ = .; 97c11ba852SSoby Mathew 98caa3e7e0SMasahiro Yamada DATA_SECTION >RAM 994324a14bSYann Gautier RELA_SECTION >RAM 100c11ba852SSoby Mathew 1015744e874SSoby Mathew#ifdef BL32_PROGBITS_LIMIT 1025744e874SSoby Mathew ASSERT(. <= BL32_PROGBITS_LIMIT, "BL32 progbits has exceeded its limit.") 103*f90fe02fSChris Kay#endif /* BL32_PROGBITS_LIMIT */ 1045744e874SSoby Mathew 105a926a9f6SMasahiro Yamada STACK_SECTION >RAM 106a7739bc7SMasahiro Yamada BSS_SECTION >RAM 107665e71b8SMasahiro Yamada XLAT_TABLE_SECTION >RAM 108c11ba852SSoby Mathew 109c11ba852SSoby Mathew __BSS_SIZE__ = SIZEOF(.bss); 110c11ba852SSoby Mathew 111c11ba852SSoby Mathew#if USE_COHERENT_MEM 112c11ba852SSoby Mathew /* 113*f90fe02fSChris Kay * The base address of the coherent memory section must be page-aligned to 114*f90fe02fSChris Kay * guarantee that the coherent data are stored on their own pages and are 115*f90fe02fSChris Kay * not mixed with normal data. This is required to set up the correct 116c11ba852SSoby Mathew * memory attributes for the coherent data page tables. 117c11ba852SSoby Mathew */ 118a2aedac2SAntonio Nino Diaz coherent_ram (NOLOAD) : ALIGN(PAGE_SIZE) { 119c11ba852SSoby Mathew __COHERENT_RAM_START__ = .; 120*f90fe02fSChris Kay 121c11ba852SSoby Mathew /* 122*f90fe02fSChris Kay * Bakery locks are stored in coherent memory. Each lock's data is 123*f90fe02fSChris Kay * contiguous and fully allocated by the compiler. 124c11ba852SSoby Mathew */ 125c11ba852SSoby Mathew *(bakery_lock) 126c11ba852SSoby Mathew *(tzfw_coherent_mem) 127*f90fe02fSChris Kay 128c11ba852SSoby Mathew __COHERENT_RAM_END_UNALIGNED__ = .; 129*f90fe02fSChris Kay 130c11ba852SSoby Mathew /* 131*f90fe02fSChris Kay * Memory page(s) mapped to this section will be marked as device 132*f90fe02fSChris Kay * memory. No other unexpected data must creep in. Ensure that the rest 133*f90fe02fSChris Kay * of the current memory page is unused. 134c11ba852SSoby Mathew */ 1355629b2b1SRoberto Vargas . = ALIGN(PAGE_SIZE); 136*f90fe02fSChris Kay 137c11ba852SSoby Mathew __COHERENT_RAM_END__ = .; 138c11ba852SSoby Mathew } >RAM 139c11ba852SSoby Mathew 140c11ba852SSoby Mathew __COHERENT_RAM_UNALIGNED_SIZE__ = 141c11ba852SSoby Mathew __COHERENT_RAM_END_UNALIGNED__ - __COHERENT_RAM_START__; 142*f90fe02fSChris Kay#endif /* USE_COHERENT_MEM */ 143c11ba852SSoby Mathew 144c11ba852SSoby Mathew __RW_END__ = .; 145c11ba852SSoby Mathew __BL32_END__ = .; 146fdd97d7cSYann Gautier 1474324a14bSYann Gautier /DISCARD/ : { 1484324a14bSYann Gautier *(.dynsym .dynstr .hash .gnu.hash) 1494324a14bSYann Gautier } 1504324a14bSYann Gautier 151fdd97d7cSYann Gautier ASSERT(. <= BL32_LIMIT, "BL32 image has exceeded its limit.") 152c11ba852SSoby Mathew} 153