Skip to content

Commit

Permalink
build: always prefix section names with .
Browse files Browse the repository at this point in the history
Some of our specialized sections are not prefixed with the conventional
period. The compiler uses input section names to derive certain other
section names (e.g. `.rela.text`, `.relacpu_ops`), and these can be
difficult to select in linker scripts when there is a lack of a
delimiter.

This change introduces the period prefix to all specialized section
names.

BREAKING-CHANGE: All input and output linker section names have been
 prefixed with the period character, e.g. `cpu_ops` -> `.cpu_ops`.

Change-Id: I51c13c5266d5975fbd944ef4961328e72f82fc1c
Signed-off-by: Chris Kay <[email protected]>
  • Loading branch information
CJKay committed Feb 20, 2023
1 parent ac98b82 commit da04341
Show file tree
Hide file tree
Showing 57 changed files with 135 additions and 135 deletions.
8 changes: 4 additions & 4 deletions bl1/bl1.ld.S
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2020, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2013-2023, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
Expand Down Expand Up @@ -72,7 +72,7 @@ SECTIONS {
. = ALIGN(16);
} >ROM
#else /* SEPARATE_CODE_AND_RODATA */
ro . : {
.ro . : {
__RO_START__ = .;

*bl1_entrypoint.o(.text*)
Expand Down Expand Up @@ -118,9 +118,9 @@ SECTIONS {
* not mixed with normal data. This is required to set up the correct memory
* attributes for the coherent data page tables.
*/
coherent_ram (NOLOAD) : ALIGN(PAGE_SIZE) {
.coherent_ram (NOLOAD) : ALIGN(PAGE_SIZE) {
__COHERENT_RAM_START__ = .;
*(tzfw_coherent_mem)
*(.tzfw_coherent_mem)
__COHERENT_RAM_END_UNALIGNED__ = .;

/*
Expand Down
8 changes: 4 additions & 4 deletions bl2/bl2.ld.S
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2021, Arm Limited and Contributors. All rights reserved.
* Copyright (c) 2013-2023, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
Expand Down Expand Up @@ -60,7 +60,7 @@ SECTIONS {
__RODATA_END__ = .;
} >RAM
#else /* SEPARATE_CODE_AND_RODATA */
ro . : {
.ro . : {
__RO_START__ = .;

*bl2_entrypoint.o(.text*)
Expand Down Expand Up @@ -98,9 +98,9 @@ SECTIONS {
* not mixed with normal data. This is required to set up the correct
* memory attributes for the coherent data page tables.
*/
coherent_ram (NOLOAD) : ALIGN(PAGE_SIZE) {
.coherent_ram (NOLOAD) : ALIGN(PAGE_SIZE) {
__COHERENT_RAM_START__ = .;
*(tzfw_coherent_mem)
*(.tzfw_coherent_mem)
__COHERENT_RAM_END_UNALIGNED__ = .;

/*
Expand Down
8 changes: 4 additions & 4 deletions bl2/bl2_el3.ld.S
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017-2022, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2017-2023, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
Expand Down Expand Up @@ -76,7 +76,7 @@ SECTIONS {
ASSERT(__TEXT_RESIDENT_END__ - __TEXT_RESIDENT_START__ <= PAGE_SIZE,
"Resident part of BL2 has exceeded its limit.")
#else /* SEPARATE_CODE_AND_RODATA */
ro . : {
.ro . : {
__RO_START__ = .;
__TEXT_RESIDENT_START__ = .;

Expand Down Expand Up @@ -149,10 +149,10 @@ SECTIONS {
* not mixed with normal data. This is required to set up the correct
* memory attributes for the coherent data page tables.
*/
coherent_ram (NOLOAD) : ALIGN(PAGE_SIZE) {
.coherent_ram (NOLOAD) : ALIGN(PAGE_SIZE) {
__COHERENT_RAM_START__ = .;

*(tzfw_coherent_mem)
*(.tzfw_coherent_mem)

__COHERENT_RAM_END_UNALIGNED__ = .;

Expand Down
8 changes: 4 additions & 4 deletions bl2u/bl2u.ld.S
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015-2020, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2015-2023, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
Expand Down Expand Up @@ -55,7 +55,7 @@ SECTIONS {
__RODATA_END__ = .;
} >RAM
#else /* SEPARATE_CODE_AND_RODATA */
ro . : {
.ro . : {
__RO_START__ = .;

*bl2u_entrypoint.o(.text*)
Expand Down Expand Up @@ -93,9 +93,9 @@ SECTIONS {
* not mixed with normal data. This is required to set up the correct
* memory attributes for the coherent data page tables.
*/
coherent_ram (NOLOAD) : ALIGN(PAGE_SIZE) {
.coherent_ram (NOLOAD) : ALIGN(PAGE_SIZE) {
__COHERENT_RAM_START__ = .;
*(tzfw_coherent_mem)
*(.tzfw_coherent_mem)
__COHERENT_RAM_END_UNALIGNED__ = .;

/*
Expand Down
16 changes: 8 additions & 8 deletions bl31/bl31.ld.S
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2020, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2013-2023, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
Expand Down Expand Up @@ -66,7 +66,7 @@ SECTIONS {
__RODATA_END__ = .;
} >RAM
#else /* SEPARATE_CODE_AND_RODATA */
ro . : {
.ro . : {
__RO_START__ = .;

*bl31_entrypoint.o(.text*)
Expand Down Expand Up @@ -111,7 +111,7 @@ SECTIONS {
* There's no need to include this into the RO section of BL31 because it
* doesn't need to be accessed by BL31.
*/
spm_shim_exceptions : ALIGN(PAGE_SIZE) {
.spm_shim_exceptions : ALIGN(PAGE_SIZE) {
__SPM_SHIM_EXCEPTIONS_START__ = .;

*(.spm_shim_exceptions)
Expand All @@ -121,9 +121,9 @@ SECTIONS {
__SPM_SHIM_EXCEPTIONS_END__ = .;
} >SPM_SHIM_EXCEPTIONS_VMA AT>RAM

PROVIDE(__SPM_SHIM_EXCEPTIONS_LMA__ = LOADADDR(spm_shim_exceptions));
PROVIDE(__SPM_SHIM_EXCEPTIONS_LMA__ = LOADADDR(.spm_shim_exceptions));

. = LOADADDR(spm_shim_exceptions) + SIZEOF(spm_shim_exceptions);
. = LOADADDR(.spm_shim_exceptions) + SIZEOF(.spm_shim_exceptions);
#endif /* SPM_MM */

__RW_START__ = .;
Expand Down Expand Up @@ -162,15 +162,15 @@ SECTIONS {
* not mixed with normal data. This is required to set up the correct
* memory attributes for the coherent data page tables.
*/
coherent_ram (NOLOAD) : ALIGN(PAGE_SIZE) {
.coherent_ram (NOLOAD) : ALIGN(PAGE_SIZE) {
__COHERENT_RAM_START__ = .;

/*
* Bakery locks are stored in coherent memory. Each lock's data is
* contiguous and fully allocated by the compiler.
*/
*(bakery_lock)
*(tzfw_coherent_mem)
*(.bakery_lock)
*(.tzfw_coherent_mem)

__COHERENT_RAM_END_UNALIGNED__ = .;

Expand Down
10 changes: 5 additions & 5 deletions bl32/sp_min/sp_min.ld.S
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2021, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2016-2023, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
Expand Down Expand Up @@ -62,7 +62,7 @@ SECTIONS {
__RODATA_END__ = .;
} >RAM
#else /* SEPARATE_CODE_AND_RODATA */
ro . : {
.ro . : {
__RO_START__ = .;

*entrypoint.o(.text*)
Expand Down Expand Up @@ -115,15 +115,15 @@ SECTIONS {
* not mixed with normal data. This is required to set up the correct
* memory attributes for the coherent data page tables.
*/
coherent_ram (NOLOAD) : ALIGN(PAGE_SIZE) {
.coherent_ram (NOLOAD) : ALIGN(PAGE_SIZE) {
__COHERENT_RAM_START__ = .;

/*
* Bakery locks are stored in coherent memory. Each lock's data is
* contiguous and fully allocated by the compiler.
*/
*(bakery_lock)
*(tzfw_coherent_mem)
*(.bakery_lock)
*(.tzfw_coherent_mem)

__COHERENT_RAM_END_UNALIGNED__ = .;

Expand Down
8 changes: 4 additions & 4 deletions bl32/tsp/tsp.ld.S
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2020, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2013-2023, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
Expand Down Expand Up @@ -46,7 +46,7 @@ SECTIONS {
__RODATA_END__ = .;
} >RAM
#else /* SEPARATE_CODE_AND_RODATA */
ro . : {
.ro . : {
__RO_START__ = .;

*tsp_entrypoint.o(.text*)
Expand Down Expand Up @@ -90,9 +90,9 @@ SECTIONS {
* not mixed with normal data. This is required to set up the correct memory
* attributes for the coherent data page tables.
*/
coherent_ram (NOLOAD) : ALIGN(PAGE_SIZE) {
.coherent_ram (NOLOAD) : ALIGN(PAGE_SIZE) {
__COHERENT_RAM_START__ = .;
*(tzfw_coherent_mem)
*(.tzfw_coherent_mem)
__COHERENT_RAM_END_UNALIGNED__ = .;

/*
Expand Down
8 changes: 4 additions & 4 deletions docs/design/firmware-design.rst
Original file line number Diff line number Diff line change
Expand Up @@ -900,7 +900,7 @@ Registration
A runtime service is registered using the ``DECLARE_RT_SVC()`` macro, specifying
the name of the service, the range of OENs covered, the type of service and
initialization and call handler functions. This macro instantiates a ``const struct rt_svc_desc`` for the service with these details (see ``runtime_svc.h``).
This structure is allocated in a special ELF section ``rt_svc_descs``, enabling
This structure is allocated in a special ELF section ``.rt_svc_descs``, enabling
the framework to find all service descriptors included into BL31.

The specific service for a SMC Function is selected based on the OEN and call
Expand Down Expand Up @@ -2165,7 +2165,7 @@ To use bakery locks when ``USE_COHERENT_MEM`` is disabled, the lock data structu
has been redesigned. The changes utilise the characteristic of Lamport's Bakery
algorithm mentioned earlier. The bakery_lock structure only allocates the memory
for a single CPU. The macro ``DEFINE_BAKERY_LOCK`` allocates all the bakery locks
needed for a CPU into a section ``bakery_lock``. The linker allocates the memory
needed for a CPU into a section ``.bakery_lock``. The linker allocates the memory
for other cores by using the total size allocated for the bakery_lock section
and multiplying it with (PLATFORM_CORE_COUNT - 1). This enables software to
perform software cache maintenance on the lock data structure without running
Expand Down Expand Up @@ -2193,7 +2193,7 @@ with n bakery locks are:

::

bakery_lock section start
.bakery_lock section start
|----------------|
| `bakery_info_t`| <-- Lock_0 per-CPU field
| Lock_0 | for CPU0
Expand Down Expand Up @@ -2230,7 +2230,7 @@ with n bakery locks are:

Consider a system of 2 CPUs with 'N' bakery locks as shown above. For an
operation on Lock_N, the corresponding ``bakery_info_t`` in both CPU0 and CPU1
``bakery_lock`` section need to be fetched and appropriate cache operations need
``.bakery_lock`` section need to be fetched and appropriate cache operations need
to be performed for each access.

On Arm Platforms, bakery locks are used in psci (``psci_locks``) and power controller
Expand Down
14 changes: 7 additions & 7 deletions docs/getting_started/porting-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,22 +66,22 @@ an identity mapping for all addresses.
If the build option ``USE_COHERENT_MEM`` is enabled, each platform can allocate a
block of identity mapped secure memory with Device-nGnRE attributes aligned to
page boundary (4K) for each BL stage. All sections which allocate coherent
memory are grouped under ``coherent_ram``. For ex: Bakery locks are placed in a
section identified by name ``bakery_lock`` inside ``coherent_ram`` so that its
memory are grouped under ``.coherent_ram``. For ex: Bakery locks are placed in a
section identified by name ``.bakery_lock`` inside ``.coherent_ram`` so that its
possible for the firmware to place variables in it using the following C code
directive:

::

__section("bakery_lock")
__section(".bakery_lock")

Or alternatively the following assembler code directive:

::

.section bakery_lock
.section .bakery_lock

The ``coherent_ram`` section is a sum of all sections like ``bakery_lock`` which are
The ``.coherent_ram`` section is a sum of all sections like ``.bakery_lock`` which are
used to allocate any data structures that are accessed both when a CPU is
executing with its MMU and caches enabled, and when it's running with its MMU
and caches disabled. Examples are given below.
Expand Down Expand Up @@ -2411,7 +2411,7 @@ bytes) aligned to the cache line boundary that should be allocated per-cpu to
accommodate all the bakery locks.

If this constant is not defined when ``USE_COHERENT_MEM = 0``, the linker
calculates the size of the ``bakery_lock`` input section, aligns it to the
calculates the size of the ``.bakery_lock`` input section, aligns it to the
nearest ``CACHE_WRITEBACK_GRANULE``, multiplies it with ``PLATFORM_CORE_COUNT``
and stores the result in a linker symbol. This constant prevents a platform
from relying on the linker and provide a more efficient mechanism for
Expand Down Expand Up @@ -3540,7 +3540,7 @@ amount of open resources per driver.

--------------

*Copyright (c) 2013-2022, Arm Limited and Contributors. All rights reserved.*
*Copyright (c) 2013-2023, Arm Limited and Contributors. All rights reserved.*

.. _PSCI: http://infocenter.arm.com/help/topic/com.arm.doc.den0022c/DEN0022C_Power_State_Coordination_Interface.pdf
.. _Arm Generic Interrupt Controller version 2.0 (GICv2): http://infocenter.arm.com/help/topic/com.arm.doc.ihi0048b/index.html
Expand Down
Loading

0 comments on commit da04341

Please sign in to comment.