[rtems-tools commit] linkers: Use push/pop section

Sebastian Huber sebh at rtems.org
Thu Jan 25 07:17:16 UTC 2024


Module:    rtems-tools
Branch:    master
Commit:    8e77e113bae78292aaba21f2325e123e40b2072a
Changeset: http://git.rtems.org/rtems-tools/commit/?id=8e77e113bae78292aaba21f2325e123e40b2072a

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Nov 24 11:17:01 2023 +0100

linkers: Use push/pop section

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 88ee970..f0ac2bb 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
 };



More information about the vc mailing list