[RTEMS Tools 1/4] linkers: Avoid void pointer arithmetic

Chris Johns chrisj at rtems.org
Wed Feb 28 23:32:07 UTC 2024


OK too all and thanks

Chris

On 26/2/2024 8:41 pm, Sebastian Huber wrote:
> ---
>  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 devel mailing list