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

Sven Tennie (@supersven) gitlab at gitlab.haskell.org
Sat Feb 10 17:14:12 UTC 2024



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


Commits:
65cf1773 by Sven Tennie at 2024-02-10T18:13:58+01:00
Add missing relocation

- - - - -


1 changed file:

- rts/linker/elf_reloc_riscv64.c


Changes:

=====================================
rts/linker/elf_reloc_riscv64.c
=====================================
@@ -29,6 +29,7 @@ typedef uint16_t cinst_t;
 // TODO: Decide which functions should be static and/or inlined.
 int64_t decodeAddendRISCV64(Section *section STG_UNUSED,
                             Elf_Rel *rel STG_UNUSED) {
+  debugBelch("decodeAddendRISCV64: Relocations with explicit addend are not supported.");
   abort(/* we don't support Rel locations yet. */);
 }
 
@@ -296,10 +297,14 @@ int64_t computeAddend(Section *section, Elf_Rel *rel, ElfSymbol *symbol,
     return 0;
   case R_RISCV_32_PCREL:
     return S + A - P;
+  case R_RISCV_GOT_HI20:
+    // reduced G + GOT to GOT_S - This might be wrong!
+    return GOT_S + A - P;
   default:
-    debugBelch("Unimplemented relocation: 0x%lx", ELF64_R_TYPE(rel->r_info));
+    debugBelch("Unimplemented relocation: 0x%lx\n (%lu)", ELF64_R_TYPE(rel->r_info), ELF64_R_TYPE(rel->r_info));
     abort(/* unhandled rel */);
   }
+  debugBelch("This should never happen!");
   abort(/* unhandled rel */);
 }
 



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/65cf177382fd344cef9fd2e1c9bebf5e3254d9ac
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/51be9bc4/attachment-0001.html>


More information about the ghc-commits mailing list