git: b9696aebdb18 - stable/12 - stand/reloc_elf: Handle relative relocations for arm{,64} and riscv
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 08 Oct 2021 01:16:47 UTC
The branch stable/12 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=b9696aebdb184108286f22e59a01dd60932b5ca9 commit b9696aebdb184108286f22e59a01dd60932b5ca9 Author: D Scott Phillips <scottph@FreeBSD.org> AuthorDate: 2020-09-21 22:24:46 +0000 Commit: Kyle Evans <kevans@FreeBSD.org> CommitDate: 2021-10-08 01:15:59 +0000 stand/reloc_elf: Handle relative relocations for arm{,64} and riscv Extend the powerpc relative relocation handling from r240782 to a handful of other architectures. This is needed to properly read dependency information from kernel modules. (cherry picked from commit 987eabdc2ae1c0beba77e4d3b538155e81c7a7d5) --- stand/common/reloc_elf.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/stand/common/reloc_elf.c b/stand/common/reloc_elf.c index ce44b275ab02..388fea218aac 100644 --- a/stand/common/reloc_elf.c +++ b/stand/common/reloc_elf.c @@ -200,7 +200,8 @@ __elfN(reloc)(struct elf_file *ef, symaddr_fn *symaddr, const void *reldata, } return (0); -#elif defined(__powerpc__) +#elif defined(__aarch64__) || defined(__arm__) || defined(__powerpc__) || \ + defined(__riscv) Elf_Size w; const Elf_Rela *rela; @@ -210,7 +211,15 @@ __elfN(reloc)(struct elf_file *ef, symaddr_fn *symaddr, const void *reldata, if (relbase + rela->r_offset >= dataaddr && relbase + rela->r_offset < dataaddr + len) { switch (ELF_R_TYPE(rela->r_info)) { +#if defined(__aarch64__) + case R_AARCH64_RELATIVE: +#elif defined(__arm__) + case R_ARM_RELATIVE: +#elif defined(__powerpc__) case R_PPC_RELATIVE: +#elif defined(__riscv) + case R_RISCV_RELATIVE: +#endif w = relbase + rela->r_addend; bcopy(&w, (u_char *)data + (relbase + rela->r_offset - dataaddr), sizeof(w));