[rtems commit] bsps/powerpc: Fix small data area section

Sebastian Huber sebh at rtems.org
Mon Feb 11 10:43:10 UTC 2019


Module:    rtems
Branch:    master
Commit:    eec706e2bf41a9a166aa5e744d041171015214ea
Changeset: http://git.rtems.org/rtems/commit/?id=eec706e2bf41a9a166aa5e744d041171015214ea

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Feb 11 07:34:14 2019 +0100

bsps/powerpc: Fix small data area section

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          | 20 ++++++++++++--------
 5 files changed, 26 insertions(+), 20 deletions(-)

diff --git a/bsps/powerpc/include/bsp/linker-symbols.h b/bsps/powerpc/include/bsp/linker-symbols.h
index 61e0da4..06e5ef5 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 a34f4a2..69491ab 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 266e21b..2c217ec 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 34a4eee..abc9c9e 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 642f0bf..65ee046 100644
--- a/bsps/powerpc/shared/start/linkcmds.base
+++ b/bsps/powerpc/shared/start/linkcmds.base
@@ -24,6 +24,15 @@ ENTRY (_start)
 STARTUP (start.o)
 
 /*
+ * The upper layer linker command file may optionally define the symbol
+ * bsp_section_small_data_area_size.  By default, the small data area is
+ * defined by the .sdata and .sbss input sections.  Define
+ * bsp_section_small_data_area_size, if you want to make space available for
+ * dynamically loaded libraries (libdl).  Small memory targets which do not use
+ * libdl, should not define this symbol.
+ */
+
+/*
  * Global symbols that may be defined externally
  */
 
@@ -304,13 +313,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 +320,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 = .;



More information about the vc mailing list