Xtensa updates for v6.1

- add support for FDPIC and static PIE executable formats for noMMU
 -----BEGIN PGP SIGNATURE-----
 
 iQJHBAABCgAxFiEEK2eFS5jlMn3N6xfYUfnMkfg/oEQFAmNEg54THGpjbXZia2Jj
 QGdtYWlsLmNvbQAKCRBR+cyR+D+gRDZHD/9FqjYXY16y66WRKbUN4DCzzYLuxWBV
 3mSdZyqjw+AB24XBbY4i81ppvdyTnA3i2nNrbjq6OWIp9uWUyGXdw+dnmGRlgulc
 EJLyRBbaal1YD+Tohn8n4sAuE8zpOtL1PHIb2Z7CySXVSNV7JxvIyUD43o9bUW45
 Qse0BWGq1hZHmFWeJ4J8K4NDAPxMEWCOrIbqjyEMODKOUy0zKWw1OT7fKDMEP/zm
 7H5o9k1QD0AcZPVAUGDq6PChSxjv8avAfD635UzvsYPpd/6ovnNT3bTrApARErdv
 XwgtVPcMEQ8oEr6ALAQGlmu092Cb9jwXZFnaYW1GBG8m6uT6BXybWf69zF8l6RrG
 lKcPc6F9HpHNR8ukfJ3pnEiHBGPQhu3lA6WDj9+URKY+BSbBDa3jtpf8p3uTRktb
 SfK7EXl9MSYfSq/tPqVLWL71L97Kx1n4OxylqU+UU0+SSfm6buZSsAMKPCUOjdKI
 SvTDFUk3XKIARAnT8KD8Nj1opmpRHSAi5r6LXpu6v2/InBx7SrGzVuh05yJ2jGUO
 0qeiDKTKTg254oUlnW9yVXkxrcu2THar17v4YgA6zu/zk5sOJSebCLly9upX+q4C
 oIXGSPB5UQi+cluEfYpvAo42YTONuDSaA/p26EeUhnBsbgIhInTi3zLWKXYWwezC
 YSQAsD1mOZICxg==
 =quUm
 -----END PGP SIGNATURE-----

Merge tag 'xtensa-20221010' of https://github.com/jcmvbkbc/linux-xtensa

Pull xtensa updates from Max Filippov:

 - add support for FDPIC and static PIE executable formats for noMMU

* tag 'xtensa-20221010' of https://github.com/jcmvbkbc/linux-xtensa:
  xtensa: add FDPIC and static PIE support for noMMU
  xtensa: clean up ELF_PLAT_INIT macro
This commit is contained in:
Linus Torvalds 2022-10-10 14:21:11 -07:00
commit e2302539dd
4 changed files with 28 additions and 5 deletions

View File

@ -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_FDPIC_CORE_EFLAGS 0
/*
* These are used to set parameters in the core dumps.
*/
@ -153,10 +157,22 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
*/
#define ELF_PLAT_INIT(_r, load_addr) \
do { _r->areg[0]=0; /*_r->areg[1]=0;*/ _r->areg[2]=0; _r->areg[3]=0; \
_r->areg[4]=0; _r->areg[5]=0; _r->areg[6]=0; _r->areg[7]=0; \
_r->areg[8]=0; _r->areg[9]=0; _r->areg[10]=0; _r->areg[11]=0; \
_r->areg[12]=0; _r->areg[13]=0; _r->areg[14]=0; _r->areg[15]=0; \
do { \
(_r)->areg[0] = 0; /*(_r)->areg[1] = 0;*/ \
(_r)->areg[2] = 0; (_r)->areg[3] = 0; \
(_r)->areg[4] = 0; (_r)->areg[5] = 0; \
(_r)->areg[6] = 0; (_r)->areg[7] = 0; \
(_r)->areg[8] = 0; (_r)->areg[9] = 0; \
(_r)->areg[10] = 0; (_r)->areg[11] = 0; \
(_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[4] = _exec_map_addr; \
(_r)->areg[5] = _interp_map_addr; \
(_r)->areg[6] = dynamic_addr; \
} while (0)
typedef struct {

View File

@ -205,9 +205,12 @@ struct thread_struct {
#define start_thread(regs, new_pc, new_sp) \
do { \
unsigned long syscall = (regs)->syscall; \
unsigned long current_aregs[16]; \
memcpy(current_aregs, (regs)->areg, sizeof(current_aregs)); \
memset((regs), 0, sizeof(*(regs))); \
(regs)->pc = (new_pc); \
(regs)->ps = USER_PS_VALUE; \
memcpy((regs)->areg, current_aregs, sizeof(current_aregs)); \
(regs)->areg[1] = (new_sp); \
(regs)->areg[0] = 0; \
(regs)->wmask = 1; \

View File

@ -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__

View File

@ -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 || XTENSA) && !MMU)
select ELFCORE
help
ELF FDPIC binaries are based on ELF, but allow the individual load