1
0
mirror of https://github.com/golang/go synced 2024-11-26 09:08:07 -07:00

cmd/internal/obj/loong64: rename Class to represent the external symbol address

There is no need to define another C_SECON Class to express short
external symbol address, because the external symbol address is unknown
in assembler, relocate it in linker.

Change-Id: Id9fbd848c43ca63a21f2b6640e947140c26eeaf7
Reviewed-on: https://go-review.googlesource.com/c/go/+/565624
Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: abner chenc <chenguoqi@loongson.cn>
This commit is contained in:
limeidan 2024-01-12 09:58:35 +08:00 committed by Gopher Robot
parent d32133af77
commit 0214749fef
3 changed files with 6 additions and 10 deletions

View File

@ -209,9 +209,8 @@ const (
C_LCON // other 32 C_LCON // other 32
C_DCON // other 64 (could subdivide further) C_DCON // other 64 (could subdivide further)
C_SACON // $n(REG) where n <= int12 C_SACON // $n(REG) where n <= int12
C_SECON
C_LACON // $n(REG) where int12 < n <= int32 C_LACON // $n(REG) where int12 < n <= int32
C_LECON C_EXTADDR // external symbol address
C_DACON // $n(REG) where int32 < n C_DACON // $n(REG) where int32 < n
C_SBRA C_SBRA
C_LBRA C_LBRA

View File

@ -179,12 +179,10 @@ var optab = []Optab{
{AMOVB, C_TLS_LE, C_NONE, C_NONE, C_REG, C_NONE, 54, 16, 0, 0}, {AMOVB, C_TLS_LE, C_NONE, C_NONE, C_REG, C_NONE, 54, 16, 0, 0},
{AMOVBU, C_TLS_LE, C_NONE, C_NONE, C_REG, C_NONE, 54, 16, 0, 0}, {AMOVBU, C_TLS_LE, C_NONE, C_NONE, C_REG, C_NONE, 54, 16, 0, 0},
{AMOVW, C_SECON, C_NONE, C_NONE, C_REG, C_NONE, 3, 4, 0, 0},
{AMOVV, C_SECON, C_NONE, C_NONE, C_REG, C_NONE, 3, 4, 0, 0},
{AMOVW, C_SACON, C_NONE, C_NONE, C_REG, C_NONE, 3, 4, REGSP, 0}, {AMOVW, C_SACON, C_NONE, C_NONE, C_REG, C_NONE, 3, 4, REGSP, 0},
{AMOVV, C_SACON, C_NONE, C_NONE, C_REG, C_NONE, 3, 4, REGSP, 0}, {AMOVV, C_SACON, C_NONE, C_NONE, C_REG, C_NONE, 3, 4, REGSP, 0},
{AMOVW, C_LECON, C_NONE, C_NONE, C_REG, C_NONE, 52, 8, 0, NOTUSETMP}, {AMOVW, C_EXTADDR, C_NONE, C_NONE, C_REG, C_NONE, 52, 8, 0, NOTUSETMP},
{AMOVV, C_LECON, C_NONE, C_NONE, C_REG, C_NONE, 52, 8, 0, NOTUSETMP}, {AMOVV, C_EXTADDR, C_NONE, C_NONE, C_REG, C_NONE, 52, 8, 0, NOTUSETMP},
{AMOVW, C_LACON, C_NONE, C_NONE, C_REG, C_NONE, 26, 12, REGSP, 0}, {AMOVW, C_LACON, C_NONE, C_NONE, C_REG, C_NONE, 26, 12, REGSP, 0},
{AMOVV, C_LACON, C_NONE, C_NONE, C_REG, C_NONE, 26, 12, REGSP, 0}, {AMOVV, C_LACON, C_NONE, C_NONE, C_REG, C_NONE, 26, 12, REGSP, 0},
@ -747,7 +745,7 @@ func (c *ctxt0) aclass(a *obj.Addr) int {
if s.Type == objabi.STLSBSS { if s.Type == objabi.STLSBSS {
c.ctxt.Diag("taking address of TLS variable is not supported") c.ctxt.Diag("taking address of TLS variable is not supported")
} }
return C_LECON return C_EXTADDR
case obj.NAME_AUTO: case obj.NAME_AUTO:
if a.Reg == REGSP { if a.Reg == REGSP {
@ -1684,7 +1682,7 @@ func (c *ctxt0) asmout(p *obj.Prog, o *Optab, out []uint32) {
rel2.Add = p.From.Offset rel2.Add = p.From.Offset
rel2.Type = objabi.R_LOONG64_ADDR_LO rel2.Type = objabi.R_LOONG64_ADDR_LO
case 52: // mov $lext, r case 52: // mov $ext, r
// NOTE: this case does not use REGTMP. If it ever does, // NOTE: this case does not use REGTMP. If it ever does,
// remove the NOTUSETMP flag in optab. // remove the NOTUSETMP flag in optab.
o1 = OP_IR(c.opir(APCALAU12I), uint32(0), uint32(p.To.Reg)) o1 = OP_IR(c.opir(APCALAU12I), uint32(0), uint32(p.To.Reg))

View File

@ -21,9 +21,8 @@ var cnames0 = []string{
"LCON", "LCON",
"DCON", "DCON",
"SACON", "SACON",
"SECON",
"LACON", "LACON",
"LECON", "EXTADDR",
"DACON", "DACON",
"SBRA", "SBRA",
"LBRA", "LBRA",