C6X: add support to build with BINFMT_ELF_FDPIC
Subsystems (3)
PATCH 1/1 C6X: add support to build with BINFMT_ELF_FDPIC
C6x userspace supports a shared library mechanism called DSBT for systems with no MMU. DSBT is similar to FDPIC in allowing shared text segments and private copies of data segments without an MMU. Both methods access data using a base register and offset. With FDPIC, the caller of an external function sets up the base register for the callee. With DSBT, the called function sets up its own base register. Other details differ but both userspaces need the same thing from the kernel loader: a map of where each ELF segment was loaded. The FDPIC loader already provides this, so DSBT just uses it.
This patch enables BINFMT_ELF_FDPIC by default for C6X and provides the necessary architecture hooks for the generic loader.
--- arch/c6x/include/asm/elf.h | 12 +++++++++++- arch/c6x/include/asm/mmu.h | 4 ++++ arch/c6x/include/asm/ptrace.h | 5 +++++ arch/c6x/kernel/process.c | 7 +++++++ fs/Kconfig.binfmt | 2 +- 5 files changed, 28 insertions(+), 2 deletions(-)
arch/c6x/include/asm/elf.h +11 -1
@@ -30,7 +30,17 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];*/ #define elf_check_arch (x) ((x)->e_machine == EM_TI_C6000) -#define elf_check_const_displacement (x) (1) +#define elf_check_fdpic (x) (1) +#define elf_check_const_displacement (x) (0) + +#define ELF_FDPIC_PLAT_INIT (_regs, _exec_map, _interp_map, _dynamic_addr) \ +do { \ + _regs->b4 = (_exec_map); \ + _regs->a6 = (_interp_map); \ + _regs->b6 = (_dynamic_addr); \ +} while (0) + +#define ELF_FDPIC_CORE_EFLAGS 0/* * These are used to set parameters in the core dumps.
arch/c6x/include/asm/mmu.h +4 -0
@@ -13,6 +13,10 @@typedef struct {unsigned long end_brk; +#ifdef CONFIG_BINFMT_ELF_FDPIC +unsigned long exec_fdpic_loadmap; +unsigned long interp_fdpic_loadmap; +#endif }mm_context_t ;#endif /* _ASM_C6X_MMU_H */
arch/c6x/include/asm/ptrace.h +5 -0
@@ -97,6 +97,11 @@#define PT_DP PT_B14/* Data Segment Pointer (B14) */ #define PT_SP PT_B15/* Stack Pointer (B15) */ +#define PTRACE_GETFDPIC 31/* get the ELF fdpic loadmap address */ + +#define PTRACE_GETFDPIC_EXEC 0/* [addr] request the executable loadmap */ +#define PTRACE_GETFDPIC_INTERP 1/* [addr] request the interpreter loadmap */ +#ifndef __ASSEMBLY__#ifdef _BIG_ENDIAN
arch/c6x/kernel/process.c +7 -0
@@ -263,3 +263,10 @@ unsigned long get_wchan(struct task_struct *p) {return p->thread.wchan; } + +/* Fill in the fpu structure for a core dump. This is easy -- we don't have any */ +int dump_fpu (struct pt_regs *regs,elf_fpregset_t *fpu) +{ +/* Not valid */ +return 0 ; +}
fs/Kconfig.binfmt +1 -1
@@ -33,7 +33,7 @@ config ARCH_BINFMT_ELF_RANDOMIZE_PIE config BINFMT_ELF_FDPIC bool "Kernel support for FDPIC ELF binaries" default y - depends on (FRV || BLACKFIN || (SUPERH32 && !MMU)) + depends on (FRV || BLACKFIN || (SUPERH32 && !MMU) || TMS320C6X) help ELF FDPIC binaries are based on ELF, but allow the individual load segments of a binary to be located in memory independently of each
Signature · 1 line
1.7.9.1
arch/c6x/kernel/process.c unsigned long get_wchan(struct task_struct *p) · line 272
Quoted 10 lines · Mark Salter
arch/c6x/kernel/process.c +7
-0+ +/* Fill in the fpu structure for a core dump. This is easy -- we don't have any */ +int dump_fpu (struct pt_regs *regs,elf_fpregset_t *fpu) +{ + /* Not valid */ + return 0; +}
you could avoid this like Blackfin has:arch/blackfin/include/asm/elf.h:
#define ELF_CORE_COPY_FPREGS(...) 0 /* Blackfin has no FPU */
Quoted 8 lines
fs/Kconfig.binfmt +0
-0config
BINFMT_ELF_FDPIC
bool "Kernel support for FDPIC ELF binaries" default y- depends on (FRV || BLACKFIN || (SUPERH32 && !MMU)) + depends on (FRV || BLACKFIN || (SUPERH32 && !MMU) || TMS320C6X)
shouldn't the main arch symbol be "C6X" to match arch/c6x/ ? -mike
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 4 lines · Mike Frysinger
Quoted 3 lines · Mark Salter
arch/c6x/kernel/process.c +0
-0
Quoted 11 lines
arch/c6x/kernel/process.c unsigned long get_wchan(struct task_struct *p) · line 272
Quoted 7 lines
arch/c6x/kernel/process.c +7
-0+ +/* Fill in the fpu structure for a core dump. This is easy -- we don't have any */ +int dump_fpu (struct pt_regs *regs,elf_fpregset_t *fpu) +{ +/* Not valid */ +return 0 ; +}you could avoid this like Blackfin has:
arch/blackfin/include/asm/elf.h:
#defineELF_CORE_COPY_FPREGS(...)0 /* Blackfin has no FPU */
Yes, thanks. That's a better way I missed.
Quoted 11 lines
fs/Kconfig.binfmt config ARCH_BINFMT_ELF_RANDOMIZE_PIE · line 36
Quoted 9 lines
fs/Kconfig.binfmt +1
-1config BINFMT_ELF_FDPIC bool "Kernel support for FDPIC ELF binaries" default y - depends on (FRV || BLACKFIN || (SUPERH32 && !MMU)) + depends on (FRV || BLACKFIN || (SUPERH32 && !MMU) || TMS320C6X)shouldn't the main arch symbol be "C6X" to match
arch/c6x/?
It probably should have been. Most architectures use that convention but there are notable exceptions like powerpc and sh.
Quoted 1 line
-mike
Quoted 12 lines
Quoted 11 lines
fs/Kconfig.binfmt config ARCH_BINFMT_ELF_RANDOMIZE_PIE · line 36
Quoted 9 lines
fs/Kconfig.binfmt +1
-1config BINFMT_ELF_FDPIC bool "Kernel support for FDPIC ELF binaries" default y - depends on (FRV || BLACKFIN || (SUPERH32 && !MMU)) + depends on (FRV || BLACKFIN || (SUPERH32 && !MMU) || TMS320C6X)shouldn't the main arch symbol be "C6X" to match
arch/c6x/?
Quoted 2 lines
It probably should have been. Most architectures use that convention but there are notable exceptions like powerpc and sh.
Please do not repeat past mistakes.
It should be trivial to fix.
Allow TMS320C6X for a sinel relase along with C6X - and drop it when all users outside your arch has switched over.
Sam
Quoted 2 lines · Sam Ravnborg
Allow TMS320C6X for a sinel relase along with C6X - and drop it when all users outside your arch has switched over.
I'm not sure we need to carry TMS320C6X for even a single release. As Mike pointed out, there are few references, actually no references right now, so now would be a good time to correct it. I'll make a patch to do just that.
--Mark
Quoted 8 lines · Mark Salter
Quoted 2 lines · Sam Ravnborg
Allow TMS320C6X for a sinel relase along with C6X - and drop it when all users outside your arch has switched over.
I'm not sure we need to carry TMS320C6X for even a single release. As Mike pointed out, there are few references, actually no references right now, so now would be a good time to correct it. I'll make a patch to do just that.
thx!
-mike
Quoted 13 lines · Mark Salter
Quoted 11 lines · Mike Frysinger
Quoted 8 lines · Mark Salter
fs/Kconfig.binfmt +0
-0config
BINFMT_ELF_FDPIC
bool "Kernel support for FDPIC ELF binaries" default y- depends on (FRV || BLACKFIN || (SUPERH32 && !MMU)) + depends on (FRV || BLACKFIN || (SUPERH32 && !MMU) || TMS320C6X)shouldn't the main arch symbol be "C6X" to match
arch/c6x/?
Quoted 2 lines
It probably should have been. Most architectures use that convention but there are notable exceptions like powerpc and sh.
seems like it'd be fairly trivial to convert it. there aren't many references in the kernel tree to TMS320C6X.
-mike
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html