Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Sep 2018 08:12:35 +0000 (UTC)
From:      Ruslan Bukin <br@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r338609 - head/sys/riscv/riscv
Message-ID:  <201809120812.w8C8CZCK017412@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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",



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201809120812.w8C8CZCK017412>