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",
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to