[PATCH] D107280: [RISCV] Lower extern_weak symbols using the GOT for the medany model
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 15 22:33:01 PDT 2023
MaskRay added inline comments.
================
Comment at: llvm/lib/Target/RISCV/RISCVISelLowering.cpp:2736
+ // Extern weak symbols must be addressed indirectly as 0 may not be
+ // within 2GiB of PC. This generates the pattern (PseudoLA sym), which
+ // expands to (ld (addi (auipc %got_pcrel_hi(sym)) %pcrel_lo(auipc))).
----------------
MaskRay wrote:
> jrtc27 wrote:
> > MaskRay wrote:
> > > PseudoLGA
> > Already spotted and fixed :)
> `Extern weak symbols, if unresolved, must be addressed indirectly ...`
>
> `extern_weak` is the IR representation related to the current module. Another TU may provide a definition. The original sentence is imprecise.
Hmm, better wording may be that "An unresolved undefined weak symbol has a value of zero, which may not be within +-2GiB of PC. Use a GOT-generating code sequence so that the zero address is representable." This may feel verbose. Feel free to simplify.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D107280/new/
https://reviews.llvm.org/D107280
More information about the llvm-commits
mailing list