From owner-svn-src-head@freebsd.org Wed Sep 12 08:12:35 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7AE48108B159; Wed, 12 Sep 2018 08:12:35 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 31D69776F4; Wed, 12 Sep 2018 08:12:35 +0000 (UTC) (envelope-from br@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 2CD4023E6D; Wed, 12 Sep 2018 08:12:35 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w8C8CZG8017413; Wed, 12 Sep 2018 08:12:35 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w8C8CZCK017412; Wed, 12 Sep 2018 08:12:35 GMT (envelope-from br@FreeBSD.org) Message-Id: <201809120812.w8C8CZCK017412@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Wed, 12 Sep 2018 08:12:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338609 - head/sys/riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: head/sys/riscv/riscv X-SVN-Commit-Revision: 338609 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Sep 2018 08:12:35 -0000 Author: br Date: Wed Sep 12 08:12:34 2018 New Revision: 338609 URL: https://svnweb.freebsd.org/changeset/base/338609 Log: Use elf_relocaddr() to find the address for R_RISCV_RELATIVE relocation. elf_relocaddr() has a hook to handle VIMAGE data addresses. This fixes VIMAGE support for RISC-V when built as a module. Approved by: re (gjb) Sponsored by: DARPA, AFRL Modified: head/sys/riscv/riscv/elf_machdep.c Modified: head/sys/riscv/riscv/elf_machdep.c ============================================================================== --- head/sys/riscv/riscv/elf_machdep.c Wed Sep 12 08:05:33 2018 (r338608) +++ head/sys/riscv/riscv/elf_machdep.c Wed Sep 12 08:12:34 2018 (r338609) @@ -330,11 +330,9 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbas break; case R_RISCV_RELATIVE: - val = relocbase + addend; - before64 = *where; - if (*where != val) - *where = val; + + *where = elf_relocaddr(lf, relocbase + addend); if (debug_kld) printf("%p %c %-24s %016lx -> %016lx\n",