2015-05-14 15:27:37

by Rabin Vincent

[permalink] [raw]
Subject: [PATCH 1/3] CRIS: UAPI: fix ptrace.h

The exported ptrace.h header on CRIS references an "arch" directory
which does not exist. Fix this by having the variants in the same
directory and including them conditionally, similar to other
architectures.

Signed-off-by: Rabin Vincent <[email protected]>
---
arch/cris/arch-v32/kernel/signal.c | 1 -
arch/cris/include/arch-v32/arch/irqflags.h | 2 +-
arch/cris/include/uapi/asm/Kbuild | 2 ++
arch/cris/include/uapi/asm/ptrace.h | 6 +++++-
arch/cris/include/{arch-v10/arch/ptrace.h => uapi/asm/ptrace_v10.h} | 0
arch/cris/include/{arch-v32/arch/ptrace.h => uapi/asm/ptrace_v32.h} | 0
6 files changed, 8 insertions(+), 3 deletions(-)
rename arch/cris/include/{arch-v10/arch/ptrace.h => uapi/asm/ptrace_v10.h} (100%)
rename arch/cris/include/{arch-v32/arch/ptrace.h => uapi/asm/ptrace_v32.h} (100%)

diff --git a/arch/cris/arch-v32/kernel/signal.c b/arch/cris/arch-v32/kernel/signal.c
index 3a36ae6..150d1d7 100644
--- a/arch/cris/arch-v32/kernel/signal.c
+++ b/arch/cris/arch-v32/kernel/signal.c
@@ -19,7 +19,6 @@
#include <asm/processor.h>
#include <asm/ucontext.h>
#include <asm/uaccess.h>
-#include <arch/ptrace.h>
#include <arch/hwregs/cpu_vect.h>

extern unsigned long cris_signal_return_page;
diff --git a/arch/cris/include/arch-v32/arch/irqflags.h b/arch/cris/include/arch-v32/arch/irqflags.h
index 041851f..5f6fddf 100644
--- a/arch/cris/include/arch-v32/arch/irqflags.h
+++ b/arch/cris/include/arch-v32/arch/irqflags.h
@@ -2,7 +2,7 @@
#define __ASM_CRIS_ARCH_IRQFLAGS_H

#include <linux/types.h>
-#include <arch/ptrace.h>
+#include <asm/ptrace.h>

