2014-07-01 13:34:45

by Philipp Tomsich

[permalink] [raw]
Subject: Re: [PATCH 15/24] ARM64:ILP32: Use the non compat HWCAP for ILP32.

On 24 May 2014, at 09:02 , Andrew Pinski <[email protected]> wrote:

> #ifdef CONFIG_COMPAT
> -#define COMPAT_ELF_HWCAP (compat_elf_hwcap)
> -#define COMPAT_ELF_HWCAP2 (compat_elf_hwcap2)
> extern unsigned int compat_elf_hwcap, compat_elf_hwcap2;
> +#define COMPAT_ELF_HWCAP \
> + (is_a32_compat_task() \
> + ? compat_elf_hwcap \
> + : elf_hwcap)
> +
> +#define COMPAT_ELF_HWCAP2 \
> + (is_a32_compat_task() \
> + ? compat_elf_hwcap2 \
> + : 0)
> +
> #endif

You missed the COMPAT_ELF_PLATFORM (in arm64/include/asm/elf.h), which is used to setup AT_PLATFORM in the auxilary vectors. I?d suggest to use a similar naming convention to what will be used in gdb (i.e. appending a ?:ilp32? to the base architecture.

The proposed change would thus be:
---
arch/arm64/include/asm/elf.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h
index 3f979b5..6d38edc 100644
--- a/arch/arm64/include/asm/elf.h
+++ b/arch/arm64/include/asm/elf.h
@@ -168,9 +168,9 @@ extern unsigned long arch_randomize_brk(struct mm_struct *mm);
#ifdef CONFIG_COMPAT

#ifdef __AARCH64EB__
-#define COMPAT_ELF_PLATFORM ("v8b")
+#define COMPAT_ELF_PLATFORM (is_ilp32_compat_task() ? "aarch64_be:ilp32" : "v8b")
#else
-#define COMPAT_ELF_PLATFORM ("v8l")
+#define COMPAT_ELF_PLATFORM (is_ilp32_compat_task() ? "aarch64:ilp32" : "v8l")
#endif

#define COMPAT_ELF_ET_DYN_BASE (randomize_et_dyn(2 * TASK_SIZE_32 / 3))
--
1.9.0


Best,
Philipp.-