From 4f4b90c6097546205502e8ad34c001516d4e3e44 Mon Sep 17 00:00:00 2001 From: Jim Wilson Date: Thu, 27 Dec 2018 15:26:11 -0800 Subject: RISC-V: Add initial return value location support. Started with the aarch64 support and modified it for RISC-V. The flattened structure support hasn't been written yet, but the rest of it should be correct for the LP64D ABI. We have potentially 6 different ABIs to support, so this requires checking elf header flags in riscv_init when setting the hook. Signed-off-by: Jim Wilson --- backends/riscv_init.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'backends/riscv_init.c') diff --git a/backends/riscv_init.c b/backends/riscv_init.c index 8b7ce8b5..ecee2910 100644 --- a/backends/riscv_init.c +++ b/backends/riscv_init.c @@ -33,12 +33,16 @@ #define RELOC_PREFIX R_RISCV_ #include "libebl_CPU.h" +#include "libelfP.h" + /* This defines the common reloc hooks based on riscv_reloc.def. */ #include "common-reloc.c" +extern __typeof (EBLHOOK (return_value_location)) + riscv_return_value_location_lp64d attribute_hidden; const char * -riscv_init (Elf *elf __attribute__ ((unused)), +riscv_init (Elf *elf, GElf_Half machine __attribute__ ((unused)), Ebl *eh, size_t ehlen) @@ -59,6 +63,10 @@ riscv_init (Elf *elf __attribute__ ((unused)), HOOK (eh, machine_flag_check); HOOK (eh, set_initial_registers_tid); HOOK (eh, core_note); + if (eh->class == ELFCLASS64 + && ((elf->state.elf64.ehdr->e_flags & EF_RISCV_FLOAT_ABI) + == EF_RISCV_FLOAT_ABI_DOUBLE)) + eh->return_value_location = riscv_return_value_location_lp64d; return MODVERSION; } -- cgit v1.2.3 From dcd3704ee5a522887d365d1a4cf77e585f1b68b4 Mon Sep 17 00:00:00 2001 From: Jim Wilson Date: Thu, 27 Dec 2018 15:27:02 -0800 Subject: RISC-V: Add untested 32-bit core file support. Adds 32-bit support exactly the same way that the sparc backend handles 32- and 64-bit core file support. The 64-bit core file support was tested and still works same as before. Signed-off-by: Jim Wilson --- backends/riscv_init.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'backends/riscv_init.c') diff --git a/backends/riscv_init.c b/backends/riscv_init.c index ecee2910..3398c104 100644 --- a/backends/riscv_init.c +++ b/backends/riscv_init.c @@ -41,6 +41,8 @@ extern __typeof (EBLHOOK (return_value_location)) riscv_return_value_location_lp64d attribute_hidden; +extern __typeof (EBLHOOK (core_note)) riscv64_core_note attribute_hidden; + const char * riscv_init (Elf *elf, GElf_Half machine __attribute__ ((unused)), @@ -62,7 +64,10 @@ riscv_init (Elf *elf, HOOK (eh, check_special_symbol); HOOK (eh, machine_flag_check); HOOK (eh, set_initial_registers_tid); - HOOK (eh, core_note); + if (eh->class == ELFCLASS64) + eh->core_note = riscv64_core_note; + else + HOOK (eh, core_note); if (eh->class == ELFCLASS64 && ((elf->state.elf64.ehdr->e_flags & EF_RISCV_FLOAT_ABI) == EF_RISCV_FLOAT_ABI_DOUBLE)) -- cgit v1.2.3