diff options
| author | Jim Wilson <[email protected]> | 2018-12-27 15:26:11 -0800 |
|---|---|---|
| committer | Mark Wielaard <[email protected]> | 2019-01-10 13:25:33 +0100 |
| commit | 4f4b90c6097546205502e8ad34c001516d4e3e44 (patch) | |
| tree | 6c46a1e9285b4961064831dec43e7673fdb363fa /backends/riscv_init.c | |
| parent | 1dabad36ee28aa76b8cf14b6426b379cabee6def (diff) | |
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 <[email protected]>
Diffstat (limited to 'backends/riscv_init.c')
| -rw-r--r-- | backends/riscv_init.c | 10 |
1 files changed, 9 insertions, 1 deletions
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; } |
