[rtems commit] rtl-mdreloc-sparc.c: Do not print unaligned pointer and cause unaligned access.

Joel Sherrill joel at rtems.org
Mon Nov 14 14:23:49 UTC 2016


Module:    rtems
Branch:    master
Commit:    316da9356ad7b612f6df6ed1e47b62268450438e
Changeset: http://git.rtems.org/rtems/commit/?id=316da9356ad7b612f6df6ed1e47b62268450438e

Author:    Jiri Gaisler <jiri at gaisler.se>
Date:      Mon Nov 14 08:21:03 2016 -0600

rtl-mdreloc-sparc.c: Do not print unaligned pointer and cause unaligned access.

updates #2802.

---

 cpukit/libdl/rtl-mdreloc-sparc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/cpukit/libdl/rtl-mdreloc-sparc.c b/cpukit/libdl/rtl-mdreloc-sparc.c
index a8bf5e1..509b62f 100644
--- a/cpukit/libdl/rtl-mdreloc-sparc.c
+++ b/cpukit/libdl/rtl-mdreloc-sparc.c
@@ -144,6 +144,7 @@ rtems_rtl_elf_relocate_rela (const rtems_rtl_obj_t*      obj,
 {
   Elf_Addr *where;
   Elf_Word type, value, mask;
+  Elf_Addr tmp = 0;
 
   where = (Elf_Addr *) (sect->base + rela->r_offset);
 
@@ -220,7 +221,6 @@ rtems_rtl_elf_relocate_rela (const rtems_rtl_obj_t*      obj,
 
   if (RELOC_UNALIGNED(type)) {
     /* Handle unaligned relocations. */
-    Elf_Addr tmp = 0;
     char *ptr = (char *)where;
     int i, size = RELOC_TARGET_SIZE (type) / 8;
 
@@ -238,11 +238,12 @@ rtems_rtl_elf_relocate_rela (const rtems_rtl_obj_t*      obj,
   } else {
     *where &= ~mask;
     *where |= value;
+    tmp = *where;
   }
 
   if (rtems_rtl_trace (RTEMS_RTL_TRACE_RELOC))
     printf ("rtl: %s %p @ %p in %s\n",
-            reloc_names[type], (void *)*where, where, rtems_rtl_obj_oname (obj));
+            reloc_names[type], (void *)tmp, where, rtems_rtl_obj_oname (obj));
 
 
   return true;



More information about the vc mailing list