[PATCH] bsps/powerpc: Fix small data area section

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Feb 11 06:38:20 UTC 2019


Fix small data area in case no fixed size is desired.  Rename
bsp_section_set_sdata_sbss_size into bsp_section_small_data_area_size
since this symbol reflects the overall small data area size (including
space for libdl).  Do not use bsp_section_sbss_size before definition in
linker command file.  Add new symbols to <bsp/linker-symbols.h>.

Update #3687.
---
 bsps/powerpc/include/bsp/linker-symbols.h        |  8 ++++++++
 bsps/powerpc/psim/start/linkcmds                 |  6 ++----
 bsps/powerpc/qoriq/start/linkcmds.qoriq_e500     |  6 ++----
 bsps/powerpc/qoriq/start/linkcmds.qoriq_e6500_32 |  6 ++----
 bsps/powerpc/shared/start/linkcmds.base          | 11 +++--------
 5 files changed, 17 insertions(+), 20 deletions(-)

diff --git a/bsps/powerpc/include/bsp/linker-symbols.h b/bsps/powerpc/include/bsp/linker-symbols.h
index 61e0da4158..06e5ef57a5 100644
--- a/bsps/powerpc/include/bsp/linker-symbols.h
+++ b/bsps/powerpc/include/bsp/linker-symbols.h
@@ -77,10 +77,18 @@ LINKER_SYMBOL(bsp_section_bss_begin)
 LINKER_SYMBOL(bsp_section_bss_end)
 LINKER_SYMBOL(bsp_section_bss_size)
 
+LINKER_SYMBOL(bsp_section_sdata_begin)
+LINKER_SYMBOL(bsp_section_sdata_end)
+LINKER_SYMBOL(bsp_section_sdata_size)
+
 LINKER_SYMBOL(bsp_section_sbss_begin)
 LINKER_SYMBOL(bsp_section_sbss_end)
 LINKER_SYMBOL(bsp_section_sbss_size)
 
+LINKER_SYMBOL(bsp_section_sdata_libdl_begin)
+LINKER_SYMBOL(bsp_section_sdata_libdl_end)
+LINKER_SYMBOL(bsp_section_sdata_libdl_size)
+
 LINKER_SYMBOL(bsp_section_rtemsstack_begin)
 LINKER_SYMBOL(bsp_section_rtemsstack_end)
 LINKER_SYMBOL(bsp_section_rtemsstack_size)
diff --git a/bsps/powerpc/psim/start/linkcmds b/bsps/powerpc/psim/start/linkcmds
index a34f4a2bcd..69491abb86 100644
--- a/bsps/powerpc/psim/start/linkcmds
+++ b/bsps/powerpc/psim/start/linkcmds
@@ -37,9 +37,7 @@ PROVIDE (PSIM_INSTRUCTIONS_PER_MICROSECOND = 10000);
 
 PSIM = 0x0c000000;
 
-/*
- * Allocate the maximum size to the small data sdata/sbss section.
- */
-bsp_section_set_sdata_sbss_size = 65536;
+/* Allocate the maximum size to the small data area */
+bsp_section_small_data_area_size = 65536;
 
 INCLUDE linkcmds.base
diff --git a/bsps/powerpc/qoriq/start/linkcmds.qoriq_e500 b/bsps/powerpc/qoriq/start/linkcmds.qoriq_e500
index 266e21b934..2c217ecb1f 100644
--- a/bsps/powerpc/qoriq/start/linkcmds.qoriq_e500
+++ b/bsps/powerpc/qoriq/start/linkcmds.qoriq_e500
@@ -35,9 +35,7 @@ bsp_section_robarrier_align = 0x1000000;
 bsp_section_rwbarrier_align = 0x1000000;
 qoriq = 0xffe00000;
 
-/*
- * Allocate the maximum size to the small data sdata/sbss section.
- */
-bsp_section_set_sdata_sbss_size = 65536;
+/* Allocate the maximum size to the small data area */
+bsp_section_small_data_area_size = 65536;
 
 INCLUDE linkcmds.base
diff --git a/bsps/powerpc/qoriq/start/linkcmds.qoriq_e6500_32 b/bsps/powerpc/qoriq/start/linkcmds.qoriq_e6500_32
index 34a4eee9f4..abc9c9e6c5 100644
--- a/bsps/powerpc/qoriq/start/linkcmds.qoriq_e6500_32
+++ b/bsps/powerpc/qoriq/start/linkcmds.qoriq_e6500_32
@@ -38,9 +38,7 @@ qoriq = 0xffe000000;
 qoriq_bman_portal = 0xff4000000;
 qoriq_qman_portal = 0xff6000000;
 
-/*
- * Allocate the maximum size to the small data sdata/sbss section.
- */
-bsp_section_set_sdata_sbss_size = 65536;
+/* Allocate the maximum size to the small data area */
+bsp_section_small_data_area_size = 65536;
 
 INCLUDE linkcmds.base
diff --git a/bsps/powerpc/shared/start/linkcmds.base b/bsps/powerpc/shared/start/linkcmds.base
index 642f0bf7e1..fa0628596b 100644
--- a/bsps/powerpc/shared/start/linkcmds.base
+++ b/bsps/powerpc/shared/start/linkcmds.base
@@ -304,13 +304,6 @@ SECTIONS {
 	bsp_section_data_load_begin = LOADADDR (.data);
 	bsp_section_data_load_end = bsp_section_data_load_begin + bsp_section_data_size;
 
-	/*
-	 * Set bsp_section_set_sdata_bss_size to the system's sdata and bss data size, eg:
-	 *
-	 *  bsp_section_set_sdata_sbss_size = 65536;
-	 */
-	bsp_section_sdata_sbss_size = DEFINED(bsp_section_set_sdata_sbss_size) ?
-							bsp_section_set_sdata_sbss_size : 0;
 	.sbss : ALIGN_WITH_INPUT {
 		bsp_section_sbss_begin = .;
 		*(.dynsbss)
@@ -318,10 +311,12 @@ SECTIONS {
 		*(.scommon)
 		bsp_section_sbss_end = .;
 		bsp_section_sdata_libdl_begin = .;
-		. += bsp_section_sdata_sbss_size - (bsp_section_sdata_size + bsp_section_sbss_size);
+		. = DEFINED(bsp_section_small_data_area_size) ?
+			bsp_section_sdata_begin + bsp_section_small_data_area_size : .;
 		bsp_section_sdata_libdl_end = .;
 	} > REGION_DATA AT > REGION_DATA
 	bsp_section_sbss_size = bsp_section_sbss_end - bsp_section_sbss_begin;
+	bsp_section_sdata_libdl_size = bsp_section_sdata_libdl_end - bsp_section_sdata_libdl_begin;
 
 	.bss : ALIGN_WITH_INPUT {
 		bsp_section_bss_begin = .;
-- 
2.16.4



More information about the devel mailing list