Skip to content

Commit

Permalink
WIP: xtensa: add FDPIC support
Browse files Browse the repository at this point in the history
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
  • Loading branch information
jcmvbkbc committed Jun 6, 2022
1 parent c676735 commit a44bcd0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
11 changes: 11 additions & 0 deletions arch/xtensa/include/asm/elf.h
Expand Up @@ -93,6 +93,10 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
#define elf_check_arch(x) ( ( (x)->e_machine == EM_XTENSA ) || \
( (x)->e_machine == EM_XTENSA_OLD ) )

#define ELFOSABI_XTENSA_FDPIC 65
#define elf_check_fdpic(x) ((x)->e_ident[EI_OSABI] == ELFOSABI_XTENSA_FDPIC)
#define elf_check_const_displacement(x) (0)

/*
* These are used to set parameters in the core dumps.
*/
Expand Down Expand Up @@ -159,6 +163,13 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
(_r)->areg[12]=0; (_r)->areg[13]=0; (_r)->areg[14]=0; (_r)->areg[15]=0; \
} while (0)

#define ELF_FDPIC_PLAT_INIT(_r, _exec_map_addr, _interp_map_addr, dynamic_addr) \
do { \
(_r)->areg[2] = _exec_map_addr; \
(_r)->areg[3] = _interp_map_addr; \
(_r)->areg[4] = dynamic_addr; \
} while(0)

typedef struct {
xtregs_opt_t opt;
xtregs_user_t user;
Expand Down
4 changes: 4 additions & 0 deletions arch/xtensa/include/uapi/asm/ptrace.h
Expand Up @@ -37,6 +37,10 @@
#define PTRACE_SETXTREGS 19
#define PTRACE_GETHBPREGS 20
#define PTRACE_SETHBPREGS 21
#define PTRACE_GETFDPIC 22

#define PTRACE_GETFDPIC_EXEC 0
#define PTRACE_GETFDPIC_INTERP 1

#ifndef __ASSEMBLY__

Expand Down
2 changes: 1 addition & 1 deletion fs/Kconfig.binfmt
Expand Up @@ -58,7 +58,7 @@ config ARCH_USE_GNU_PROPERTY
config BINFMT_ELF_FDPIC
bool "Kernel support for FDPIC ELF binaries"
default y if !BINFMT_ELF
depends on ARM || ((M68K || SUPERH) && !MMU)
depends on ARM || ((M68K || SUPERH) && !MMU) || XTENSA
select ELFCORE
help
ELF FDPIC binaries are based on ELF, but allow the individual load
Expand Down

0 comments on commit a44bcd0

Please sign in to comment.