[PATCH] D143673: [lld][RISCV] Implement GP relaxation for R_RISCV_HI20/R_RISCV_LO12_I/R_RISCV_LO12_S.

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 13 10:33:40 PDT 2023


MaskRay added a comment.

In D143673#4265903 <https://reviews.llvm.org/D143673#4265903>, @craig.topper wrote:

>> I have some concern about whether it is safe to look at symbols in multiple sections during the instruction relaxation phase. Can the relative distance between _global_pointer and .sbss change when the .text section shrinks?
>
> @MaskRay I don't think we ever specifically discussed this. Is this not possible? I think binutils has some check for maximum alignment when relaxing across sections.

lld's relaxation approach is safe. The instruction relaxation is done with other transforms that may affect addresses. We iterate until all addresses and symbol values converge.
I think GNU ld has multiple iterations and after the relaxation iteration, post iterations may cause a pathological case for relaxation. It seems to play with heuristics to make things safer. Overall, this is GNU ld's specific issue and unrelated to lld :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143673



More information about the llvm-commits mailing list