[llvm] [RISCV] Don't outline pcrel_lo when the function has a section prefix (PR #107943)
Pengcheng Wang via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 10 03:23:36 PDT 2024
wangpc-pp wrote:
> > IIUC, this is not a RISC-V specific issue? Maybe we should move this check to common code?
>
> This is RISC-V specific. The problem is not gnu ld per se, the problem is the psABI says you cannot use a pc-relative hi/lo pair that are in separate sections. So we currently restrict outlining only when we see a lo and think the outlined function _might_ end up in a different section to the original function, but that heuristic had missed a case which this PR fixes. Note we don't care about absolute hi/lo pairs.
>
> I think this is the right fix today. I think in the longer term, we should teach the outliner to duplicate the referenced AUIPC, and account for that in the outlining cost. I think this would still be correct and would follow the psABI while potentially enabling more outlining for all the code models that use pc-relative addressing.
Thanks! What I was trying to say is that RISC-V may be not the only target having pc-relative hi/lo pairs. You can ignore this comment. :-)
https://github.com/llvm/llvm-project/pull/107943
More information about the llvm-commits
mailing list