RISC-V: Add awareness for RISC-V reloations

This patch adds awareness of RISC-V relocations throughout the grub tools
as well as dynamic linkage and elf->PE relocation conversion support.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
Alexander Graf 2019-02-12 11:31:04 +01:00 committed by Vincent Batts
parent b3213ec755
commit 893ed83b2e
5 changed files with 662 additions and 5 deletions

View file

@ -234,7 +234,7 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e)
unsigned i;
const Elf_Shdr *s;
grub_size_t tsize = 0, talign = 1;
#if !defined (__i386__) && !defined (__x86_64__)
#if !defined (__i386__) && !defined (__x86_64__) && !defined(__riscv)
grub_size_t tramp;
grub_size_t got;
grub_err_t err;
@ -250,7 +250,7 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e)
talign = s->sh_addralign;
}
#if !defined (__i386__) && !defined (__x86_64__)
#if !defined (__i386__) && !defined (__x86_64__) && !defined(__riscv)
err = grub_arch_dl_get_tramp_got_size (e, &tramp, &got);
if (err)
return err;
@ -313,7 +313,7 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_Ehdr *e)
mod->segment = seg;
}
}
#if !defined (__i386__) && !defined (__x86_64__)
#if !defined (__i386__) && !defined (__x86_64__) && !defined(__riscv)
ptr = (char *) ALIGN_UP ((grub_addr_t) ptr, GRUB_ARCH_DL_TRAMP_ALIGN);
mod->tramp = ptr;
mod->trampptr = ptr;