mirror of
https://github.com/golang/go
synced 2024-11-18 21:05:02 -07:00
cmd/asm/internal/arch: consolidate LinkArch handling
Rather than manually setting the LinkArch for each case, pass the correct *obj.LinkArch to the arch* function, as is already done for archX86(). Change-Id: I4cf950780aa30a1385e785fb1d26edacb99bda79 Reviewed-on: https://go-review.googlesource.com/c/go/+/193818 Reviewed-by: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
3a067f71e9
commit
112a72a020
@ -62,33 +62,19 @@ func Set(GOARCH string) *Arch {
|
||||
case "arm64":
|
||||
return archArm64()
|
||||
case "mips":
|
||||
a := archMips()
|
||||
a.LinkArch = &mips.Linkmips
|
||||
return a
|
||||
return archMips(&mips.Linkmips)
|
||||
case "mipsle":
|
||||
a := archMips()
|
||||
a.LinkArch = &mips.Linkmipsle
|
||||
return a
|
||||
return archMips(&mips.Linkmipsle)
|
||||
case "mips64":
|
||||
a := archMips64()
|
||||
a.LinkArch = &mips.Linkmips64
|
||||
return a
|
||||
return archMips64(&mips.Linkmips64)
|
||||
case "mips64le":
|
||||
a := archMips64()
|
||||
a.LinkArch = &mips.Linkmips64le
|
||||
return a
|
||||
return archMips64(&mips.Linkmips64le)
|
||||
case "ppc64":
|
||||
a := archPPC64()
|
||||
a.LinkArch = &ppc64.Linkppc64
|
||||
return a
|
||||
return archPPC64(&ppc64.Linkppc64)
|
||||
case "ppc64le":
|
||||
a := archPPC64()
|
||||
a.LinkArch = &ppc64.Linkppc64le
|
||||
return a
|
||||
return archPPC64(&ppc64.Linkppc64le)
|
||||
case "s390x":
|
||||
a := archS390x()
|
||||
a.LinkArch = &s390x.Links390x
|
||||
return a
|
||||
return archS390x()
|
||||
case "wasm":
|
||||
return archWasm()
|
||||
}
|
||||
@ -352,7 +338,7 @@ func archArm64() *Arch {
|
||||
|
||||
}
|
||||
|
||||
func archPPC64() *Arch {
|
||||
func archPPC64(linkArch *obj.LinkArch) *Arch {
|
||||
register := make(map[string]int16)
|
||||
// Create maps for easy lookup of instruction names etc.
|
||||
// Note that there is no list of names as there is for x86.
|
||||
@ -408,7 +394,7 @@ func archPPC64() *Arch {
|
||||
instructions["BL"] = ppc64.ABL
|
||||
|
||||
return &Arch{
|
||||
LinkArch: &ppc64.Linkppc64,
|
||||
LinkArch: linkArch,
|
||||
Instructions: instructions,
|
||||
Register: register,
|
||||
RegisterPrefix: registerPrefix,
|
||||
@ -417,7 +403,7 @@ func archPPC64() *Arch {
|
||||
}
|
||||
}
|
||||
|
||||
func archMips() *Arch {
|
||||
func archMips(linkArch *obj.LinkArch) *Arch {
|
||||
register := make(map[string]int16)
|
||||
// Create maps for easy lookup of instruction names etc.
|
||||
// Note that there is no list of names as there is for x86.
|
||||
@ -464,7 +450,7 @@ func archMips() *Arch {
|
||||
instructions["JAL"] = mips.AJAL
|
||||
|
||||
return &Arch{
|
||||
LinkArch: &mips.Linkmipsle,
|
||||
LinkArch: linkArch,
|
||||
Instructions: instructions,
|
||||
Register: register,
|
||||
RegisterPrefix: registerPrefix,
|
||||
@ -473,7 +459,7 @@ func archMips() *Arch {
|
||||
}
|
||||
}
|
||||
|
||||
func archMips64() *Arch {
|
||||
func archMips64(linkArch *obj.LinkArch) *Arch {
|
||||
register := make(map[string]int16)
|
||||
// Create maps for easy lookup of instruction names etc.
|
||||
// Note that there is no list of names as there is for x86.
|
||||
@ -521,7 +507,7 @@ func archMips64() *Arch {
|
||||
instructions["JAL"] = mips.AJAL
|
||||
|
||||
return &Arch{
|
||||
LinkArch: &mips.Linkmips64,
|
||||
LinkArch: linkArch,
|
||||
Instructions: instructions,
|
||||
Register: register,
|
||||
RegisterPrefix: registerPrefix,
|
||||
|
Loading…
Reference in New Issue
Block a user