powerpc: Fix little endian coredumps
authorAnton Blanchard <anton@samba.org>
Tue, 6 Aug 2013 16:01:50 +0000 (02:01 +1000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 14 Aug 2013 05:33:39 +0000 (15:33 +1000)
We need to set ELF_DATA correctly on LE coredumps.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/include/uapi/asm/elf.h

index 89fa042d51db303b65e241f210cdbe93cbea6b34..7e39c9146a71f63c1701118ec4a2e16a243341b5 100644 (file)
@@ -109,7 +109,6 @@ typedef elf_gregset_t32 compat_elf_gregset_t;
 # define ELF_GREG_TYPE elf_greg_t64
 # define ELF_ARCH      EM_PPC64
 # define ELF_CLASS     ELFCLASS64
-# define ELF_DATA      ELFDATA2MSB
 typedef elf_greg_t64 elf_greg_t;
 typedef elf_gregset_t64 elf_gregset_t;
 #else
@@ -118,11 +117,16 @@ typedef elf_gregset_t64 elf_gregset_t;
 # define ELF_GREG_TYPE elf_greg_t32
 # define ELF_ARCH      EM_PPC
 # define ELF_CLASS     ELFCLASS32
-# define ELF_DATA      ELFDATA2MSB
 typedef elf_greg_t32 elf_greg_t;
 typedef elf_gregset_t32 elf_gregset_t;
 #endif /* __powerpc64__ */
 
+#ifdef __BIG_ENDIAN__
+#define ELF_DATA       ELFDATA2MSB
+#else
+#define ELF_DATA       ELFDATA2LSB
+#endif
+
 /* Floating point registers */
 typedef double elf_fpreg_t;
 typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];