]> Cypherpunks.ru repositories - gostls13.git/commitdiff
cmd/link: support linker for linux/loong64
authorXiaodong Liu <liuxiaodong@loongson.cn>
Sun, 15 Aug 2021 08:25:46 +0000 (16:25 +0800)
committerGopher Robot <gobot@golang.org>
Tue, 17 May 2022 17:54:33 +0000 (17:54 +0000)
The basic arch-specific hooks are implemented, which
are used for internal and external linker.

Contributors to the loong64 port are:
  Weining Lu <luweining@loongson.cn>
  Lei Wang <wanglei@loongson.cn>
  Lingqin Gong <gonglingqin@loongson.cn>
  Xiaolin Zhao <zhaoxiaolin@loongson.cn>
  Meidan Li <limeidan@loongson.cn>
  Xiaojuan Zhai <zhaixiaojuan@loongson.cn>
  Qiyuan Pu <puqiyuan@loongson.cn>
  Guoqi Chen <chenguoqi@loongson.cn>

This port has been updated to Go 1.15.6:
  https://github.com/loongson/go

Updates #46229

Change-Id: I4680eb0635dd0fa3d6ea8348a2488da9c7e33d3b
Reviewed-on: https://go-review.googlesource.com/c/go/+/349514
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>

12 files changed:
src/cmd/link/internal/ld/config.go
src/cmd/link/internal/ld/elf.go
src/cmd/link/internal/ld/lib.go
src/cmd/link/internal/ld/pcln.go
src/cmd/link/internal/ld/target.go
src/cmd/link/internal/loadelf/ldelf.go
src/cmd/link/internal/loong64/asm.go [new file with mode: 0644]
src/cmd/link/internal/loong64/l.go [new file with mode: 0644]
src/cmd/link/internal/loong64/obj.go [new file with mode: 0644]
src/cmd/link/internal/sym/reloc.go
src/cmd/link/link_test.go
src/cmd/link/main.go

