[Git][ghc/ghc][wip/supersven/riscv64-ncg] Linker: Add missing relocation

Sven Tennie (@supersven) gitlab at gitlab.haskell.org
Sat Feb 10 09:47:22 UTC 2024



Sven Tennie pushed to branch wip/supersven/riscv64-ncg at Glasgow Haskell Compiler / GHC


Commits:
a24a3eca by Sven Tennie at 2024-02-10T10:46:53+01:00
Linker: Add missing relocation

- - - - -


1 changed file:

- rts/linker/elf_reloc_riscv64.c


Changes:

=====================================
rts/linker/elf_reloc_riscv64.c
=====================================
@@ -150,6 +150,7 @@ bool encodeAddendRISCV64(Section *section, Elf_Rel *rel, int64_t addend) {
   addr_t P = (addr_t)((uint8_t *)section->start + rel->r_offset);
   int exp_shift = -1;
   switch (ELF64_R_TYPE(rel->r_info)) {
+  case R_RISCV_32_PCREL:
   case R_RISCV_32:
     write32le((inst_t*) P, addend);
     break;
@@ -293,6 +294,8 @@ int64_t computeAddend(Section *section, Elf_Rel *rel, ElfSymbol *symbol,
     // I guess we don't need to implement this relaxation. Otherwise, this
     // should return the number of blank bytes to insert via NOPs.
     break;
+  case R_RISCV_32_PCREL:
+    return S + A - P;
   default:
     debugBelch("Unimplemented relocation: 0x%lx", ELF64_R_TYPE(rel->r_info));
     abort(/* unhandled rel */);



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a24a3ecaad35d3592465a110f8f5852189c8b40e

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a24a3ecaad35d3592465a110f8f5852189c8b40e
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240210/21596922/attachment-0001.html>


More information about the ghc-commits mailing list