fix(asm): encode RISC-V CALL sym(SB) as JAL
Assisted-by: DeepSeek V4 Pro
This commit is contained in:
+8
-3
@@ -25,17 +25,22 @@ func (img *Image) GOObjectRISCV(pkgPath, srcPath string) ([]byte, error) {
|
||||
return nil, err
|
||||
}
|
||||
return img.emitGOObject(pkgPath, srcPath, pre, 2, func(r Reloc) (uint16, uint8) {
|
||||
if r.Kind == RelRISCVPCRELSType {
|
||||
switch r.Kind {
|
||||
case RelRISCVPCRELSType:
|
||||
return relocRISCVPcrelStype, 8
|
||||
case RelRISCVJal:
|
||||
return relocRISCVJal, 4
|
||||
default:
|
||||
return relocRISCVPcrelItype, 8
|
||||
}
|
||||
return relocRISCVPcrelItype, 8
|
||||
})
|
||||
}
|
||||
|
||||
// RISC-V relocation types (cmd/internal/objabi). The Go linker applies
|
||||
// R_RISCV_PCREL_ITYPE/STYPE to an AUIPC + I/S-type instruction pair as a
|
||||
// single 8-byte field.
|
||||
// single 8-byte field; R_RISCV_JAL covers a single 4-byte J-type instruction.
|
||||
const (
|
||||
relocRISCVJal = 59 // R_RISCV_JAL
|
||||
relocRISCVPcrelItype = 62 // R_RISCV_PCREL_ITYPE
|
||||
relocRISCVPcrelStype = 63 // R_RISCV_PCREL_STYPE
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user