You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
kpatch/LoongArch: Convert PC-relative LA instructions to GOT version for livepatch
Introduces a post-processing function
`kpatch_modify_la_rela_sections()` which:
1. Scans all rela sections within executable segments
(`SHF_EXECINSTR`).
2. Identifies `la` instructions that use the PC-relative sequence
(`pcalau12i + addi.d`) via the `is_la_pcrel()` helper.
3. Modifies the instruction sequence in-place to use the GOT-based
sequence (`pcalau12i + ld.d`) via `la_pcrel_to_la_got()`.
4. Updates the corresponding relocation types from their original
PC-relative types to the appropriate GOT types
(`R_LARCH_GOT_PC_HI20` and `R_LARCH_GOT_PC_LO12`).
Verification:
The modification is confirmed by disassembling the patched code. The
original sequence:
pcalau12i $a1, 40
addi.d $a1, $a1, 56 // PC-relative calculation
Was successfully transformed into the GOT-based sequence:
pcalau12i $a1, 40
ld.d $a1, $a1, 56 // Load from GOT entry
Signed-off-by: george <[email protected]>
0 commit comments