summaryrefslogtreecommitdiffstats
path: root/backends/riscv_init.c
diff options
context:
space:
mode:
Diffstat (limited to 'backends/riscv_init.c')
-rw-r--r--backends/riscv_init.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/backends/riscv_init.c b/backends/riscv_init.c
index 8b7ce8b5..3398c104 100644
--- a/backends/riscv_init.c
+++ b/backends/riscv_init.c
@@ -33,12 +33,18 @@
#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;
+
+extern __typeof (EBLHOOK (core_note)) riscv64_core_note attribute_hidden;
const char *
-riscv_init (Elf *elf __attribute__ ((unused)),
+riscv_init (Elf *elf,
GElf_Half machine __attribute__ ((unused)),
Ebl *eh,
size_t ehlen)
@@ -58,7 +64,14 @@ riscv_init (Elf *elf __attribute__ ((unused)),
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))
+ eh->return_value_location = riscv_return_value_location_lp64d;
return MODVERSION;
}