Commit a7739bc7 authored by Masahiro Yamada's avatar Masahiro Yamada
Browse files

linker_script: move bss section to bl_common.ld.h



Move the bss section to the common header. This adds BAKERY_LOCK_NORMAL
and PMF_TIMESTAMP, which previously existed only in BL31. This is not
a big deal because unused data should not be compiled in the first
place. I believe this should be controlled by BL*_SOURCES in Makefiles,
not by linker scripts.

I investigated BL1, BL2, BL2U, BL31 for plat=fvp, and BL2-AT-EL3,
BL31, BL31 for plat=uniphier. I did not see any more  unexpected
code addition.

The bss section has bigger alignment. I added BSS_ALIGN for this.

Currently, SORT_BY_ALIGNMENT() is missing in sp_min.ld.S, and with this
change, the BSS symbols in SP_MIN will be sorted by the alignment.
This is not a big deal (or, even better in terms of the image size).

Change-Id: I680ee61f84067a559bac0757f9d03e73119beb33
Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
parent 0a0a7a9a
...@@ -109,18 +109,7 @@ SECTIONS ...@@ -109,18 +109,7 @@ SECTIONS
__STACKS_END__ = .; __STACKS_END__ = .;
} >RAM } >RAM
/* BSS_SECTION >RAM
* The .bss section gets initialised to 0 at runtime.
* Its base address should be 16-byte aligned for better performance of the
* zero-initialization code.
*/
.bss : ALIGN(16) {
__BSS_START__ = .;
*(SORT_BY_ALIGNMENT(.bss*))
*(COMMON)
__BSS_END__ = .;
} >RAM
XLAT_TABLE_SECTION >RAM XLAT_TABLE_SECTION >RAM
#if USE_COHERENT_MEM #if USE_COHERENT_MEM
......
...@@ -94,18 +94,7 @@ SECTIONS ...@@ -94,18 +94,7 @@ SECTIONS
__STACKS_END__ = .; __STACKS_END__ = .;
} >RAM } >RAM
/* BSS_SECTION >RAM
* The .bss section gets initialised to 0 at runtime.
* Its base address should be 16-byte aligned for better performance of the
* zero-initialization code.
*/
.bss : ALIGN(16) {
__BSS_START__ = .;
*(SORT_BY_ALIGNMENT(.bss*))
*(COMMON)
__BSS_END__ = .;
} >RAM
XLAT_TABLE_SECTION >RAM XLAT_TABLE_SECTION >RAM
#if USE_COHERENT_MEM #if USE_COHERENT_MEM
......
...@@ -129,18 +129,7 @@ SECTIONS ...@@ -129,18 +129,7 @@ SECTIONS
__STACKS_END__ = .; __STACKS_END__ = .;
} >RAM } >RAM
/* BSS_SECTION >RAM
* The .bss section gets initialised to 0 at runtime.
* Its base address should be 16-byte aligned for better performance of the
* zero-initialization code.
*/
.bss : ALIGN(16) {
__BSS_START__ = .;
*(SORT_BY_ALIGNMENT(.bss*))
*(COMMON)
__BSS_END__ = .;
} >RAM
XLAT_TABLE_SECTION >RAM XLAT_TABLE_SECTION >RAM
#if USE_COHERENT_MEM #if USE_COHERENT_MEM
......
...@@ -96,18 +96,7 @@ SECTIONS ...@@ -96,18 +96,7 @@ SECTIONS
__STACKS_END__ = .; __STACKS_END__ = .;
} >RAM } >RAM
/* BSS_SECTION >RAM
* The .bss section gets initialised to 0 at runtime.
* Its base address should be 16-byte aligned for better performance of the
* zero-initialization code.
*/
.bss : ALIGN(16) {
__BSS_START__ = .;
*(SORT_BY_ALIGNMENT(.bss*))
*(COMMON)
__BSS_END__ = .;
} >RAM
XLAT_TABLE_SECTION >RAM XLAT_TABLE_SECTION >RAM
#if USE_COHERENT_MEM #if USE_COHERENT_MEM
......
...@@ -164,20 +164,7 @@ SECTIONS ...@@ -164,20 +164,7 @@ SECTIONS
__STACKS_END__ = .; __STACKS_END__ = .;
} >NOBITS } >NOBITS
/* BSS_SECTION >NOBITS
* The .bss section gets initialised to 0 at runtime.
* Its base address should be 16-byte aligned for better performance of the
* zero-initialization code.
*/
.bss (NOLOAD) : ALIGN(16) {
__BSS_START__ = .;
*(SORT_BY_ALIGNMENT(.bss*))
*(COMMON)
BAKERY_LOCK_NORMAL
PMF_TIMESTAMP
__BSS_END__ = .;
} >NOBITS
XLAT_TABLE_SECTION >NOBITS XLAT_TABLE_SECTION >NOBITS
#if USE_COHERENT_MEM #if USE_COHERENT_MEM
......
...@@ -107,20 +107,7 @@ SECTIONS ...@@ -107,20 +107,7 @@ SECTIONS
__STACKS_END__ = .; __STACKS_END__ = .;
} >RAM } >RAM
/* BSS_SECTION >RAM
* The .bss section gets initialised to 0 at runtime.
* Its base address should be 8-byte aligned for better performance of the
* zero-initialization code.
*/
.bss (NOLOAD) : ALIGN(8) {
__BSS_START__ = .;
*(.bss*)
*(COMMON)
BAKERY_LOCK_NORMAL
PMF_TIMESTAMP
__BSS_END__ = .;
} >RAM
XLAT_TABLE_SECTION >RAM XLAT_TABLE_SECTION >RAM
__BSS_SIZE__ = SIZEOF(.bss); __BSS_SIZE__ = SIZEOF(.bss);
......
...@@ -97,18 +97,7 @@ SECTIONS ...@@ -97,18 +97,7 @@ SECTIONS
__STACKS_END__ = .; __STACKS_END__ = .;
} >RAM } >RAM
/* BSS_SECTION >RAM
* The .bss section gets initialised to 0 at runtime.
* Its base address should be 16-byte aligned for better performance of the
* zero-initialization code.
*/
.bss : ALIGN(16) {
__BSS_START__ = .;
*(SORT_BY_ALIGNMENT(.bss*))
*(COMMON)
__BSS_END__ = .;
} >RAM
XLAT_TABLE_SECTION >RAM XLAT_TABLE_SECTION >RAM
#if USE_COHERENT_MEM #if USE_COHERENT_MEM
......
...@@ -11,8 +11,10 @@ ...@@ -11,8 +11,10 @@
#ifdef __aarch64__ #ifdef __aarch64__
#define STRUCT_ALIGN 8 #define STRUCT_ALIGN 8
#define BSS_ALIGN 16
#else #else
#define STRUCT_ALIGN 4 #define STRUCT_ALIGN 4
#define BSS_ALIGN 8
#endif #endif
#define CPU_OPS \ #define CPU_OPS \
...@@ -127,6 +129,22 @@ ...@@ -127,6 +129,22 @@
. = . + (__PERCPU_TIMESTAMP_SIZE__ * (PLATFORM_CORE_COUNT - 1)); \ . = . + (__PERCPU_TIMESTAMP_SIZE__ * (PLATFORM_CORE_COUNT - 1)); \
__PMF_TIMESTAMP_END__ = .; __PMF_TIMESTAMP_END__ = .;
/*
* The .bss section gets initialised to 0 at runtime.
* Its base address has bigger alignment for better performance of the
* zero-initialization code.
*/
#define BSS_SECTION \
.bss (NOLOAD) : ALIGN(BSS_ALIGN) { \
__BSS_START__ = .; \
*(SORT_BY_ALIGNMENT(.bss*)) \
*(COMMON) \
BAKERY_LOCK_NORMAL \
PMF_TIMESTAMP \
__BSS_END__ = .; \
}
/* /*
* The xlat_table section is for full, aligned page tables (4K). * The xlat_table section is for full, aligned page tables (4K).
* Removing them from .bss avoids forcing 4K alignment on * Removing them from .bss avoids forcing 4K alignment on
......
...@@ -80,19 +80,8 @@ SECTIONS ...@@ -80,19 +80,8 @@ SECTIONS
__STACKS_END__ = .; __STACKS_END__ = .;
} >RAM } >RAM
/* BSS_SECTION >RAM
* The .bss section gets initialised to 0 at runtime. __RW_END__ = __BSS_END__;
* Its base address should be 16-byte aligned for better performance of the
* zero-initialization code.
*/
.bss (NOLOAD) : ALIGN(16) {
__BSS_START__ = .;
*(.bss*)
*(COMMON)
BAKERY_LOCK_NORMAL
__BSS_END__ = .;
__RW_END__ = .;
} >RAM
ASSERT(. <= BL31_LIMIT, "BL3-1 image has exceeded its limit.") ASSERT(. <= BL31_LIMIT, "BL3-1 image has exceeded its limit.")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment