[PATCH] D44886: [RISCV] Support linker relax function call from auipc and jalr to jal
Shiva Chen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 15 23:33:21 PDT 2018
shiva0217 added a comment.
In https://reviews.llvm.org/D44886#1065531, @asb wrote:
> Given that Simon's https://reviews.llvm.org/D45181 will be dependent on this (as it should really query whether linker relaxation is enabled), it probably makes sense to get this merged sooner rather than later.
Hi Alex.
> I think the options are:
>
> 1. Merge as is
If we merge as is will leave the relocation difference between assembly code and object file as you described.
> 2. Modify this patch so it adds RISCV_RELAX to pcrel_hi and pcrel_lo relocations when linker relaxation is enabled, then have a follow-up patch that emits CALL.
>
> The psabi doc doesn't discuss attaching RISCV_RELAX to relocations other than RISCV_CALL or RISCV_CALL_PLT, but presumably binutils ld will use it for other pairs?
The psabi doc didn't mention add RISCV_RELAX to pcrel_hi and pcrel_lo relocations and I have done some experiments. It seems that attaching RISCV_RELAX to pcrel_hi and pcrel_lo relocations can't relax aupic and jalr to jal by Binutils ld. So we have to use R_RISCV_CALL and R_RISCV_RELAX for function call relaxation.
I have updated the patch to generate call pseudoinstruction as your comments in https://reviews.llvm.org/D44886?id=140176#inline-398646.
Repository:
rL LLVM
https://reviews.llvm.org/D44886
More information about the llvm-commits
mailing list