From owner-svn-src-all@freebsd.org Mon Sep 21 22:24:47 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 168533FF1CB; Mon, 21 Sep 2020 22:24:47 +0000 (UTC) (envelope-from scottph@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BwJsB6v6Zz42kw; Mon, 21 Sep 2020 22:24:46 +0000 (UTC) (envelope-from scottph@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CFCFE15540; Mon, 21 Sep 2020 22:24:46 +0000 (UTC) (envelope-from scottph@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 08LMOkgo060086; Mon, 21 Sep 2020 22:24:46 GMT (envelope-from scottph@FreeBSD.org) Received: (from scottph@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 08LMOkmO060085; Mon, 21 Sep 2020 22:24:46 GMT (envelope-from scottph@FreeBSD.org) Message-Id: <202009212224.08LMOkmO060085@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottph set sender to scottph@FreeBSD.org using -f From: D Scott Phillips Date: Mon, 21 Sep 2020 22:24:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r365982 - head/stand/common X-SVN-Group: head X-SVN-Commit-Author: scottph X-SVN-Commit-Paths: head/stand/common X-SVN-Commit-Revision: 365982 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Sep 2020 22:24:47 -0000 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));