Blame SOURCES/elfutils-0.182-s390-pid_memory_read.patch

578d6f
commit e4d985a3c1c873f77d20fa0cd421458cc2824996
578d6f
Author: Andreas Krebbel <krebbel@linux.ibm.com>
578d6f
Date:   Thu Nov 19 20:32:24 2020 +0100
578d6f
578d6f
    IBM Z: Fix endianess problem in pid_memory_read
578d6f
    
578d6f
    The cached reads lack the big endian adjustments done in the fallback
578d6f
    path.
578d6f
    
578d6f
    Signed-off-by: Andreas Krebbel <krebbel@linux.ibm.com>
578d6f
578d6f
diff --git a/libdwfl/linux-pid-attach.c b/libdwfl/linux-pid-attach.c
578d6f
index 3a6af997..b23139d9 100644
578d6f
--- a/libdwfl/linux-pid-attach.c
578d6f
+++ b/libdwfl/linux-pid-attach.c
578d6f
@@ -193,14 +193,22 @@ pid_memory_read (Dwfl *dwfl, Dwarf_Addr addr, Dwarf_Word *result, void *arg)
578d6f
 {
578d6f
   struct __libdwfl_pid_arg *pid_arg = arg;
578d6f
   pid_t tid = pid_arg->tid_attached;
578d6f
+  Dwfl_Process *process = dwfl->process;
578d6f
   assert (tid > 0);
578d6f
 
578d6f
 #ifdef HAVE_PROCESS_VM_READV
578d6f
   if (read_cached_memory (pid_arg, addr, result))
578d6f
+    {
578d6f
+#if SIZEOF_LONG == 8
578d6f
+# if BYTE_ORDER == BIG_ENDIAN
578d6f
+      if (ebl_get_elfclass (process->ebl) == ELFCLASS32)
578d6f
+	*result >>= 32;
578d6f
+# endif
578d6f
+#endif
578d6f
     return true;
578d6f
+    }
578d6f
 #endif
578d6f
 
578d6f
-  Dwfl_Process *process = dwfl->process;
578d6f
   if (ebl_get_elfclass (process->ebl) == ELFCLASS64)
578d6f
     {
578d6f
 #if SIZEOF_LONG == 8