powerpc/boot: Add little endian support to elf utils
authorCédric Le Goater <clg@fr.ibm.com>
Thu, 24 Apr 2014 07:23:35 +0000 (09:23 +0200)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Mon, 28 Apr 2014 07:36:04 +0000 (17:36 +1000)
Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/boot/elf_util.c

index 1567a0c0f05c6639a96ce4947dfb9bdf23eda8fc..316552dea4d8c20e5b279ecde40f8d1e81ffee37 100644 (file)
@@ -26,7 +26,11 @@ int parse_elf64(void *hdr, struct elf_info *info)
              elf64->e_ident[EI_MAG2]  == ELFMAG2       &&
              elf64->e_ident[EI_MAG3]  == ELFMAG3       &&
              elf64->e_ident[EI_CLASS] == ELFCLASS64    &&
+#ifdef __LITTLE_ENDIAN__
+             elf64->e_ident[EI_DATA]  == ELFDATA2LSB   &&
+#else
              elf64->e_ident[EI_DATA]  == ELFDATA2MSB   &&
+#endif
              (elf64->e_type            == ET_EXEC ||
               elf64->e_type            == ET_DYN)      &&
              elf64->e_machine         == EM_PPC64))