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 > > > the RISC-V GCC port does

Re: HELP: MIPS PC Relative Addressing

2021-02-24 Thread Maciej W. Rozycki
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 > > the RISC-V GCC port does by default.  This prevents some optimizations like > > scheduling the two

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 > 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. Yes, it is difficult.

[Request received]

2021-02-24 Thread Greenleaf, Inc via Gcc
##- Please type your reply above this line -## Thank you for your message! Your request (74758) has been received and is being reviewed by our support staff. An agent will respond to your message as soon as possible during our normal business hours M-Th 8am-6pm , Fri 8am-5pm EST. We thank you f

Re: HELP: MIPS PC Relative Addressing

2021-02-24 Thread Maciej W. Rozycki
On Wed, 24 Feb 2021, Jim Wilson wrote: > > I commented on it once, in the course of the FDPIC design project, and I > > find it broken by design. Sadly it has made it into the RISC-V psABI and > > it is hard to revert at this time, too many places have started relying on > > it. > > > > It was

Re: HELP: MIPS PC Relative Addressing

2021-02-24 Thread Jim Wilson
On Wed, Feb 24, 2021 at 9:30 AM Maciej W. Rozycki wrote: > On Wed, 24 Feb 2021, Jiaxun Yang wrote: > > > For RISC-V, %pcrel_lo shall point to the label of corresponding > %pcrel_hi, > > like > > > > .LA0: > > auipca0, %pcrel_hi(sym) > > addi a0, a0, %pcrel_lo(.LA0) > > I comment

Re: HELP: MIPS PC Relative Addressing

2021-02-24 Thread Jim Wilson
On Wed, Feb 24, 2021 at 6:18 AM Jiaxun Yang 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. > Yes, it is difficult. You need to generate a label, and put the label number in an unspec in th

Re: HELP: MIPS PC Relative Addressing

2021-02-24 Thread 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 design project, and I find it broke

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