static inline unsigned long arch_local_save_flags(void)
{
diff --git a/arch/cris/include/uapi/asm/Kbuild b/arch/cris/include/uapi/asm/Kbuild
index 01f66b8..8443dc8 100644
--- a/arch/cris/include/uapi/asm/Kbuild
+++ b/arch/cris/include/uapi/asm/Kbuild
@@ -19,6 +19,8 @@ header-y += param.h
header-y += poll.h
header-y += posix_types.h
header-y += ptrace.h
+header-y += ptrace_v10.h
+header-y += ptrace_v32.h
header-y += resource.h
header-y += rs485.h
header-y += sembuf.h
diff --git a/arch/cris/include/uapi/asm/ptrace.h b/arch/cris/include/uapi/asm/ptrace.h
index c689c9b..bd8946f 100644
--- a/arch/cris/include/uapi/asm/ptrace.h
+++ b/arch/cris/include/uapi/asm/ptrace.h
@@ -1 +1,5 @@
-#include <arch/ptrace.h>
+#ifdef __arch_v32
+#include <asm/ptrace_v32.h>
+#else
+#include <asm/ptrace_v10.h>
+#endif
diff --git a/arch/cris/include/arch-v10/arch/ptrace.h b/arch/cris/include/uapi/asm/ptrace_v10.h
similarity index 100%
rename from arch/cris/include/arch-v10/arch/ptrace.h
rename to arch/cris/include/uapi/asm/ptrace_v10.h
diff --git a/arch/cris/include/arch-v32/arch/ptrace.h b/arch/cris/include/uapi/asm/ptrace_v32.h
similarity index 100%
rename from arch/cris/include/arch-v32/arch/ptrace.h
rename to arch/cris/include/uapi/asm/ptrace_v32.h
--
2.1.4


2015-05-14 15:27:33

by Rabin Vincent

[permalink] [raw]
Subject: [PATCH 2/3] CRIS: don't make asm/elf.h depend on asm/user.h

We're going to export asm/elf.h; remove its dependencies on the
non-exported asm/user.h and the unused asm/system.h include.

Signed-off-by: Rabin Vincent <[email protected]>
---
arch/cris/include/arch-v10/arch/elf.h | 5 +++--
arch/cris/include/arch-v32/arch/elf.h | 5 +++--
arch/cris/include/asm/elf.h | 5 +----
3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/arch/cris/include/arch-v10/arch/elf.h b/arch/cris/include/arch-v10/arch/elf.h
index 1eb638a..3ea65ce 100644
--- a/arch/cris/include/arch-v10/arch/elf.h
+++ b/arch/cris/include/arch-v10/arch/elf.h
@@ -1,10 +1,11 @@
#ifndef __ASMCRIS_ARCH_ELF_H
#define __ASMCRIS_ARCH_ELF_H

-#include <arch/system.h>
-
#define ELF_MACH EF_CRIS_VARIANT_ANY_V0_V10

+/* Matches struct user_regs_struct */
+#define ELF_NGREG 35
+
/*
* This is used to ensure we don't load something for the wrong architecture.
*/
diff --git a/arch/cris/include/arch-v32/arch/elf.h b/arch/cris/include/arch-v32/arch/elf.h
index c46d582..f09fe49 100644
--- a/arch/cris/include/arch-v32/arch/elf.h
+++ b/arch/cris/include/arch-v32/arch/elf.h
@@ -1,10 +1,11 @@
#ifndef _ASM_CRIS_ELF_H
#define _ASM_CRIS_ELF_H

-#include <arch/system.h>
-
#define ELF_CORE_EFLAGS EF_CRIS_VARIANT_V32

+/* Matches struct user_regs_struct */
+#define ELF_NGREG 32
+
/*
* This is used to ensure we don't load something for the wrong architecture.
*/
diff --git a/arch/cris/include/asm/elf.h b/arch/cris/include/asm/elf.h
index c2a394f..986adba 100644
--- a/arch/cris/include/asm/elf.h
+++ b/arch/cris/include/asm/elf.h
@@ -5,7 +5,7 @@
* ELF register definitions..
*/

-#include <asm/user.h>
+#include <arch/elf.h>

#define R_CRIS_NONE 0
#define R_CRIS_8 1
@@ -32,7 +32,6 @@ typedef unsigned long elf_greg_t;

/* Note that NGREG is defined to ELF_NGREG in include/linux/elfcore.h, and is
thus exposed to user-space. */
-#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
typedef elf_greg_t elf_gregset_t[ELF_NGREG];

/* A placeholder; CRIS does not have any fp regs. */
@@ -45,8 +44,6 @@ typedef unsigned long elf_fpregset_t;
#define ELF_DATA ELFDATA2LSB
#define ELF_ARCH EM_CRIS

-#include <arch/elf.h>
-
/* The master for these definitions is {binutils}/include/elf/cris.h: */
/* User symbols in this file have a leading underscore. */
#define EF_CRIS_UNDERSCORE 0x00000001
--
2.1.4

2015-05-14 15:27:45

by Rabin Vincent

[permalink] [raw]
Subject: [PATCH 3/3] CRIS: UAPI: fix elf.h export

CRIS userspace (uClibc for one) expects asm/elf.h to be exported but
this header appears to have gone missing at some point. Move it to
uapi/ and export it.

Signed-off-by: Rabin Vincent <[email protected]>
---
arch/cris/include/uapi/asm/Kbuild | 3 +++
arch/cris/include/{ => uapi}/asm/elf.h | 6 +++++-
arch/cris/include/{arch-v10/arch/elf.h => uapi/asm/elf_v10.h} | 0
arch/cris/include/{arch-v32/arch/elf.h => uapi/asm/elf_v32.h} | 0
4 files changed, 8 insertions(+), 1 deletion(-)
rename arch/cris/include/{ => uapi}/asm/elf.h (97%)
rename arch/cris/include/{arch-v10/arch/elf.h => uapi/asm/elf_v10.h} (100%)
rename arch/cris/include/{arch-v32/arch/elf.h => uapi/asm/elf_v32.h} (100%)

diff --git a/arch/cris/include/uapi/asm/Kbuild b/arch/cris/include/uapi/asm/Kbuild
index 8443dc8..d5564a0 100644
--- a/arch/cris/include/uapi/asm/Kbuild
+++ b/arch/cris/include/uapi/asm/Kbuild
@@ -6,6 +6,9 @@ header-y += ../arch-v32/arch/
header-y += auxvec.h
header-y += bitsperlong.h
header-y += byteorder.h
+header-y += elf.h
+header-y += elf_v10.h
+header-y += elf_v32.h
header-y += errno.h
header-y += ethernet.h
header-y += etraxgpio.h
diff --git a/arch/cris/include/asm/elf.h b/arch/cris/include/uapi/asm/elf.h
similarity index 97%
rename from arch/cris/include/asm/elf.h
rename to arch/cris/include/uapi/asm/elf.h
index 986adba..a5df05b 100644
--- a/arch/cris/include/asm/elf.h
+++ b/arch/cris/include/uapi/asm/elf.h
@@ -5,7 +5,11 @@
* ELF register definitions..
*/

-#include <arch/elf.h>
+#ifdef __arch_v32
+#include <asm/elf_v32.h>
+#else
+#include <asm/elf_v10.h>
+#endif

#define R_CRIS_NONE 0
#define R_CRIS_8 1
diff --git a/arch/cris/include/arch-v10/arch/elf.h b/arch/cris/include/uapi/asm/elf_v10.h
similarity index 100%
rename from arch/cris/include/arch-v10/arch/elf.h
rename to arch/cris/include/uapi/asm/elf_v10.h
diff --git a/arch/cris/include/arch-v32/arch/elf.h b/arch/cris/include/uapi/asm/elf_v32.h
similarity index 100%
rename from arch/cris/include/arch-v32/arch/elf.h
rename to arch/cris/include/uapi/asm/elf_v32.h
--
2.1.4