[llvm] [RISCV] Don't outline pcrel_lo when the function has a section prefix (PR #107943)
Sam Elliott via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 10 02:52:44 PDT 2024
lenary 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.
https://github.com/llvm/llvm-project/pull/107943
More information about the llvm-commits
mailing list