[PATCH] D149751: [LLD][ELF][RISCV] Add auipc->lui relaxation.

Dmitry via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 4 09:10:14 PDT 2023


dybv-sc added a comment.

In D149751#4316073 <https://reviews.llvm.org/D149751#4316073>, @MaskRay wrote:

>> This relaxation enables use of weak undefined symbols in programms written with medany code model in mind if code section happens to be placed far from zero address(>2GiB).
>
> I think the motivation is not right. For such weak references, the compiler should generate GOT-generating relocations, not relying on linker relaxation (which is an optional feature) for correctness. https://maskray.me/blog/2021-04-25-weak-symbol
>
> https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/201 "Not doing so is deprecated and a future version of this specification will require using the GOT, not just advise."

I understand that, but why not to do that linker relaxation too? That makes lld more compatible with gnu.ld which does that already. Besides, it enables linking with libraries that were compiled using old abi, so that change enhance backwards compatibility.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149751



More information about the llvm-commits mailing list