This patch allows lowering of PIC addresses by using PC-relative addressing for DSO-local symbols and accessing the address through the global offset table for non-DSO-local symbols.
Builds on D54143
Differential D55303
[RISCV] Add lowering of addressing sequences for PIC lewis-revill on Dec 4 2018, 5:08 PM. Authored by
Details This patch allows lowering of PIC addresses by using PC-relative addressing for DSO-local symbols and accessing the address through the global offset table for non-DSO-local symbols. Builds on D54143
Diff Detail
Event TimelineComment Actions Half of this (the MC side of the GOT modifier) is already proposed in D55279. Also note that the assembly modifier is not %got_hi but %got_pcrel_hi after a discussion with upstream (check the assembler manual) to clearly convey that it's a PC-relative relocation to the GOT entry rather than generating a GOT index as would be the case on some older architectures. I did however, like you, use GOT_HI in the various LLVM-internal enumeration entries to match the name of the relocation. Comment Actions That's an interesting coincidence! I think I'll rebase this patch on top of that patch since it seems likely to make it upstream. Comment Actions It's probably worth noting that the %pcrel_lo relocations to the label appear to be evaluated to a constant when -mattr=+relax is not provided... I remember someone said that this was going to be made default? If so I think it would be good to wait for that before this is commited. Comment Actions Almost there now from my point of view, but we'll see what the others say (especially Alex).
Comment Actions Minor comment above but other than that this looks good to me too.
Comment Actions One minor comment, but otherwise I think this is ready to land now?
Comment Actions Please add RV64 RUN lines to pic-models.ll and add nounwind attributes, otherwise this looks good to me. Thanks! |