[rtems-tools commit] linkers: Fix for targets with a small-data area

Chris Johns chrisj at rtems.org
Mon Mar 21 06:48:18 UTC 2016


Module:    rtems-tools
Branch:    4.11
Commit:    e6a06751cc58127a52e2948cc8b0349692f6f74b
Changeset: http://git.rtems.org/rtems-tools/commit/?id=e6a06751cc58127a52e2948cc8b0349692f6f74b

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Jan  4 11:15:37 2016 +0100

linkers: Fix for targets with a small-data area

On certain targets (e.g. PowerPC) global data below a certain threshold
(e.g. 8 bytes) may resided in a special memory area, the small-data
area.  This allows more efficient load/store operations.  Placing such
data into the wrong section (e.g. .rodata) leads to relocation errors
during link-time.  See test program libtests/dl02 in the RTEMS
testsuite.  Using an array of unspecified size prevents that the
compiler assumes that a certain variable is in the small-data area.

---

 linkers/rtems-syms.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/linkers/rtems-syms.cpp b/linkers/rtems-syms.cpp
index c8f54ae..a017ffa 100644
--- a/linkers/rtems-syms.cpp
+++ b/linkers/rtems-syms.cpp
@@ -60,7 +60,7 @@ static const char* c_header[] =
   " */",
   "",
   "extern const unsigned char rtems__rtl_base_globals[];",
-  "extern const unsigned int rtems__rtl_base_globals_size;",
+  "extern const unsigned int rtems__rtl_base_globals_size[];",
   "",
   "void rtems_rtl_base_sym_global_add (const unsigned char* , unsigned int );",
   "",
@@ -104,8 +104,8 @@ static const char* c_trailer[] =
 static const char* c_rtl_call_body[] =
 {
   "{",
-  "  rtems_rtl_base_sym_global_add ((const unsigned char*) &rtems__rtl_base_globals,",
-  "                                 rtems__rtl_base_globals_size);",
+  "  rtems_rtl_base_sym_global_add ((const unsigned char*) &rtems__rtl_base_globals[0],",
+  "                                 rtems__rtl_base_globals_size[0]);",
   "}",
   0
 };



More information about the vc mailing list