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

Dmitry via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 3 08:06:50 PDT 2023


dybv-sc created this revision.
Herald added subscribers: jobnoorman, luke, VincentWu, vkmr, frasercrmck, evandro, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, arichardson, emaste.
Herald added a reviewer: MaskRay.
Herald added a project: All.
dybv-sc requested review of this revision.
Herald added subscribers: llvm-commits, pcwang-thead, eopXD.
Herald added a project: LLVM.

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).

It performs following transormation:

  auipc + add -> lui + add

It does it if symbol address is out of range for pc-relative
addressing mode (>2GiB far from pc) and within range for
zero-relative one.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149751

Files:
  lld/ELF/Arch/RISCV.cpp
  lld/test/ELF/riscv-relax-weak.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149751.519078.patch
Type: text/x-patch
Size: 4824 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230503/0e3466ba/attachment-0001.bin>


More information about the llvm-commits mailing list