index 33ab7c3df36777db19d10ef74a46588394704701..6d19b8b5bbcb8e65387e5bacab34f91a6b8ddb9c 100644 (file)
@@ -199,7 +199,7 @@ func mustLinkExternal(ctxt *Link) (res bool, reason string) {
 
        // Internally linking cgo is incomplete on some architectures.
        // https://golang.org/issue/14449
-       if iscgo && ctxt.Arch.InFamily(sys.MIPS64, sys.MIPS, sys.RISCV64) {
+       if iscgo && ctxt.Arch.InFamily(sys.Loong64, sys.MIPS64, sys.MIPS, sys.RISCV64) {
                return true, buildcfg.GOARCH + " does not support internal cgo"
        }
        if iscgo && (buildcfg.GOOS == "android" || buildcfg.GOOS == "dragonfly") {
index 343803b47cd0678dbbfe6a0f011f3d6844d8e793..e57071d4eeeb1d617fc391ff7bdd1ee18c90d069 100644 (file)
@@ -208,7 +208,7 @@ we write section and prog headers.
 func Elfinit(ctxt *Link) {
        ctxt.IsELF = true
 
-       if ctxt.Arch.InFamily(sys.AMD64, sys.ARM64, sys.MIPS64, sys.PPC64, sys.RISCV64, sys.S390X) {
+       if ctxt.Arch.InFamily(sys.AMD64, sys.ARM64, sys.Loong64, sys.MIPS64, sys.PPC64, sys.RISCV64, sys.S390X) {
                elfRelType = ".rela"
        } else {
                elfRelType = ".rel"
@@ -223,10 +223,13 @@ func Elfinit(ctxt *Link) {
                        ehdr.Flags = 2 /* Version 2 ABI */
                }
                fallthrough
-       case sys.AMD64, sys.ARM64, sys.MIPS64, sys.RISCV64:
+       case sys.AMD64, sys.ARM64, sys.Loong64, sys.MIPS64, sys.RISCV64:
                if ctxt.Arch.Family == sys.MIPS64 {
                        ehdr.Flags = 0x20000004 /* MIPS 3 CPIC */
                }
+               if ctxt.Arch.Family == sys.Loong64 {
+                       ehdr.Flags = 0x3 /* LoongArch lp64d */
+               }
                if ctxt.Arch.Family == sys.RISCV64 {
                        ehdr.Flags = 0x4 /* RISCV Float ABI Double */
                }
@@ -1655,6 +1658,8 @@ func asmbElf(ctxt *Link) {
                Exitf("unknown architecture in asmbelf: %v", ctxt.Arch.Family)
        case sys.MIPS, sys.MIPS64:
                eh.Machine = uint16(elf.EM_MIPS)
+       case sys.Loong64:
+               eh.Machine = uint16(elf.EM_LOONGARCH)
        case sys.ARM:
                eh.Machine = uint16(elf.EM_ARM)
        case sys.AMD64:
index 04b2556ea1ecb6ef76d95ea37530c5a8ab336232..19678adbd5675f8efc8e2883dab47d97fa15e7b5 100644 (file)
@@ -1899,6 +1899,8 @@ func hostlinkArchArgs(arch *sys.Arch) []string {
                if buildcfg.GOOS == "darwin" {
                        return []string{"-arch", "arm64"}
                }
+       case sys.Loong64:
+               return []string{"-mabi=lp64d"}
        case sys.MIPS64:
                return []string{"-mabi=64"}
        case sys.MIPS:
index 7003ed78589a94406175531cb898dc8399e497b0..7a7a4833aa446c6a047d85b711209d2649821143 100644 (file)
@@ -132,7 +132,7 @@ func computeDeferReturn(ctxt *Link, deferReturnSym, s loader.Sym) uint32 {
                                switch target.Arch.Family {
                                case sys.AMD64, sys.I386:
                                        deferreturn--
-                               case sys.ARM, sys.ARM64, sys.MIPS, sys.MIPS64, sys.PPC64, sys.RISCV64:
+                               case sys.ARM, sys.ARM64, sys.Loong64, sys.MIPS, sys.MIPS64, sys.PPC64, sys.RISCV64:
                                        // no change
                                case sys.S390X:
                                        deferreturn -= 2
index 58d45d1504677376163e563bb35c95d47969501e..cc8e4181b6a763b737724a63bf7872e211870901 100644 (file)
@@ -112,6 +112,10 @@ func (t *Target) IsMIPS64() bool {
        return t.Arch.Family == sys.MIPS64
 }
 
+func (t *Target) IsLOONG64() bool {
+       return t.Arch.Family == sys.Loong64
+}
+
 func (t *Target) IsPPC64() bool {
        return t.Arch.Family == sys.PPC64
 }
index 03813909de9fd9dfa5ccf968728ade23fdfa6f80..f5b790767554f0bd78ee3eeae69bf3e06ec45ff4 100644 (file)
@@ -346,6 +346,10 @@ func Load(l *loader.Loader, arch *sys.Arch, localSymVersion int, f *bio.Reader,
                if mach != elf.EM_MIPS || class != elf.ELFCLASS64 {
                        return errorf("elf object but not mips64")
                }
+       case sys.Loong64:
+               if mach != elf.EM_LOONGARCH || class != elf.ELFCLASS64 {
+                       return errorf("elf object but not loong64")
+               }
 
        case sys.ARM:
                if e != binary.LittleEndian || mach != elf.EM_ARM || class != elf.ELFCLASS32 {
@@ -956,6 +960,7 @@ func relSize(arch *sys.Arch, pn string, elftype uint32) (uint8, uint8, error) {
                ARM     = uint32(sys.ARM)
                ARM64   = uint32(sys.ARM64)
                I386    = uint32(sys.I386)
+               LOONG64 = uint32(sys.Loong64)
                MIPS    = uint32(sys.MIPS)
                MIPS64  = uint32(sys.MIPS64)
                PPC64   = uint32(sys.PPC64)
@@ -991,6 +996,15 @@ func relSize(arch *sys.Arch, pn string, elftype uint32) (uint8, uint8, error) {
                MIPS64 | uint32(elf.R_MIPS_GOT_DISP)<<16:
                return 4, 4, nil
 
+       case LOONG64 | uint32(elf.R_LARCH_SOP_PUSH_PCREL)<<16,
+               LOONG64 | uint32(elf.R_LARCH_SOP_PUSH_GPREL)<<16,
+               LOONG64 | uint32(elf.R_LARCH_SOP_PUSH_ABSOLUTE)<<16,
+               LOONG64 | uint32(elf.R_LARCH_MARK_LA)<<16,
+               LOONG64 | uint32(elf.R_LARCH_SOP_POP_32_S_0_10_10_16_S2)<<16,
+               LOONG64 | uint32(elf.R_LARCH_64)<<16,
+               LOONG64 | uint32(elf.R_LARCH_MARK_PCREL)<<16:
+               return 4, 4, nil
+
        case S390X | uint32(elf.R_390_8)<<16:
                return 1, 1, nil
 
diff --git a/src/cmd/link/internal/loong64/asm.go b/src/cmd/link/internal/loong64/asm.go
new file mode 100644 (file)
index 0000000..0eb3a81
--- /dev/null
@@ -0,0 +1,240 @@
+// Copyright 2022 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package loong64
+
+import (
+       "cmd/internal/objabi"
+       "cmd/internal/sys"
+       "cmd/link/internal/ld"
+       "cmd/link/internal/loader"
+       "cmd/link/internal/sym"
+       "debug/elf"
+       "log"
+)
+
+func gentext(ctxt *ld.Link, ldr *loader.Loader) {}
+
+func adddynrel(target *ld.Target, ldr *loader.Loader, syms *ld.ArchSyms, s loader.Sym, r loader.Reloc, rIdx int) bool {
+       log.Fatalf("adddynrel not implemented")
+       return false
+}
+
+func elfreloc1(ctxt *ld.Link, out *ld.OutBuf, ldr *loader.Loader, s loader.Sym, r loader.ExtReloc, ri int, sectoff int64) bool {
+       // loong64 ELF relocation (endian neutral)
+       //              offset     uint64
+       //              symreloc   uint64  // The high 32-bit is the symbol, the low 32-bit is the relocation type.
+       //              addend     int64
+
+       elfsym := ld.ElfSymForReloc(ctxt, r.Xsym)
+       switch r.Type {
+       default:
+               return false
+       case objabi.R_ADDR, objabi.R_DWARFSECREF:
+               switch r.Size {
+               case 4:
+                       out.Write64(uint64(sectoff))
+                       out.Write64(uint64(elf.R_LARCH_32) | uint64(elfsym)<<32)
+                       out.Write64(uint64(r.Xadd))
+               case 8:
+                       out.Write64(uint64(sectoff))
+                       out.Write64(uint64(elf.R_LARCH_64) | uint64(elfsym)<<32)
+                       out.Write64(uint64(r.Xadd))
+               default:
+                       return false
+               }
+       case objabi.R_ADDRLOONG64TLS:
+               out.Write64(uint64(sectoff))
+               out.Write64(uint64(elf.R_LARCH_SOP_PUSH_TLS_TPREL) | uint64(elfsym)<<32)
+               out.Write64(uint64(r.Xadd))
+
+               out.Write64(uint64(sectoff))
+               out.Write64(uint64(elf.R_LARCH_SOP_PUSH_ABSOLUTE))
+               out.Write64(uint64(0xfff))
+
+               out.Write64(uint64(sectoff))
+               out.Write64(uint64(elf.R_LARCH_SOP_AND))
+               out.Write64(uint64(0x0))
+
+               out.Write64(uint64(sectoff))
+               out.Write64(uint64(elf.R_LARCH_SOP_POP_32_U_10_12))
+               out.Write64(uint64(0x0))
+
+       case objabi.R_ADDRLOONG64TLSU:
+               out.Write64(uint64(sectoff))
+               out.Write64(uint64(elf.R_LARCH_SOP_PUSH_TLS_TPREL) | uint64(elfsym)<<32)
+               out.Write64(uint64(r.Xadd))
+
+               out.Write64(uint64(sectoff))
+               out.Write64(uint64(elf.R_LARCH_SOP_PUSH_ABSOLUTE))
+               out.Write64(uint64(0xc))
+
+               out.Write64(uint64(sectoff))
+               out.Write64(uint64(elf.R_LARCH_SOP_SR))
+               out.Write64(uint64(0x0))
+
+               out.Write64(uint64(sectoff))
+               out.Write64(uint64(elf.R_LARCH_SOP_POP_32_S_5_20) | uint64(0)<<32)
+               out.Write64(uint64(0x0))
+
+       case objabi.R_CALLLOONG64:
+               out.Write64(uint64(sectoff))
+               out.Write64(uint64(elf.R_LARCH_SOP_PUSH_PLT_PCREL) | uint64(elfsym)<<32)
+               out.Write64(uint64(r.Xadd))
+
+               out.Write64(uint64(sectoff))
+               out.Write64(uint64(elf.R_LARCH_SOP_POP_32_S_0_10_10_16_S2))
+               out.Write64(uint64(0x0))
+       // The pcaddu12i + addi.d instructions is used to obtain address of a symbol on Loong64.
+       // The low 12-bit of the symbol address need to be added. The addi.d instruction have
+       // signed 12-bit immediate operand. The 0x800 (addr+U12 <=> addr+0x800+S12) is introduced
+       // to do sign extending from 12 bits. The 0x804 is 0x800 + 4, 4 is instruction bit
+       // width on Loong64 and is used to correct the PC of the addi.d instruction.
+       case objabi.R_ADDRLOONG64:
+               out.Write64(uint64(sectoff))
+               out.Write64(uint64(elf.R_LARCH_SOP_PUSH_PCREL) | uint64(elfsym)<<32)
+               out.Write64(uint64(r.Xadd + 0x4))
+
+               out.Write64(uint64(sectoff))
+               out.Write64(uint64(elf.R_LARCH_SOP_PUSH_PCREL) | uint64(elfsym)<<32)
+               out.Write64(uint64(r.Xadd + 0x804))
+
+               out.Write64(uint64(sectoff))
+               out.Write64(uint64(elf.R_LARCH_SOP_PUSH_ABSOLUTE))
+               out.Write64(uint64(0xc))
+
+               out.Write64(uint64(sectoff))
+               out.Write64(uint64(elf.R_LARCH_SOP_SR))
+               out.Write64(uint64(0x0))
+
+               out.Write64(uint64(sectoff))
+               out.Write64(uint64(elf.R_LARCH_SOP_PUSH_ABSOLUTE))
+               out.Write64(uint64(0xc))
+
+               out.Write64(uint64(sectoff))
+               out.Write64(uint64(elf.R_LARCH_SOP_SL))
+               out.Write64(uint64(0x0))
+
+               out.Write64(uint64(sectoff))
+               out.Write64(uint64(elf.R_LARCH_SOP_SUB))
+               out.Write64(uint64(0x0))
+
+               out.Write64(uint64(sectoff))
+               out.Write64(uint64(elf.R_LARCH_SOP_POP_32_S_10_12))
+               out.Write64(uint64(0x0))
+
+       case objabi.R_ADDRLOONG64U:
+               out.Write64(uint64(sectoff))
+               out.Write64(uint64(elf.R_LARCH_SOP_PUSH_PCREL) | uint64(elfsym)<<32)
+               out.Write64(uint64(r.Xadd + 0x800))
+
+               out.Write64(uint64(sectoff))
+               out.Write64(uint64(elf.R_LARCH_SOP_PUSH_ABSOLUTE))
+               out.Write64(uint64(0xc))
+
+               out.Write64(uint64(sectoff))
+               out.Write64(uint64(elf.R_LARCH_SOP_SR))
+               out.Write64(uint64(0x0))
+
+               out.Write64(uint64(sectoff))
+               out.Write64(uint64(elf.R_LARCH_SOP_POP_32_S_5_20) | uint64(0)<<32)
+               out.Write64(uint64(0x0))
+       }
+
+       return true
+}
+
+func elfsetupplt(ctxt *ld.Link, plt, gotplt *loader.SymbolBuilder, dynamic loader.Sym) {
+       return
+}
+
+func machoreloc1(*sys.Arch, *ld.OutBuf, *loader.Loader, loader.Sym, loader.ExtReloc, int64) bool {
+       return false
+}
+
+func archreloc(target *ld.Target, ldr *loader.Loader, syms *ld.ArchSyms, r loader.Reloc, s loader.Sym, val int64) (o int64, nExtReloc int, ok bool) {
+       rs := r.Sym()
+       if target.IsExternal() {
+               nExtReloc := 0
+               switch r.Type() {
+               default:
+                       return val, 0, false
+               case objabi.R_ADDRLOONG64,
+                       objabi.R_ADDRLOONG64U:
+                       // set up addend for eventual relocation via outer symbol.
+                       rs, _ := ld.FoldSubSymbolOffset(ldr, rs)
+                       rst := ldr.SymType(rs)
+                       if rst != sym.SHOSTOBJ && rst != sym.SDYNIMPORT && ldr.SymSect(rs) == nil {
+                               ldr.Errorf(s, "missing section for %s", ldr.SymName(rs))
+                       }
+                       nExtReloc = 8 // need 8 ELF relocations. see elfreloc1
+                       if r.Type() == objabi.R_ADDRLOONG64U {
+                               nExtReloc = 4
+                       }
+                       return val, nExtReloc, true
+               case objabi.R_ADDRLOONG64TLS,
+                       objabi.R_ADDRLOONG64TLSU,
+                       objabi.R_CALLLOONG64,
+                       objabi.R_JMPLOONG64:
+                       nExtReloc = 4
+                       if r.Type() == objabi.R_CALLLOONG64 || r.Type() == objabi.R_JMPLOONG64 {
+                               nExtReloc = 2
+                       }
+                       return val, nExtReloc, true
+               }
+       }
+
+       const isOk = true
+       const noExtReloc = 0
+
+       switch r.Type() {
+       case objabi.R_CONST:
+               return r.Add(), noExtReloc, isOk
+       case objabi.R_GOTOFF:
+               return ldr.SymValue(r.Sym()) + r.Add() - ldr.SymValue(syms.GOT), noExtReloc, isOk
+       case objabi.R_ADDRLOONG64,
+               objabi.R_ADDRLOONG64U:
+               pc := ldr.SymValue(s) + int64(r.Off())
+               t := ldr.SymAddr(rs) + r.Add() - pc
+               if r.Type() == objabi.R_ADDRLOONG64 {
+                       return int64(val&0xffc003ff | (((t + 4 - ((t + 4 + 1<<11) >> 12 << 12)) << 10) & 0x3ffc00)), noExtReloc, isOk
+               }
+               return int64(val&0xfe00001f | (((t + 1<<11) >> 12 << 5) & 0x1ffffe0)), noExtReloc, isOk
+       case objabi.R_ADDRLOONG64TLS,
+               objabi.R_ADDRLOONG64TLSU:
+               t := ldr.SymAddr(rs) + r.Add()
+               if r.Type() == objabi.R_ADDRLOONG64TLS {
+                       return int64(val&0xffc003ff | ((t & 0xfff) << 10)), noExtReloc, isOk
+               }
+               return int64(val&0xfe00001f | (((t) >> 12 << 5) & 0x1ffffe0)), noExtReloc, isOk
+       case objabi.R_CALLLOONG64,
+               objabi.R_JMPLOONG64:
+               pc := ldr.SymValue(s) + int64(r.Off())
+               t := ldr.SymAddr(rs) + r.Add() - pc
+               return int64(val&0xfc000000 | (((t >> 2) & 0xffff) << 10) | (((t >> 2) & 0x3ff0000) >> 16)), noExtReloc, isOk
+       }
+
+       return val, 0, false
+}
+
+func archrelocvariant(*ld.Target, *loader.Loader, loader.Reloc, sym.RelocVariant, loader.Sym, int64, []byte) int64 {
+       return -1
+}
+
+func extreloc(target *ld.Target, ldr *loader.Loader, r loader.Reloc, s loader.Sym) (loader.ExtReloc, bool) {
+       switch r.Type() {
+       case objabi.R_ADDRLOONG64,
+               objabi.R_ADDRLOONG64U:
+               return ld.ExtrelocViaOuterSym(ldr, r, s), true
+
+       case objabi.R_ADDRLOONG64TLS,
+               objabi.R_ADDRLOONG64TLSU,
+               objabi.R_CONST,
+               objabi.R_GOTOFF,
+               objabi.R_CALLLOONG64,
+               objabi.R_JMPLOONG64:
+               return ld.ExtrelocSimple(ldr, r), true
+       }
+       return loader.ExtReloc{}, false
+}
diff --git a/src/cmd/link/internal/loong64/l.go b/src/cmd/link/internal/loong64/l.go
new file mode 100644 (file)
index 0000000..e97a868
--- /dev/null
@@ -0,0 +1,17 @@
+// Copyright 2022 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package loong64
+
+const (
+       maxAlign  = 32 // max data alignment
+       minAlign  = 1  // min data alignment
+       funcAlign = 8
+)
+
+/* Used by ../../internal/ld/dwarf.go */
+const (
+       dwarfRegSP = 3
+       dwarfRegLR = 1
+)
diff --git a/src/cmd/link/internal/loong64/obj.go b/src/cmd/link/internal/loong64/obj.go
new file mode 100644 (file)
index 0000000..b564dfd
--- /dev/null
@@ -0,0 +1,58 @@
+// Copyright 2022 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package loong64
+
+import (
+       "cmd/internal/objabi"
+       "cmd/internal/sys"
+       "cmd/link/internal/ld"
+)
+
+func Init() (*sys.Arch, ld.Arch) {
+       arch := sys.ArchLoong64
+
+       theArch := ld.Arch{
+               Funcalign:        funcAlign,
+               Maxalign:         maxAlign,
+               Minalign:         minAlign,
+               Dwarfregsp:       dwarfRegSP,
+               Dwarfreglr:       dwarfRegLR,
+               Adddynrel:        adddynrel,
+               Archinit:         archinit,
+               Archreloc:        archreloc,
+               Archrelocvariant: archrelocvariant,
+               Extreloc:         extreloc,
+               Elfreloc1:        elfreloc1,
+               ElfrelocSize:     24,
+               Elfsetupplt:      elfsetupplt,
+               Machoreloc1:      machoreloc1,
+               Gentext:          gentext,
+
+               Linuxdynld:     "/lib64/ld.so.1",
+               Freebsddynld:   "XXX",
+               Openbsddynld:   "XXX",
+               Netbsddynld:    "XXX",
+               Dragonflydynld: "XXX",
+               Solarisdynld:   "XXX",
+       }
+
+       return arch, theArch
+}
+
+func archinit(ctxt *ld.Link) {
+       switch ctxt.HeadType {
+       default:
+               ld.Exitf("unknown -H option: %v", ctxt.HeadType)
+       case objabi.Hlinux: /* loong64 elf */
+               ld.Elfinit(ctxt)
+               ld.HEADR = ld.ELFRESERVE
+               if *ld.FlagTextAddr == -1 {
+                       *ld.FlagTextAddr = 0x10000 + int64(ld.HEADR)
+               }
+               if *ld.FlagRound == -1 {
+                       *ld.FlagRound = 0x10000
+               }
+       }
+}
index a543233a1d108a08a5c21bf308678549d3674808..a44dcdd517b3a9fb6a5608086e2a51f21b8366b0 100644 (file)
@@ -59,6 +59,8 @@ func RelocName(arch *sys.Arch, r objabi.RelocType) string {
                        return elf.R_AARCH64(nr).String()
                case sys.I386:
                        return elf.R_386(nr).String()
+               case sys.Loong64:
+                       return elf.R_LARCH(nr).String()
                case sys.MIPS, sys.MIPS64:
                        return elf.R_MIPS(nr).String()
                case sys.PPC64:
index b2614ea44c8683b3e89c504617d36e2b80a28070..45dc6b322df07306bf3a1f60000c3afe3cd38cbd 100644 (file)
@@ -175,6 +175,8 @@ func TestIssue33979(t *testing.T) {
 
        // Skip test on platforms that do not support cgo internal linking.
        switch runtime.GOARCH {
+       case "loong64":
+               t.Skipf("Skipping on %s/%s", runtime.GOOS, runtime.GOARCH)
        case "mips", "mipsle", "mips64", "mips64le":
                t.Skipf("Skipping on %s/%s", runtime.GOOS, runtime.GOARCH)
        }
index d92478e61e236858995765665f753fdb19abc36b..16e5a0115132f93b2f7fad0ab9628cd5d40504d1 100644 (file)
@@ -10,6 +10,7 @@ import (
        "cmd/link/internal/arm"
        "cmd/link/internal/arm64"
        "cmd/link/internal/ld"
+       "cmd/link/internal/loong64"
        "cmd/link/internal/mips"
        "cmd/link/internal/mips64"
        "cmd/link/internal/ppc64"
@@ -53,6 +54,8 @@ func main() {
                arch, theArch = arm.Init()
        case "arm64":
                arch, theArch = arm64.Init()
+       case "loong64":
+               arch, theArch = loong64.Init()
        case "mips", "mipsle":
                arch, theArch = mips.Init()
        case "mips64", "mips64le":