Skip to content

Commit 654b031

Browse files
abner-chenclimeidan
authored andcommitted
cmd/internal/obj: add FuncInfo SPWRITE flag for linux/loong64
Co-authored-by: limeidan <[email protected]> Change-Id: Iac4f706fc9ff1047f1fa02f7178ebfbe38ad1ec3 Reviewed-on: https://go-review.googlesource.com/c/go/+/407754 TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Ian Lance Taylor <[email protected]> Reviewed-by: WANG Xuerui <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]> Reviewed-by: Cherry Mui <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent a2bca29 commit 654b031

File tree

1 file changed

+16
-1
lines changed
  • src/cmd/internal/obj/loong64

1 file changed

+16
-1
lines changed

src/cmd/internal/obj/loong64/obj.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"cmd/internal/obj"
99
"cmd/internal/objabi"
1010
"cmd/internal/sys"
11-
11+
"log"
1212
"math"
1313
)
1414

@@ -460,6 +460,21 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
460460
p.From.Reg = REGSP
461461
}
462462
}
463+
464+
if p.To.Type == obj.TYPE_REG && p.To.Reg == REGSP && p.Spadj == 0 {
465+
f := c.cursym.Func()
466+
if f.FuncFlag&objabi.FuncFlag_SPWRITE == 0 {
467+
c.cursym.Func().FuncFlag |= objabi.FuncFlag_SPWRITE
468+
if ctxt.Debugvlog || !ctxt.IsAsm {
469+
ctxt.Logf("auto-SPWRITE: %s %v\n", c.cursym.Name, p)
470+
if !ctxt.IsAsm {
471+
ctxt.Diag("invalid auto-SPWRITE in non-assembly")
472+
ctxt.DiagFlush()
473+
log.Fatalf("bad SPWRITE")
474+
}
475+
}
476+
}
477+
}
463478
}
464479
}
465480

0 commit comments

Comments
 (0)