Re: [PATCH -mm 18/43] powerpc compat_binfmt_elf
On Fri, Dec 21, 2007 at 12:51:06PM -0500, Kyle McMartin wrote: > On Fri, Dec 21, 2007 at 12:56:09AM -0800, Roland McGrath wrote: > > > On Thu, Dec 20, 2007 at 03:58:16AM -0800, Roland McGrath wrote: > > > > +obj-$(CONFIG_PPC64)+= ../../../fs/compat_binfmt_elf.o > > > > > > Building files from another directory is nasty. Please add a > > > CONFIG_BINFMT_COMPAT_ELF so we can simply build it in fs/ > > > > If that's better, please post the precise Kconfig magic you have in mind to > > have it set when it should be. Kyle made a proposal but I like to get in to the party too... > > > > Just taking a stab that hch means, > > config BINFMT_COMPAT_ELF > def_bool n > depends on 64BIT > > and then in arch/powerpc/Kconfig > > config COMPAT > bool > default y if PPC64 > select BINFMT_COMPAT_ELF > > or somesuch. We recently discussed a common prefix for the selctable symbols and consensus pointed out "HAVE_" so let us try to use it. I did not quite understand the "depends on 64BIT" in Kyles example. Does we really want to use compat_binfmt_elf for all archs that define 64BIT? Anyway I added this in the example below. fs/Makefile: obj-$(COMPAT_BINFMT_ELF) += compat_binfmt_elf.o fs/Kconfig: config COMPAT_BINFMT_ELF depends on HAVE_COMPAT_BINFMT_ELF || 64BIT # COMPAT_BINFMT_ELF must be selected when an # architecture supoorts ... config HAVE_COMPAT_BINFMT_ELF arch/powerpc/Kconfig: config COMPAT bool default PPC64 select HAVE_COMPAT_BINFMT_ELF In the example above the extra indirection: HAVE_COMPAT_BINFMT_ELF => COMPAT_BNFMT_ELF is not really needed but tomorrow when we add another "depends on" to COMPAT_INFMT_ELF it is needed to avoid the misbehaving select that just ignore the dependencies and select the symbol anyway. Sam -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH -mm 18/43] powerpc compat_binfmt_elf
On Friday 21 December 2007, Kyle McMartin wrote: > Just taking a stab that hch means, > > config BINFMT_COMPAT_ELF > def_bool n > depends on 64BIT > I'd call it COMPAT_BINFMT_ELF, for consistency with the file name. Also, the definition and the depends are redundant if you expect the option to be autoselected. You can do either of config COMPAT_BINFMT_ELF bool or config COMPAT_BINFMT_ELF def_bool y depends on COMPAT The second option makes sense at the point where all architectures with compat code are using the same compat_binfmt_elf code. Arnd <>< -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH -mm 18/43] powerpc compat_binfmt_elf
On Fri, Dec 21, 2007 at 12:56:09AM -0800, Roland McGrath wrote: > > On Thu, Dec 20, 2007 at 03:58:16AM -0800, Roland McGrath wrote: > > > +obj-$(CONFIG_PPC64) += ../../../fs/compat_binfmt_elf.o > > > > Building files from another directory is nasty. Please add a > > CONFIG_BINFMT_COMPAT_ELF so we can simply build it in fs/ > > If that's better, please post the precise Kconfig magic you have in mind to > have it set when it should be. > Just taking a stab that hch means, config BINFMT_COMPAT_ELF def_bool n depends on 64BIT and then in arch/powerpc/Kconfig config COMPAT bool default y if PPC64 select BINFMT_COMPAT_ELF or somesuch. Regards, Kyle -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH -mm 18/43] powerpc compat_binfmt_elf
> On Thu, Dec 20, 2007 at 03:58:16AM -0800, Roland McGrath wrote: > > +obj-$(CONFIG_PPC64)+= ../../../fs/compat_binfmt_elf.o > > Building files from another directory is nasty. Please add a > CONFIG_BINFMT_COMPAT_ELF so we can simply build it in fs/ If that's better, please post the precise Kconfig magic you have in mind to have it set when it should be. Thanks, Roland -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH -mm 18/43] powerpc compat_binfmt_elf
On Thu, Dec 20, 2007 at 03:58:16AM -0800, Roland McGrath wrote: +obj-$(CONFIG_PPC64)+= ../../../fs/compat_binfmt_elf.o Building files from another directory is nasty. Please add a CONFIG_BINFMT_COMPAT_ELF so we can simply build it in fs/ If that's better, please post the precise Kconfig magic you have in mind to have it set when it should be. Thanks, Roland -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH -mm 18/43] powerpc compat_binfmt_elf
On Fri, Dec 21, 2007 at 12:56:09AM -0800, Roland McGrath wrote: On Thu, Dec 20, 2007 at 03:58:16AM -0800, Roland McGrath wrote: +obj-$(CONFIG_PPC64) += ../../../fs/compat_binfmt_elf.o Building files from another directory is nasty. Please add a CONFIG_BINFMT_COMPAT_ELF so we can simply build it in fs/ If that's better, please post the precise Kconfig magic you have in mind to have it set when it should be. Just taking a stab that hch means, config BINFMT_COMPAT_ELF def_bool n depends on 64BIT and then in arch/powerpc/Kconfig config COMPAT bool default y if PPC64 select BINFMT_COMPAT_ELF or somesuch. Regards, Kyle -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH -mm 18/43] powerpc compat_binfmt_elf
On Friday 21 December 2007, Kyle McMartin wrote: Just taking a stab that hch means, config BINFMT_COMPAT_ELF def_bool n depends on 64BIT I'd call it COMPAT_BINFMT_ELF, for consistency with the file name. Also, the definition and the depends are redundant if you expect the option to be autoselected. You can do either of config COMPAT_BINFMT_ELF bool or config COMPAT_BINFMT_ELF def_bool y depends on COMPAT The second option makes sense at the point where all architectures with compat code are using the same compat_binfmt_elf code. Arnd -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH -mm 18/43] powerpc compat_binfmt_elf
On Fri, Dec 21, 2007 at 12:51:06PM -0500, Kyle McMartin wrote: On Fri, Dec 21, 2007 at 12:56:09AM -0800, Roland McGrath wrote: On Thu, Dec 20, 2007 at 03:58:16AM -0800, Roland McGrath wrote: +obj-$(CONFIG_PPC64)+= ../../../fs/compat_binfmt_elf.o Building files from another directory is nasty. Please add a CONFIG_BINFMT_COMPAT_ELF so we can simply build it in fs/ If that's better, please post the precise Kconfig magic you have in mind to have it set when it should be. Kyle made a proposal but I like to get in to the party too... Just taking a stab that hch means, config BINFMT_COMPAT_ELF def_bool n depends on 64BIT and then in arch/powerpc/Kconfig config COMPAT bool default y if PPC64 select BINFMT_COMPAT_ELF or somesuch. We recently discussed a common prefix for the selctable symbols and consensus pointed out HAVE_ so let us try to use it. I did not quite understand the depends on 64BIT in Kyles example. Does we really want to use compat_binfmt_elf for all archs that define 64BIT? Anyway I added this in the example below. fs/Makefile: obj-$(COMPAT_BINFMT_ELF) += compat_binfmt_elf.o fs/Kconfig: config COMPAT_BINFMT_ELF depends on HAVE_COMPAT_BINFMT_ELF || 64BIT # COMPAT_BINFMT_ELF must be selected when an # architecture supoorts ... config HAVE_COMPAT_BINFMT_ELF arch/powerpc/Kconfig: config COMPAT bool default PPC64 select HAVE_COMPAT_BINFMT_ELF In the example above the extra indirection: HAVE_COMPAT_BINFMT_ELF = COMPAT_BNFMT_ELF is not really needed but tomorrow when we add another depends on to COMPAT_INFMT_ELF it is needed to avoid the misbehaving select that just ignore the dependencies and select the symbol anyway. Sam -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH -mm 18/43] powerpc compat_binfmt_elf
On Thu, Dec 20, 2007 at 03:58:16AM -0800, Roland McGrath wrote: > +obj-$(CONFIG_PPC64) += ../../../fs/compat_binfmt_elf.o Building files from another directory is nasty. Please add a CONFIG_BINFMT_COMPAT_ELF so we can simply build it in fs/ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH -mm 18/43] powerpc compat_binfmt_elf
This switches the CONFIG_PPC64 support for 32-bit ELF to use the generic fs/compat_binfmt_elf.c implementation instead of our own binfmt_elf32.c. Since so much is the same between 32/64, there is only one macro we have to define to make the generic support work out of the box. Signed-off-by: Roland McGrath <[EMAIL PROTECTED]> --- arch/powerpc/kernel/Makefile |3 +- arch/powerpc/kernel/binfmt_elf32.c | 69 include/asm-powerpc/elf.h |1 + 3 files changed, 3 insertions(+), 70 deletions(-) diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index 615ed96..2cbe58a 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile @@ -17,11 +17,12 @@ obj-y := semaphore.o cputable.o ptrace.o syscalls.o \ init_task.o process.o systbl.o idle.o \ signal.o obj-y += vdso32/ -obj-$(CONFIG_PPC64)+= setup_64.o binfmt_elf32.o sys_ppc32.o \ +obj-$(CONFIG_PPC64)+= setup_64.o sys_ppc32.o \ signal_64.o ptrace32.o \ paca.o cpu_setup_ppc970.o \ cpu_setup_pa6t.o \ firmware.o sysfs.o nvram_64.o +obj-$(CONFIG_PPC64)+= ../../../fs/compat_binfmt_elf.o obj-$(CONFIG_PPC64)+= vdso64/ obj-$(CONFIG_ALTIVEC) += vecemu.o vector.o obj-$(CONFIG_PPC_970_NAP) += idle_power4.o diff --git a/arch/powerpc/kernel/binfmt_elf32.c b/arch/powerpc/kernel/binfmt_elf32.c deleted file mode 100644 index 1d45d77..000 --- a/arch/powerpc/kernel/binfmt_elf32.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * binfmt_elf32.c: Support 32-bit PPC ELF binaries on Power3 and followons. - * based on the SPARC64 version. - * Copyright (C) 1995, 1996, 1997, 1998 David S. Miller([EMAIL PROTECTED]) - * Copyright (C) 1995, 1996, 1997, 1998 Jakub Jelinek ([EMAIL PROTECTED]) - * - * Copyright (C) 2000,2001 Ken Aaker ([EMAIL PROTECTED]), IBM Corp - * Copyright (C) 2001 Anton Blanchard ([EMAIL PROTECTED]), IBM - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include - -#undef ELF_ARCH -#undef ELF_CLASS -#define ELF_CLASS ELFCLASS32 -#define ELF_ARCH EM_PPC - -#undef elfhdr -#undef elf_phdr -#undef elf_note -#undef elf_addr_t -#define elfhdr elf32_hdr -#define elf_phdr elf32_phdr -#define elf_note elf32_note -#define elf_addr_t Elf32_Off - -#define elf_prstatus compat_elf_prstatus -#define elf_prpsinfo compat_elf_prpsinfo - -#define elf_core_copy_regs compat_elf_core_copy_regs -static inline void compat_elf_core_copy_regs(compat_elf_gregset_t *elf_regs, -struct pt_regs *regs) -{ - PPC_ELF_CORE_COPY_REGS((*elf_regs), regs); -} - -#define elf_core_copy_task_regs compat_elf_core_copy_task_regs -static int compat_elf_core_copy_task_regs(struct task_struct *tsk, - compat_elf_gregset_t *elf_regs) -{ - struct pt_regs *regs = tsk->thread.regs; - if (regs) - compat_elf_core_copy_regs(elf_regs, regs); - return 1; -} - -#include - -#undef cputime_to_timeval -#define cputime_to_timeval cputime_to_compat_timeval -static __inline__ void -cputime_to_compat_timeval(const cputime_t cputime, struct compat_timeval *value) -{ - unsigned long jiffies = cputime_to_jiffies(cputime); - value->tv_usec = (jiffies % HZ) * (100L / HZ); - value->tv_sec = jiffies / HZ; -} - -#define init_elf_binfmt init_elf32_binfmt - -#include "../../../fs/binfmt_elf.c" diff --git a/include/asm-powerpc/elf.h b/include/asm-powerpc/elf.h index fd9bf8b..9080d85 100644 --- a/include/asm-powerpc/elf.h +++ b/include/asm-powerpc/elf.h @@ -165,6 +165,7 @@ typedef elf_vrreg_t elf_vrregset_t32[ELF_NVRREG32]; * This is used to ensure we don't load something for the wrong architecture. */ #define elf_check_arch(x) ((x)->e_machine == ELF_ARCH) +#define compat_elf_check_arch(x) ((x)->e_machine == EM_PPC) #define USE_ELF_CORE_DUMP #define CORE_DUMP_USE_REGSET -- 1.5.3.6 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH -mm 18/43] powerpc compat_binfmt_elf
This switches the CONFIG_PPC64 support for 32-bit ELF to use the generic fs/compat_binfmt_elf.c implementation instead of our own binfmt_elf32.c. Since so much is the same between 32/64, there is only one macro we have to define to make the generic support work out of the box. Signed-off-by: Roland McGrath [EMAIL PROTECTED] --- arch/powerpc/kernel/Makefile |3 +- arch/powerpc/kernel/binfmt_elf32.c | 69 include/asm-powerpc/elf.h |1 + 3 files changed, 3 insertions(+), 70 deletions(-) diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index 615ed96..2cbe58a 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile @@ -17,11 +17,12 @@ obj-y := semaphore.o cputable.o ptrace.o syscalls.o \ init_task.o process.o systbl.o idle.o \ signal.o obj-y += vdso32/ -obj-$(CONFIG_PPC64)+= setup_64.o binfmt_elf32.o sys_ppc32.o \ +obj-$(CONFIG_PPC64)+= setup_64.o sys_ppc32.o \ signal_64.o ptrace32.o \ paca.o cpu_setup_ppc970.o \ cpu_setup_pa6t.o \ firmware.o sysfs.o nvram_64.o +obj-$(CONFIG_PPC64)+= ../../../fs/compat_binfmt_elf.o obj-$(CONFIG_PPC64)+= vdso64/ obj-$(CONFIG_ALTIVEC) += vecemu.o vector.o obj-$(CONFIG_PPC_970_NAP) += idle_power4.o diff --git a/arch/powerpc/kernel/binfmt_elf32.c b/arch/powerpc/kernel/binfmt_elf32.c deleted file mode 100644 index 1d45d77..000 --- a/arch/powerpc/kernel/binfmt_elf32.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * binfmt_elf32.c: Support 32-bit PPC ELF binaries on Power3 and followons. - * based on the SPARC64 version. - * Copyright (C) 1995, 1996, 1997, 1998 David S. Miller([EMAIL PROTECTED]) - * Copyright (C) 1995, 1996, 1997, 1998 Jakub Jelinek ([EMAIL PROTECTED]) - * - * Copyright (C) 2000,2001 Ken Aaker ([EMAIL PROTECTED]), IBM Corp - * Copyright (C) 2001 Anton Blanchard ([EMAIL PROTECTED]), IBM - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#include asm/processor.h -#include linux/module.h -#include linux/compat.h -#include linux/elfcore-compat.h - -#undef ELF_ARCH -#undef ELF_CLASS -#define ELF_CLASS ELFCLASS32 -#define ELF_ARCH EM_PPC - -#undef elfhdr -#undef elf_phdr -#undef elf_note -#undef elf_addr_t -#define elfhdr elf32_hdr -#define elf_phdr elf32_phdr -#define elf_note elf32_note -#define elf_addr_t Elf32_Off - -#define elf_prstatus compat_elf_prstatus -#define elf_prpsinfo compat_elf_prpsinfo - -#define elf_core_copy_regs compat_elf_core_copy_regs -static inline void compat_elf_core_copy_regs(compat_elf_gregset_t *elf_regs, -struct pt_regs *regs) -{ - PPC_ELF_CORE_COPY_REGS((*elf_regs), regs); -} - -#define elf_core_copy_task_regs compat_elf_core_copy_task_regs -static int compat_elf_core_copy_task_regs(struct task_struct *tsk, - compat_elf_gregset_t *elf_regs) -{ - struct pt_regs *regs = tsk-thread.regs; - if (regs) - compat_elf_core_copy_regs(elf_regs, regs); - return 1; -} - -#include linux/time.h - -#undef cputime_to_timeval -#define cputime_to_timeval cputime_to_compat_timeval -static __inline__ void -cputime_to_compat_timeval(const cputime_t cputime, struct compat_timeval *value) -{ - unsigned long jiffies = cputime_to_jiffies(cputime); - value-tv_usec = (jiffies % HZ) * (100L / HZ); - value-tv_sec = jiffies / HZ; -} - -#define init_elf_binfmt init_elf32_binfmt - -#include ../../../fs/binfmt_elf.c diff --git a/include/asm-powerpc/elf.h b/include/asm-powerpc/elf.h index fd9bf8b..9080d85 100644 --- a/include/asm-powerpc/elf.h +++ b/include/asm-powerpc/elf.h @@ -165,6 +165,7 @@ typedef elf_vrreg_t elf_vrregset_t32[ELF_NVRREG32]; * This is used to ensure we don't load something for the wrong architecture. */ #define elf_check_arch(x) ((x)-e_machine == ELF_ARCH) +#define compat_elf_check_arch(x) ((x)-e_machine == EM_PPC) #define USE_ELF_CORE_DUMP #define CORE_DUMP_USE_REGSET -- 1.5.3.6 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH -mm 18/43] powerpc compat_binfmt_elf
On Thu, Dec 20, 2007 at 03:58:16AM -0800, Roland McGrath wrote: +obj-$(CONFIG_PPC64) += ../../../fs/compat_binfmt_elf.o Building files from another directory is nasty. Please add a CONFIG_BINFMT_COMPAT_ELF so we can simply build it in fs/ -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/