[PATCH] cpukit/aarch64: Resolve warnings with ILP32 ABI

Kinsey Moore kinsey.moore at oarcorp.com
Mon Sep 25 20:34:39 UTC 2023


Casts from uint64_t to void* must go through a uintptr_t cast to avoid
warnings when building with the ILP32 ABI since this is otherwise an
implicit truncation to 32bits for a pointer.
---
 cpukit/libdl/rtl-mdreloc-aarch64.c                     | 7 +++++--
 cpukit/score/cpu/aarch64/include/rtems/score/cpuimpl.h | 2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/cpukit/libdl/rtl-mdreloc-aarch64.c b/cpukit/libdl/rtl-mdreloc-aarch64.c
index 792dc91b2e..fd4e817a21 100644
--- a/cpukit/libdl/rtl-mdreloc-aarch64.c
+++ b/cpukit/libdl/rtl-mdreloc-aarch64.c
@@ -424,8 +424,11 @@ rtems_rtl_elf_reloc_rela (rtems_rtl_obj*            obj,
       }
 
       if (rtems_rtl_trace (RTEMS_RTL_TRACE_RELOC))
-        printf ("rtl: JUMP26/PC26/CALL: insn=%p where=%p target=%p raddr=%p parsing=%d\n",
-                insn, (void*) where, (void*) target, (void*) raddr, parsing);
+        printf (
+          "rtl: JUMP26/PC26/CALL: insn=%p where=%p target=%p raddr=%p parsing=%d\n",
+          insn, (void*) where, (void*)(uintptr_t) target, (void*)(uintptr_t) raddr,
+          parsing
+	);
 
       target = (intptr_t)target >> 2;
 
diff --git a/cpukit/score/cpu/aarch64/include/rtems/score/cpuimpl.h b/cpukit/score/cpu/aarch64/include/rtems/score/cpuimpl.h
index 095c5db5b9..8a0e476899 100644
--- a/cpukit/score/cpu/aarch64/include/rtems/score/cpuimpl.h
+++ b/cpukit/score/cpu/aarch64/include/rtems/score/cpuimpl.h
@@ -178,7 +178,7 @@ static inline void *_CPU_Get_TLS_thread_pointer(
   const Context_Control *context
 )
 {
-  return (void *) context->thread_id;
+  return (void *)(uintptr_t) context->thread_id;
 }
 
 #ifdef __cplusplus
-- 
2.39.2



More information about the devel mailing list