[RTEMS Tools] linkers: Use push/pop section

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Jan 16 06:44:49 UTC 2024


Restore the previous section, otherwise the generated code may end up in
a wrong section.
---
 linkers/rtems-syms.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/linkers/rtems-syms.cpp b/linkers/rtems-syms.cpp
index 699c014..ecdcd15 100644
--- a/linkers/rtems-syms.cpp
+++ b/linkers/rtems-syms.cpp
@@ -77,7 +77,7 @@ static const char* c_header[] =
   "void rtems_rtl_base_sym_global_add (const unsigned char* , unsigned int,",
   "                                    rtems_rtl_tls_offset*, size_t );",
   "",
-  "asm(\".section \\\".rodata\\\"\");",
+  "asm(\".pushsection \\\".rodata\\\"\");",
   "",
   "asm(\"  .align   4\");",
   "asm(\"  .local   rtems__rtl_base_globals\");",
@@ -122,6 +122,7 @@ static const char* c_trailer[] =
   "asm(\"  .local   rtems__rtl_base_globals_size\");",
   "asm(\"rtems__rtl_base_globals_size:\");",
   "asm(\"  .long rtems__rtl_base_globals_size - rtems__rtl_base_globals\");",
+  "asm(\"  .popsection\");",
   "",
   0
 };
-- 
2.35.3



More information about the devel mailing list