diff options
author | Max Filippov <jcmvbkbc@gmail.com> | 2023-02-04 22:12:30 -0800 |
---|---|---|
committer | Laurent Vivier <laurent@vivier.eu> | 2023-03-10 20:42:00 +0100 |
commit | d2796be69d7c14b8675e87af54b1e469bf509fe3 (patch) | |
tree | 5d4a64576bfafd957fcd93ed358d33d3ff3f18f6 /linux-user | |
parent | 9c1da8b5ee7f6e80e6b683e7fb73df1029a7cbbe (diff) |
linux-user: add support for xtensa FDPIC
Define xtensa-specific info_is_fdpic and fill in FDPIC-specific
registers in the xtensa version of init_thread.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Message-Id: <20230205061230.544451-1-jcmvbkbc@gmail.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'linux-user')
-rw-r--r-- | linux-user/elfload.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 5928c14dfc..150d1d4503 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -1748,6 +1748,15 @@ static inline void init_thread(struct target_pt_regs *regs, regs->windowstart = 1; regs->areg[1] = infop->start_stack; regs->pc = infop->entry; + if (info_is_fdpic(infop)) { + regs->areg[4] = infop->loadmap_addr; + regs->areg[5] = infop->interpreter_loadmap_addr; + if (infop->interpreter_loadmap_addr) { + regs->areg[6] = infop->interpreter_pt_dynamic_addr; + } else { + regs->areg[6] = infop->pt_dynamic_addr; + } + } } /* See linux kernel: arch/xtensa/include/asm/elf.h. */ @@ -2207,11 +2216,16 @@ static void zero_bss(abi_ulong elf_bss, abi_ulong last_bss, int prot) } } -#ifdef TARGET_ARM +#if defined(TARGET_ARM) static int elf_is_fdpic(struct elfhdr *exec) { return exec->e_ident[EI_OSABI] == ELFOSABI_ARM_FDPIC; } +#elif defined(TARGET_XTENSA) +static int elf_is_fdpic(struct elfhdr *exec) +{ + return exec->e_ident[EI_OSABI] == ELFOSABI_XTENSA_FDPIC; +} #else /* Default implementation, always false. */ static int elf_is_fdpic(struct elfhdr *exec) |