Skip to content

Commit

Permalink
cmd/internal/obj/riscv: fix JMP name<>(SB)
Browse files Browse the repository at this point in the history
It was being rejected. Now it isn't and can be used in the runtime.

Change-Id: I4626bf9fc2e0bc26fffb87d11bede459964324b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/292129
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
  • Loading branch information
rsc committed Feb 19, 2021
1 parent 01f05d8 commit 6fe8981
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/cmd/internal/obj/riscv/obj.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func progedit(ctxt *obj.Link, p *obj.Prog, newprog obj.ProgAlloc) {
switch p.To.Name {
case obj.NAME_NONE:
p.As = AJALR
case obj.NAME_EXTERN:
case obj.NAME_EXTERN, obj.NAME_STATIC:
// Handled in preprocess.
default:
ctxt.Diag("unsupported name %d for %v", p.To.Name, p)
Expand Down Expand Up @@ -267,7 +267,7 @@ func rewriteMOV(ctxt *obj.Link, newprog obj.ProgAlloc, p *obj.Prog) {
p.As = movToStore(p.As)
p.To.Reg = addrToReg(p.To)

case obj.NAME_EXTERN:
case obj.NAME_EXTERN, obj.NAME_STATIC:
// AUIPC $off_hi, TMP
// S $off_lo, TMP, R
as := p.As
Expand Down Expand Up @@ -666,7 +666,7 @@ func preprocess(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) {
switch p.To.Type {
case obj.TYPE_MEM:
switch p.To.Name {
case obj.NAME_EXTERN:
case obj.NAME_EXTERN, obj.NAME_STATIC:
// JMP to symbol.
jalrToSym(ctxt, p, newprog, REG_ZERO)
}
Expand Down

0 comments on commit 6fe8981

Please sign in to comment.