[PATCH] D70396: [Object][RISCV] Fix R_RISCV_SET6 and R_RISCV_SUB6 relocations resolution

Luís Marques via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 21 14:57:15 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rGb8b57087d3a6: [Object][RISCV] Fix R_RISCV_SET6 and R_RISCV_SUB6 relocations resolution (authored by luismarques).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70396/new/

https://reviews.llvm.org/D70396

Files:
  llvm/lib/Object/RelocationResolver.cpp


Index: llvm/lib/Object/RelocationResolver.cpp
===================================================================
--- llvm/lib/Object/RelocationResolver.cpp
+++ llvm/lib/Object/RelocationResolver.cpp
@@ -363,9 +363,9 @@
   case ELF::R_RISCV_64:
     return S + RA;
   case ELF::R_RISCV_SET6:
-    return (A + (S + RA)) & 0xFF;
+    return (A & 0xC0) | ((S + RA) & 0x3F);
   case ELF::R_RISCV_SUB6:
-    return (A - (S + RA)) & 0xFF;
+    return (A & 0xC0) | (((A & 0x3F) - (S + RA)) & 0x3F);
   case ELF::R_RISCV_ADD8:
     return (A + (S + RA)) & 0xFF;
   case ELF::R_RISCV_SUB8:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70396.230544.patch
Type: text/x-patch
Size: 581 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191121/a8ace4d7/attachment.bin>


More information about the llvm-commits mailing list