From 0214749fef334f9879287d6eec3f059e803a5270 Mon Sep 17 00:00:00 2001 From: limeidan Date: Fri, 12 Jan 2024 09:58:35 +0800 Subject: [PATCH] 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 Reviewed-by: sophie zhao Reviewed-by: Dmitri Shuralyov Reviewed-by: abner chenc Reviewed-by: Michael Knyszek LUCI-TryBot-Result: Go LUCI Auto-Submit: abner chenc --- src/cmd/internal/obj/loong64/a.out.go | 3 +-- src/cmd/internal/obj/loong64/asm.go | 10 ++++------ src/cmd/internal/obj/loong64/cnames.go | 3 +-- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/cmd/internal/obj/loong64/a.out.go b/src/cmd/internal/obj/loong64/a.out.go index 23f71fd8ab..251c34c6ab 100644 --- a/src/cmd/internal/obj/loong64/a.out.go +++ b/src/cmd/internal/obj/loong64/a.out.go @@ -209,9 +209,8 @@ const ( C_LCON // other 32 C_DCON // other 64 (could subdivide further) C_SACON // $n(REG) where n <= int12 - C_SECON C_LACON // $n(REG) where int12 < n <= int32 - C_LECON + C_EXTADDR // external symbol address C_DACON // $n(REG) where int32 < n C_SBRA C_LBRA diff --git a/src/cmd/internal/obj/loong64/asm.go b/src/cmd/internal/obj/loong64/asm.go index 99cebe3e4e..26ec30af37 100644 --- a/src/cmd/internal/obj/loong64/asm.go +++ b/src/cmd/internal/obj/loong64/asm.go @@ -179,12 +179,10 @@ var optab = []Optab{ {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}, - {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}, {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}, - {AMOVV, 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_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}, {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 { c.ctxt.Diag("taking address of TLS variable is not supported") } - return C_LECON + return C_EXTADDR case obj.NAME_AUTO: 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.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, // remove the NOTUSETMP flag in optab. o1 = OP_IR(c.opir(APCALAU12I), uint32(0), uint32(p.To.Reg)) diff --git a/src/cmd/internal/obj/loong64/cnames.go b/src/cmd/internal/obj/loong64/cnames.go index 3841296f3a..955c464d2f 100644 --- a/src/cmd/internal/obj/loong64/cnames.go +++ b/src/cmd/internal/obj/loong64/cnames.go @@ -21,9 +21,8 @@ var cnames0 = []string{ "LCON", "DCON", "SACON", - "SECON", "LACON", - "LECON", + "EXTADDR", "DACON", "SBRA", "LBRA", -- 2.48.1