[PATCH v4] MIPS: Support PCREL GOT access
YunQiang Su
syq@gcc.gnu.org
Thu Apr 18 10:56:27 GMT 2024
More information about the Binutils mailing list
Thu Apr 18 10:56:27 GMT 2024
- Previous message (by thread): [PATCH v4] MIPS: Support PCREL GOT access
- Next message (by thread): [PATCH v1] LoongArch: ld: Move .got .got.plt before .data and protect .got with relro
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Fangrui Song <i@maskray.me> 于2024年4月3日周三 12:11写道: > > On Sat, Mar 16, 2024 at 1:51 AM YunQiang Su <syq@gcc.gnu.org> wrote: > > > > Current if we need to access a GOT entry, we use the > > got_base + offset. Thus we have GOT and XGOT. > > From MIPSr6, we have PCREL instructions like ALUIPC, > > so we have no need to use got_base now. > > For pre-R6, we can use BAL to get the the value of PC. > > Currently loading a GOT entry requires loading the GOT base address > first, then adding an offset. > Therefore, (elaborate the reason) we need both GOT and XGOT. > MIPSr6 introduced PC-relative instructions like ..., which allow us to > use a pair of .. and .. to materialize the GOT entry address. > Thanks. Currently loading a GOT entry requires loading the GOT base address first, then adding an offset. Therefore, (elaborate the reason) we need both GOT and XGOT. MIPSr6 introduced PC-relative instructions like ALUIPC/AUIPC, which allow us to use a pair of GOTPC_HI and GOTPC_LO to materialize the GOT entry address. > > In this patch, we add 8 new relocs: > > R_MIPS_GOTPC_HI16, R_MIPS_GOTPC_LO16, > > R_MIPS_GOTPC_CALL_HI16, R_MIPS_GOTPC_CALL_LO16, > > R_MIPS_GOTPC_AHI16, R_MIPS_GOTPC_ALO16, > > R_MIPS_GOTPC_CALL_AHI16, R_MIPS_GOTPC_CALL_ALO16. > > These asm notes can be used for them: > > %gotpc_hi(sym), %gotpc_lo(sym), > > %gotpc_call_hi(sym), %gotpc_call_lo(sym), > > %gotpc_ahi(sym), %gotpc_alo(sym), > > %gotpc_call_ahi(sym), %gotpc_call_alo(sym). > > GCC's mips port names assembler relocation operators > (gas/config/tc-mips.c names them `mips_percent_op`). > Other ports seem to prefer "modifiers" (assembler modifiers, > expression modifiers). > These percent_op can be used for them > > * bfd-in2.h: Add new MIPS GOTPC BFD_RELOC defination. > > typo > Thanks. Ping again.
- Previous message (by thread): [PATCH v4] MIPS: Support PCREL GOT access
- Next message (by thread): [PATCH v1] LoongArch: ld: Move .got .got.plt before .data and protect .got with relro
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list