feat(asm): emit the loong64 stack-split guard for big frames

This commit is contained in:
2026-09-14 22:38:58 +02:00
parent db50b98179
commit 70218e84ba
7 changed files with 294 additions and 67 deletions
+5 -1
View File
@@ -16,6 +16,7 @@ const (
// LoongArch relocation types (the ELF psABI).
rLarchPCALAHI20 = 71 // R_LARCH_PCALA_HI20 (pcalau12i)
rLarchPCALALO12 = 72 // R_LARCH_PCALA_LO12 (addi.d/ld/st)
rLarchB26 = 66 // R_LARCH_B26 (b/bl, matches the Go linker's mapping)
)
// ELFLOONG64Object returns the image as an ELF64 relocatable object file for
@@ -95,8 +96,11 @@ func (img *Image) ELFLOONG64Object() ([]byte, error) {
return nil, fmt.Errorf("relocation references unknown symbol %q", r.Name)
}
typ := uint32(rLarchPCALAHI20)
if r.Kind == RelLoong64AddrLo {
switch r.Kind {
case RelLoong64AddrLo:
typ = rLarchPCALALO12
case RelLoong64Branch:
typ = rLarchB26
}
relas = append(relas, elfRela{
off: uint64(fn.Offset + r.Off),