summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Simek <michal.simek@amd.com>2023-04-27 14:26:03 +0200
committerSandrine Bailleux <sandrine.bailleux@arm.com>2023-06-12 12:50:08 +0200
commitf7d445fcbbd3d5146d95698ace3381fcf522b9af (patch)
treeb777009ed38825ddb7e430a73c2ab4bf1200053e
parentf4d011b0f07dbc5b56975a0bed25ecee56a52fcd (diff)
chore(bl): add UNALIGNED symbols for TEXT/RODATA
Add symbols to mark end of TEXT/RODATA before page alignment. Similar change was done by commit 8d69a03f6a7d ("Various improvements/cleanups on the linker scripts") for RO_END/COHERENT_RAM. These symbols help to know how much free space is in the final binary because of page alignment. Also show all *UNALIGNED__ symbols via poetry. For example: poetry run memory -p zynqmp -b debug Change-Id: I322beba37dad76be9f4e88ca7e5b3eff2df7d96e Signed-off-by: Michal Simek <michal.simek@amd.com>
-rw-r--r--bl1/bl1.ld.S2
-rw-r--r--bl2/bl2.ld.S2
-rw-r--r--bl2/bl2_el3.ld.S2
-rw-r--r--bl2u/bl2u.ld.S2
-rw-r--r--bl31/bl31.ld.S2
-rw-r--r--bl32/sp_min/sp_min.ld.S2
-rw-r--r--bl32/tsp/tsp.ld.S2
-rw-r--r--docs/design/firmware-design.rst2
-rwxr-xr-xtools/memory/memory/memmap.py2
9 files changed, 17 insertions, 1 deletions
diff --git a/bl1/bl1.ld.S b/bl1/bl1.ld.S
index a2527e63a..49dda855e 100644
--- a/bl1/bl1.ld.S
+++ b/bl1/bl1.ld.S
@@ -41,6 +41,7 @@ SECTIONS {
*bl1_entrypoint.o(.text*)
*(SORT_BY_ALIGNMENT(.text*))
*(.vectors)
+ __TEXT_END_UNALIGNED__ = .;
. = ALIGN(PAGE_SIZE);
@@ -72,6 +73,7 @@ SECTIONS {
* aligned and lld does not align the LMA to the alignment specified
* on the .data section.
*/
+ __RODATA_END_UNALIGNED__ = .;
__RODATA_END__ = .;
. = ALIGN(16);
diff --git a/bl2/bl2.ld.S b/bl2/bl2.ld.S
index 5f689d55c..db83a0c50 100644
--- a/bl2/bl2.ld.S
+++ b/bl2/bl2.ld.S
@@ -35,6 +35,7 @@ SECTIONS {
*(SORT_BY_ALIGNMENT(.text*))
*(.vectors)
+ __TEXT_END_UNALIGNED__ = .;
. = ALIGN(PAGE_SIZE);
@@ -57,6 +58,7 @@ SECTIONS {
RODATA_COMMON
+ __RODATA_END_UNALIGNED__ = .;
. = ALIGN(PAGE_SIZE);
__RODATA_END__ = .;
diff --git a/bl2/bl2_el3.ld.S b/bl2/bl2_el3.ld.S
index 5da631c07..4aa5cb045 100644
--- a/bl2/bl2_el3.ld.S
+++ b/bl2/bl2_el3.ld.S
@@ -65,6 +65,7 @@ SECTIONS {
*(SORT_BY_ALIGNMENT(.text*))
*(.vectors)
+ __TEXT_END_UNALIGNED__ = .;
. = ALIGN(PAGE_SIZE);
@@ -78,6 +79,7 @@ SECTIONS {
RODATA_COMMON
+ __RODATA_END_UNALIGNED__ = .;
. = ALIGN(PAGE_SIZE);
__RODATA_END__ = .;
diff --git a/bl2u/bl2u.ld.S b/bl2u/bl2u.ld.S
index 21c91b493..7b1a10103 100644
--- a/bl2u/bl2u.ld.S
+++ b/bl2u/bl2u.ld.S
@@ -32,6 +32,7 @@ SECTIONS {
*bl2u_entrypoint.o(.text*)
*(SORT_BY_ALIGNMENT(.text*))
*(.vectors)
+ __TEXT_END_UNALIGNED__ = .;
. = ALIGN(PAGE_SIZE);
@@ -53,6 +54,7 @@ SECTIONS {
RODATA_COMMON
+ __RODATA_END_UNALIGNED__ = .;
. = ALIGN(PAGE_SIZE);
__RODATA_END__ = .;
} >RAM
diff --git a/bl31/bl31.ld.S b/bl31/bl31.ld.S
index abcae0cd6..7a8c41ab2 100644
--- a/bl31/bl31.ld.S
+++ b/bl31/bl31.ld.S
@@ -42,6 +42,7 @@ SECTIONS {
*bl31_entrypoint.o(.text*)
*(SORT_BY_ALIGNMENT(SORT(.text*)))
*(.vectors)
+ __TEXT_END_UNALIGNED__ = .;
. = ALIGN(PAGE_SIZE);
@@ -62,6 +63,7 @@ SECTIONS {
. = ALIGN(8);
# include <lib/el3_runtime/pubsub_events.h>
+ __RODATA_END_UNALIGNED__ = .;
. = ALIGN(PAGE_SIZE);
diff --git a/bl32/sp_min/sp_min.ld.S b/bl32/sp_min/sp_min.ld.S
index 0a2bad01e..dd8197332 100644
--- a/bl32/sp_min/sp_min.ld.S
+++ b/bl32/sp_min/sp_min.ld.S
@@ -34,6 +34,7 @@ SECTIONS {
*entrypoint.o(.text*)
*(SORT_BY_ALIGNMENT(.text*))
*(.vectors)
+ __TEXT_END_UNALIGNED__ = .;
. = ALIGN(PAGE_SIZE);
@@ -58,6 +59,7 @@ SECTIONS {
. = ALIGN(8);
# include <lib/el3_runtime/pubsub_events.h>
+ __RODATA_END_UNALIGNED__ = .;
. = ALIGN(PAGE_SIZE);
diff --git a/bl32/tsp/tsp.ld.S b/bl32/tsp/tsp.ld.S
index b735f45e8..22bf11dad 100644
--- a/bl32/tsp/tsp.ld.S
+++ b/bl32/tsp/tsp.ld.S
@@ -30,6 +30,7 @@ SECTIONS {
*tsp_entrypoint.o(.text*)
*(.text*)
*(.vectors)
+ __TEXT_END_UNALIGNED__ = .;
. = ALIGN(PAGE_SIZE);
@@ -43,6 +44,7 @@ SECTIONS {
RODATA_COMMON
+ __RODATA_END_UNALIGNED__ = .;
. = ALIGN(PAGE_SIZE);
__RODATA_END__ = .;
diff --git a/docs/design/firmware-design.rst b/docs/design/firmware-design.rst
index 998824f04..50839bde5 100644
--- a/docs/design/firmware-design.rst
+++ b/docs/design/firmware-design.rst
@@ -1559,8 +1559,10 @@ The following linker symbols are defined for this purpose:
- ``__RO_START__``
- ``__RO_END__``
- ``__TEXT_START__``
+- ``__TEXT_END_UNALIGNED__``
- ``__TEXT_END__``
- ``__RODATA_START__``
+- ``__RODATA_END_UNALIGNED__``
- ``__RODATA_END__``
BL1's linker symbols
diff --git a/tools/memory/memory/memmap.py b/tools/memory/memory/memmap.py
index dda104a0f..99149b547 100755
--- a/tools/memory/memory/memmap.py
+++ b/tools/memory/memory/memmap.py
@@ -100,7 +100,7 @@ def main(
if symbols:
expr = (
r"(.*)(TEXT|BSS|RODATA|STACKS|_OPS|PMF|XLAT|GOT|FCONF"
- r"|R.M)(.*)(START|END)__$"
+ r"|R.M)(.*)(START|UNALIGNED|END)__$"
)
printer.print_symbol_table(
parser.filter_symbols(parser.symbols, expr), parser.module_names