[rtems-tools commit] linkers: Avoid void pointer arithmetic

Sebastian Huber sebh at rtems.org
Thu Feb 29 08:57:17 UTC 2024


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Feb 26 08:12:10 2024 +0100

linkers: Avoid void pointer arithmetic

---

 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 f0ac2bb..9fe552e 100644
--- a/linkers/rtems-syms.cpp
+++ b/linkers/rtems-syms.cpp
@@ -322,9 +322,9 @@ output_sym::operator ()(const rld::symbols::symtab::value_type& value)
       if (sym.type () == STT_TLS) {
         c.write_line ("#define RTEMS_TLS_INDEX_" + sym.name () + " " + std::to_string(index));
         c.write_line ("static size_t rtems_rtl_tls_" + sym.name () + "(void) {");
-        c.write_line ("  extern __thread void* "  + sym.name () +  ";");
-        c.write_line ("  const void* tls_base = rtems_rtl_tls_get_base ();");
-        c.write_line ("  const void* tls_addr = (void*) &"  + sym.name () +  ";");
+        c.write_line ("  extern __thread char "  + sym.name () +  "[];");
+        c.write_line ("  size_t tls_base = (size_t) rtems_rtl_tls_get_base ();");
+        c.write_line ("  size_t tls_addr = (size_t) "  + sym.name () +  ";");
         c.write_line ("  return tls_addr - tls_base;");
         c.write_line ("}");
         c.write_line ("");



More information about the vc mailing list