[PATCH] D134600: [RISCV][LLD] Add RISCV zcmt optimise in linker relaxation

Xinlong Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 6 19:54:23 PST 2023


VincentWu added inline comments.


================
Comment at: lld/ELF/Arch/RISCV.cpp:813
+            if (config->riscvTbljal &&
+                (aux.writes[writesIdx] & 0xfc03) == 0xa002) {
+              skip = 2;
----------------
jrtc27 wrote:
> This seems like poor design, you shouldn't be using R_RISCV_JAL once it's no longer a JAL instruction there
Use R_RISCV_32 or R_RISCV_64 instead


================
Comment at: lld/ELF/Writer.cpp:1637
 
+  // scan all R_RISCV_CALL/R_RISCV_CALL_PLT for RISCV Zcmt Jump table.
+  if (in.riscvTableJumpSection) {
----------------
jrtc27 wrote:
> Why isn't this done when we read in the relocations the first time?
IMHO, we can calculate the gain value directly if we scan them when all relaxation have been done.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134600



More information about the llvm-commits mailing list