[llvm-branch-commits] [lld] ELF: CFI jump table relaxation. (PR #147424)

Fangrui Song via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sat May 2 17:11:42 PDT 2026


================
@@ -1136,7 +1136,9 @@ void TargetInfo::scanSectionImpl(InputSectionBase &sec, Relocs<RelTy> rels) {
 
   // Sort relocations by offset for more efficient searching for
   // R_RISCV_PCREL_HI20 and the branch-to-branch optimization.
-  if (ctx.arg.emachine == EM_RISCV || ctx.arg.branchToBranch)
+  // relaxCFIJumpTables() also expects relocations to be sorted.
+  if (ctx.arg.emachine == EM_RISCV || ctx.arg.branchToBranch ||
+      sec.type == SHT_LLVM_CFI_JUMP_TABLE)
----------------
MaskRay wrote:

This function is no longer called by X86_64 so the `sec.type == SHT_LLVM_CFI_JUMP_TABLE` addition here is dead.

This `stable_sort` is actually dead. I'll remove it.

https://github.com/llvm/llvm-project/pull/147424


More information about the llvm-branch-commits mailing list