fix(asm): close the oracle parity gaps in frame addressing and calls
This commit is contained in:
@@ -527,13 +527,18 @@ func encodeLOONG64Branch(instr *ast.Instr, mnem string, pc int, offsets map[stri
|
||||
}
|
||||
return l64wordLE(l64irr16(l64branchTable["JIRL"], 0, rj, rd)), nil
|
||||
}
|
||||
// Direct symbol: sym+off(SB) → bl with an R_CALLLOONG64 relocation (the
|
||||
// linker fills the offset), as the toolchain does for CALL/BL/JAL.
|
||||
if op.Addr.Sym != nil && op.Addr.Sym.Pseudo == "SB" && link {
|
||||
// Direct symbol: sym+off(SB) → b/bl with an R_CALLLOONG64 relocation
|
||||
// (the linker fills the offset), as the toolchain does for CALL/BL/JAL
|
||||
// and for tail-calling JMP.
|
||||
if op.Addr.Sym != nil && op.Addr.Sym.Pseudo == "SB" {
|
||||
opc := l64jumpTable["B"]
|
||||
if link {
|
||||
opc = l64jumpTable["BL"]
|
||||
}
|
||||
if relocs != nil {
|
||||
*relocs = append(*relocs, Reloc{Off: 0, After: 4, Name: op.Addr.Sym.Name, Kind: RelLoong64Branch, Addend: op.Addr.Sym.Offset})
|
||||
}
|
||||
return l64wordLE(l64bbl(l64jumpTable["BL"], 0)), nil
|
||||
return l64wordLE(l64bbl(opc, 0)), nil
|
||||
}
|
||||
// Direct: label → b/bl.
|
||||
target := resolve(l64Label(op))
|
||||
|
||||
Reference in New Issue
Block a user