[PATCH] D150957: [JITLink][RISCV] Consider relaxable call edges for PLT edges

Job Noorman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 22 01:41:52 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rGbcd1296a1a59: [JITLink][RISCV] Consider relaxable call edges for PLT edges (authored by jobnoorman).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150957

Files:
  llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp
  llvm/test/ExecutionEngine/JITLink/RISCV/ELF_riscv64_got_plt_reloc.s


Index: llvm/test/ExecutionEngine/JITLink/RISCV/ELF_riscv64_got_plt_reloc.s
===================================================================
--- llvm/test/ExecutionEngine/JITLink/RISCV/ELF_riscv64_got_plt_reloc.s
+++ llvm/test/ExecutionEngine/JITLink/RISCV/ELF_riscv64_got_plt_reloc.s
@@ -6,6 +6,13 @@
 # RUN:     -abs external_func=0x1 -abs external_data=0x2 \
 # RUN:     -check %s %t/elf_riscv64_got_plt_reloc.o
 
+## Run the same tests with relaxation enabled.
+# RUN: llvm-mc -triple=riscv64 -position-independent -filetype=obj \
+# RUN:     -mattr=+relax -o %t/elf_riscv64_got_plt_reloc.o %s
+# RUN: llvm-jitlink -noexec \
+# RUN:     -slab-allocate 100Kb -slab-address 0xfff00000 -slab-page-size 4096 \
+# RUN:     -abs external_func=0x1 -abs external_data=0x2 \
+# RUN:     -check %s %t/elf_riscv64_got_plt_reloc.o
 
         .text
         .file   "testcase.c"
Index: llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp
===================================================================
--- llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp
+++ llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp
@@ -70,13 +70,16 @@
   }
 
   void fixPLTEdge(Edge &E, Symbol &PLTStubs) {
-    assert(E.getKind() == R_RISCV_CALL_PLT && "Not a R_RISCV_CALL_PLT edge?");
+    assert((E.getKind() == R_RISCV_CALL || E.getKind() == R_RISCV_CALL_PLT ||
+            E.getKind() == CallRelaxable) &&
+           "Not a PLT edge?");
     E.setKind(R_RISCV_CALL);
     E.setTarget(PLTStubs);
   }
 
   bool isExternalBranchEdge(Edge &E) const {
-    return (E.getKind() == R_RISCV_CALL || E.getKind() == R_RISCV_CALL_PLT) &&
+    return (E.getKind() == R_RISCV_CALL || E.getKind() == R_RISCV_CALL_PLT ||
+            E.getKind() == CallRelaxable) &&
            !E.getTarget().isDefined();
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150957.524195.patch
Type: text/x-patch
Size: 1771 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230522/207559c4/attachment.bin>


More information about the llvm-commits mailing list