From 9cf2b72b25f3f6a5a1a46a4f36037e66de52465c Mon Sep 17 00:00:00 2001 From: Will Deacon Date: Tue, 22 Jan 2013 15:34:40 +0000 Subject: [PATCH 1/2] arm64: elf: fix core dumping to match what glibc expects The kernel's internal definition of ELF_NGREG uses struct pt_regs, which means that we disagree with userspace on the size of coredumps since glibc correctly uses the user-visible struct user_pt_regs. This patch fixes our ELF_NGREG definition to use struct user_pt_regs and introduces our own ELF_CORE_COPY_REGS to convert between the user and kernel structure definitions. Cc: Signed-off-by: Will Deacon Signed-off-by: Catalin Marinas --- arch/arm64/include/asm/elf.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/elf.h b/arch/arm64/include/asm/elf.h index 07fea290d7c..fe32c0e4ac0 100644 --- a/arch/arm64/include/asm/elf.h +++ b/arch/arm64/include/asm/elf.h @@ -26,7 +26,10 @@ typedef unsigned long elf_greg_t; -#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t)) +#define ELF_NGREG (sizeof(struct user_pt_regs) / sizeof(elf_greg_t)) +#define ELF_CORE_COPY_REGS(dest, regs) \ + *(struct user_pt_regs *)&(dest) = (regs)->user_regs; + typedef elf_greg_t elf_gregset_t[ELF_NGREG]; typedef struct user_fpsimd_state elf_fpregset_t; From f1b99392caf120d7533da260318fae0eb5053737 Mon Sep 17 00:00:00 2001 From: Will Deacon Date: Fri, 18 Jan 2013 19:00:47 +0000 Subject: [PATCH 2/2] arm64: makefile: fix uname munging when setting ARCH on native machine By popular demand, arch/aarch64 is now known as arch/arm64. However, uname -m (and indeed the GNU triplet) still use aarch64 as the machine string. This patch fixes native builds of both the kernel and perf tools by updating the relevant Makefiles to munge the output of uname -m and set the ARCH variable appropriately. Cc: Signed-off-by: Will Deacon Signed-off-by: Catalin Marinas --- Makefile | 2 +- tools/perf/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 253a455d8d8..2cd4c6be44f 100644 --- a/Makefile +++ b/Makefile @@ -169,7 +169,7 @@ SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ -e s/arm.*/arm/ -e s/sa110/arm/ \ -e s/s390x/s390/ -e s/parisc64/parisc/ \ -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ - -e s/sh[234].*/sh/ ) + -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ ) # Cross compiling and selecting different set of gcc/bin-utils # --------------------------------------------------------------------------- diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 891bc77bdb2..8ab05e543ef 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile @@ -58,7 +58,7 @@ ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ -e s/arm.*/arm/ -e s/sa110/arm/ \ -e s/s390x/s390/ -e s/parisc64/parisc/ \ -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \ - -e s/sh[234].*/sh/ ) + -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ ) NO_PERF_REGS := 1 CC = $(CROSS_COMPILE)gcc