summaryrefslogtreecommitdiff
path: root/arch/powerpc/include/asm/elf.h
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2023-06-06 19:38:32 +1000
committerMichael Ellerman <mpe@ellerman.id.au>2023-06-14 12:46:42 +1000
commit606787fed7268feb256957872586370b56af697a (patch)
treeb9372125a732971e6d309a8b4dea1ebd70b20937 /arch/powerpc/include/asm/elf.h
parentaec0ba7472a7b0c1c293932e7978197f1489a332 (diff)
powerpc/64s: Remove support for ELFv1 little endian userspace
ELFv2 was introduced together with little-endian. ELFv1 with LE has never been a thing. The GNU toolchain can create such a beast, but anyone doing that is a maniac who needs to be stopped so I consider this patch a feature. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/20230606093832.199712-5-npiggin@gmail.com
Diffstat (limited to 'arch/powerpc/include/asm/elf.h')
-rw-r--r--arch/powerpc/include/asm/elf.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h
index 79f1c480b5eb..a26ca097d032 100644
--- a/arch/powerpc/include/asm/elf.h
+++ b/arch/powerpc/include/asm/elf.h
@@ -12,8 +12,14 @@
/*
* This is used to ensure we don't load something for the wrong architecture.
+ * 64le only supports ELFv2 64-bit binaries (64be supports v1 and v2).
*/
+#if defined(CONFIG_PPC64) && defined(CONFIG_CPU_LITTLE_ENDIAN)
+#define elf_check_arch(x) (((x)->e_machine == ELF_ARCH) && \
+ (((x)->e_flags & 0x3) == 0x2))
+#else
#define elf_check_arch(x) ((x)->e_machine == ELF_ARCH)
+#endif
#define compat_elf_check_arch(x) ((x)->e_machine == EM_PPC)
#define CORE_DUMP_USE_REGSET