Date: Mon, 21 Sep 2020 22:24:46 +0000 (UTC) From: D Scott Phillips <scottph@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r365982 - head/stand/common Message-ID: <202009212224.08LMOkmO060085@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: scottph Date: Mon Sep 21 22:24:46 2020 New Revision: 365982 URL: https://svnweb.freebsd.org/changeset/base/365982 Log: 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. Reviewed by: jhb Approved by: scottl (implicit) MFC after: 1 week Sponsored by: Ampere Computing, Inc. Differential Revision: https://reviews.freebsd.org/D26365 Modified: head/stand/common/reloc_elf.c Modified: head/stand/common/reloc_elf.c ============================================================================== --- head/stand/common/reloc_elf.c Mon Sep 21 22:23:57 2020 (r365981) +++ head/stand/common/reloc_elf.c Mon Sep 21 22:24:46 2020 (r365982) @@ -175,7 +175,8 @@ __elfN(reloc)(struct elf_file *ef, symaddr_fn *symaddr } return (0); -#elif defined(__powerpc__) +#elif defined(__aarch64__) || defined(__arm__) || defined(__powerpc__) || \ + defined(__riscv) Elf_Size w; const Elf_Rela *rela; @@ -185,7 +186,15 @@ __elfN(reloc)(struct elf_file *ef, symaddr_fn *symaddr 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));
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202009212224.08LMOkmO060085>