[PATCH] D63259: [ELF][RISCV] Allow R_RISCV_ADD in relocateNonAlloc()

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 3 05:48:10 PDT 2019


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL365035: [ELF][RISCV] Allow R_RISCV_ADD in relocateNonAlloc() (authored by MaskRay, committed by ).

Repository:
  rL LLVM

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

https://reviews.llvm.org/D63259

Files:
  lld/trunk/ELF/InputSection.cpp
  lld/trunk/test/ELF/riscv-reloc-add.s


Index: lld/trunk/ELF/InputSection.cpp
===================================================================
--- lld/trunk/ELF/InputSection.cpp
+++ lld/trunk/ELF/InputSection.cpp
@@ -838,7 +838,7 @@
     if (Expr == R_NONE)
       continue;
 
-    if (Expr != R_ABS && Expr != R_DTPREL) {
+    if (Expr != R_ABS && Expr != R_DTPREL && Expr != R_RISCV_ADD) {
       std::string Msg = getLocation<ELFT>(Offset) +
                         ": has non-ABS relocation " + toString(Type) +
                         " against symbol '" + toString(Sym) + "'";
Index: lld/trunk/test/ELF/riscv-reloc-add.s
===================================================================
--- lld/trunk/test/ELF/riscv-reloc-add.s
+++ lld/trunk/test/ELF/riscv-reloc-add.s
@@ -24,3 +24,9 @@
 .word .L1 - .L0
 .half .L1 - .L0
 .byte .L1 - .L0
+
+## Debug section may use R_RISCV_ADD64/R_RISCV_SUB64 pairs to measure lengths
+## of code ranges (e.g. DW_AT_high_pc). Check we allow R_RISCV_ADD*/R_RISCV_SUB*
+## in such non-SHF_ALLOC sections in -pie/-shared mode.
+.section .debug_info
+.quad .L1 - .L0


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63259.207771.patch
Type: text/x-patch
Size: 1070 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190703/1d165739/attachment.bin>


More information about the llvm-commits mailing list