Re: HELP: MIPS PC Relative Addressing

2021-03-03 Thread Jiaxun Yang
在 2021/3/2 下午11:30, Maciej W. Rozycki 写道: On Tue, 2 Mar 2021, Jiaxun Yang wrote: After spending days poking with AUIPC, I suddenly found we indeed have ALUIPC instruction in MIPS R6, which will clear low 16bit of AUIPC result. So the whole thing now looks easier, we can have R_MIPS_PC_PAGE

Re: HELP: MIPS PC Relative Addressing

2021-03-01 Thread Jiaxun Yang
在 2021/2/25 上午5:40, Jim Wilson 写道: On Wed, Feb 24, 2021 at 6:18 AM Jiaxun Yang <mailto:jiaxun.y...@flygoat.com>> wrote: I found it's very difficult for GCC to generate this kind of pcrel_lo expression, RTX label_ref can't be lower into such LOW_SUM expre

Re: HELP: MIPS PC Relative Addressing

2021-02-24 Thread Jiaxun Yang
On Thu, Feb 25, 2021, at 10:57 AM, Maciej W. Rozycki wrote: > On Thu, 25 Feb 2021, Jiaxun Yang wrote: > > > > There is a far easier way to do this, which is to just emit an assembler > > > macro, and let the assembler generate the labels and relocs.  This is what > &

Re: HELP: MIPS PC Relative Addressing

2021-02-24 Thread Jiaxun Yang
在 2021/2/25 上午1:30, Maciej W. Rozycki 写道: On Wed, 24 Feb 2021, Jiaxun Yang wrote: For RISC-V, %pcrel_lo shall point to the label of corresponding %pcrel_hi, like .LA0:     auipc    a0, %pcrel_hi(sym)     addi  a0, a0, %pcrel_lo(.LA0) I commented on it once, in the course of the FDPIC

Re: HELP: MIPS PC Relative Addressing

2021-02-24 Thread Jiaxun Yang
在 2021/2/25 上午5:40, Jim Wilson 写道: On Wed, Feb 24, 2021 at 6:18 AM Jiaxun Yang <mailto:jiaxun.y...@flygoat.com>> wrote: I found it's very difficult for GCC to generate this kind of pcrel_lo expression, RTX label_ref can't be lower into such LOW_SUM expression. Y

HELP: MIPS PC Relative Addressing

2021-02-24 Thread Jiaxun Yang
Hi all, I'm trying to implement PC Relative addressing for toolchain (GCC, LLVM). MIPS Release6 had introduced pcrel instructions (e.g. auipc) that made PC relative addressing for local data possible. It can help us reduce GOT overhead and implement position independent kernel easier. Just as R