630 lines
25 KiB
Diff
630 lines
25 KiB
Diff
From 9e32a64afd05cb18a5dcb09a27322e243cd245f4 Mon Sep 17 00:00:00 2001
|
|
From: swcompiler <lc@wxiat.com>
|
|
Date: Mon, 25 Nov 2024 16:52:50 +0800
|
|
Subject: [PATCH 09/16] Sw64 Port: libgo
|
|
|
|
---
|
|
libgo/configure | 7 +-
|
|
libgo/configure.ac | 7 +-
|
|
libgo/go/cmd/cgo/main.go | 2 +
|
|
libgo/go/cmd/internal/sys/arch.go | 11 +++
|
|
libgo/go/debug/elf/elf.go | 72 ++++++++++++++++++
|
|
libgo/go/debug/elf/elf_test.go | 1 +
|
|
libgo/go/debug/elf/file.go | 47 ++++++++++++
|
|
libgo/go/encoding/xml/xml.go | 1 +
|
|
libgo/go/go/build/syslist.go | 2 +-
|
|
.../syscall/unix/getrandom_linux_sw_64.go | 9 +++
|
|
.../syscall/unix/sysnum_linux_sw_64.go | 10 +++
|
|
libgo/go/net/listen_test.go | 2 +-
|
|
libgo/go/regexp/testdata/basic.dat | 1 +
|
|
libgo/go/runtime/hash64.go | 2 +-
|
|
libgo/go/runtime/lfstack_64bit.go | 2 +-
|
|
libgo/go/runtime/mpagealloc_64bit.go | 2 +-
|
|
libgo/go/syscall/endian_little.go | 2 +-
|
|
libgo/go/syscall/libcall_linux_sw_64.go | 13 ++++
|
|
libgo/go/syscall/syscall_linux_sw_64.go | 25 ++++++
|
|
libgo/goarch.sh | 5 ++
|
|
libgo/mksysinfo.sh | 5 ++
|
|
libgo/runtime/go-signal.c | 76 ++++++++++---------
|
|
22 files changed, 257 insertions(+), 47 deletions(-)
|
|
create mode 100644 libgo/go/internal/syscall/unix/getrandom_linux_sw_64.go
|
|
create mode 100644 libgo/go/internal/syscall/unix/sysnum_linux_sw_64.go
|
|
create mode 100644 libgo/go/syscall/libcall_linux_sw_64.go
|
|
create mode 100644 libgo/go/syscall/syscall_linux_sw_64.go
|
|
|
|
diff --git a/libgo/configure b/libgo/configure
|
|
index ffe17c9be..b90dd9dae 100755
|
|
--- a/libgo/configure
|
|
+++ b/libgo/configure
|
|
@@ -14124,10 +14124,10 @@ esac
|
|
# - libgo/go/syscall/endian_XX.go
|
|
# - possibly others
|
|
# - possibly update files in libgo/go/internal/syscall/unix
|
|
-ALLGOARCH="386 alpha amd64 amd64p32 arm armbe arm64 arm64be ia64 m68k mips mipsle mips64 mips64le mips64p32 mips64p32le nios2 ppc ppc64 ppc64le riscv riscv64 s390 s390x sh shbe sparc sparc64 wasm"
|
|
+ALLGOARCH="386 alpha amd64 amd64p32 arm armbe arm64 arm64be ia64 m68k mips mipsle mips64 mips64le mips64p32 mips64p32le nios2 ppc ppc64 ppc64le riscv riscv64 s390 s390x sh shbe sparc sparc64 sw_64 wasm"
|
|
|
|
# All known GOARCH family values.
|
|
-ALLGOARCHFAMILY="I386 ALPHA AMD64 ARM ARM64 IA64 M68K MIPS MIPS64 NIOS2 PPC PPC64 RISCV RISCV64 S390 S390X SH SPARC SPARC64 WASM"
|
|
+ALLGOARCHFAMILY="I386 ALPHA AMD64 ARM ARM64 IA64 M68K MIPS MIPS64 NIOS2 PPC PPC64 RISCV RISCV64 S390 S390X SH SPARC SPARC64 SW_64 WASM"
|
|
|
|
GOARCH=unknown
|
|
case ${host} in
|
|
@@ -14323,6 +14323,9 @@ else
|
|
fi
|
|
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
|
;;
|
|
+ sw_64*-*-*)
|
|
+ GOARCH=sw_64
|
|
+ ;;
|
|
esac
|
|
|
|
|
|
diff --git a/libgo/configure.ac b/libgo/configure.ac
|
|
index 7e2b98ba6..9f903c64e 100644
|
|
--- a/libgo/configure.ac
|
|
+++ b/libgo/configure.ac
|
|
@@ -239,10 +239,10 @@ AC_SUBST(USE_DEJAGNU)
|
|
# - libgo/go/syscall/endian_XX.go
|
|
# - possibly others
|
|
# - possibly update files in libgo/go/internal/syscall/unix
|
|
-ALLGOARCH="386 alpha amd64 amd64p32 arm armbe arm64 arm64be ia64 m68k mips mipsle mips64 mips64le mips64p32 mips64p32le nios2 ppc ppc64 ppc64le riscv riscv64 s390 s390x sh shbe sparc sparc64 wasm"
|
|
+ALLGOARCH="386 alpha amd64 amd64p32 arm armbe arm64 arm64be ia64 m68k mips mipsle mips64 mips64le mips64p32 mips64p32le nios2 ppc ppc64 ppc64le riscv riscv64 s390 s390x sh shbe sparc sparc64 sw_64 wasm"
|
|
|
|
# All known GOARCH family values.
|
|
-ALLGOARCHFAMILY="I386 ALPHA AMD64 ARM ARM64 IA64 M68K MIPS MIPS64 NIOS2 PPC PPC64 RISCV RISCV64 S390 S390X SH SPARC SPARC64 WASM"
|
|
+ALLGOARCHFAMILY="I386 ALPHA SW_64 AMD64 ARM ARM64 IA64 M68K MIPS MIPS64 NIOS2 PPC PPC64 RISCV RISCV64 S390 S390X SH SPARC SPARC64 SW_64 WASM"
|
|
|
|
GOARCH=unknown
|
|
case ${host} in
|
|
@@ -370,6 +370,9 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
|
|
[GOARCH=sparc],
|
|
[GOARCH=sparc64])
|
|
;;
|
|
+ sw_64*-*-*)
|
|
+ GOARCH=sw_64
|
|
+ ;;
|
|
esac
|
|
AC_SUBST(GOARCH)
|
|
AC_SUBST(ALLGOARCH)
|
|
diff --git a/libgo/go/cmd/cgo/main.go b/libgo/go/cmd/cgo/main.go
|
|
index 58477e470..842237774 100644
|
|
--- a/libgo/go/cmd/cgo/main.go
|
|
+++ b/libgo/go/cmd/cgo/main.go
|
|
@@ -194,6 +194,7 @@ var ptrSizeMap = map[string]int64{
|
|
"shbe": 4,
|
|
"sparc": 4,
|
|
"sparc64": 8,
|
|
+ "sw_64": 8,
|
|
}
|
|
|
|
var intSizeMap = map[string]int64{
|
|
@@ -221,6 +222,7 @@ var intSizeMap = map[string]int64{
|
|
"shbe": 4,
|
|
"sparc": 4,
|
|
"sparc64": 8,
|
|
+ "sw_64": 8,
|
|
}
|
|
|
|
var cPrefix string
|
|
diff --git a/libgo/go/cmd/internal/sys/arch.go b/libgo/go/cmd/internal/sys/arch.go
|
|
index 97d0ac9bb..dea328a34 100644
|
|
--- a/libgo/go/cmd/internal/sys/arch.go
|
|
+++ b/libgo/go/cmd/internal/sys/arch.go
|
|
@@ -12,6 +12,7 @@ type ArchFamily byte
|
|
|
|
const (
|
|
NoArch ArchFamily = iota
|
|
+ SW_64
|
|
AMD64
|
|
ARM
|
|
ARM64
|
|
@@ -229,7 +230,17 @@ var ArchWasm = &Arch{
|
|
CanMergeLoads: false,
|
|
}
|
|
|
|
+/*TODO*/
|
|
+var ArchSW_64 = &Arch{
|
|
+ Name: "sw_64",
|
|
+ Family: SW_64,
|
|
+ ByteOrder: binary.LittleEndian,
|
|
+ PtrSize: 8,
|
|
+ RegSize: 8,
|
|
+ MinLC: 1,
|
|
+}
|
|
var Archs = [...]*Arch{
|
|
+ ArchSW_64,
|
|
Arch386,
|
|
ArchAMD64,
|
|
ArchARM,
|
|
diff --git a/libgo/go/debug/elf/elf.go b/libgo/go/debug/elf/elf.go
|
|
index 4c51bc4de..1899a4245 100644
|
|
--- a/libgo/go/debug/elf/elf.go
|
|
+++ b/libgo/go/debug/elf/elf.go
|
|
@@ -6,6 +6,7 @@
|
|
* $FreeBSD: src/sys/sys/elf64.h,v 1.10.14.1 2005/12/30 22:13:58 marcel Exp $
|
|
* $FreeBSD: src/sys/sys/elf_common.h,v 1.15.8.1 2005/12/30 22:13:58 marcel Exp $
|
|
* $FreeBSD: src/sys/alpha/include/elf.h,v 1.14 2003/09/25 01:10:22 peter Exp $
|
|
+ * $FreeBSD: src/sys/sw_64/include/elf.h,v 1.14 2003/09/25 01:10:22 peter Exp $
|
|
* $FreeBSD: src/sys/amd64/include/elf.h,v 1.18 2004/08/03 08:21:48 dfr Exp $
|
|
* $FreeBSD: src/sys/arm/include/elf.h,v 1.5.2.1 2006/06/30 21:42:52 cognet Exp $
|
|
* $FreeBSD: src/sys/i386/include/elf.h,v 1.16 2004/08/02 19:12:17 dfr Exp $
|
|
@@ -390,6 +391,8 @@ const (
|
|
EM_MIPS_RS4_BE Machine = 10 /* MIPS R4000 Big-Endian */
|
|
EM_ALPHA_STD Machine = 41 /* Digital Alpha (standard value). */
|
|
EM_ALPHA Machine = 0x9026 /* Alpha (written in the absence of an ABI) */
|
|
+ EM_SW_64_STD Machine = 41 /* Digital Sw_64 (standard value). */
|
|
+ EM_SW_64 Machine = 0x9916 /* Mieee-opt Sw_64 (written in the absence of an ABI) */
|
|
)
|
|
|
|
var machineStrings = []intName{
|
|
@@ -581,6 +584,8 @@ var machineStrings = []intName{
|
|
{10, "EM_MIPS_RS4_BE"},
|
|
{41, "EM_ALPHA_STD"},
|
|
{0x9026, "EM_ALPHA"},
|
|
+ {41, "EM_SW_64_STD"},
|
|
+ {0x9916, "EM_SW_64"},
|
|
}
|
|
|
|
func (i Machine) String() string { return stringName(uint32(i), machineStrings, false) }
|
|
@@ -1645,6 +1650,73 @@ var ralphaStrings = []intName{
|
|
func (i R_ALPHA) String() string { return stringName(uint32(i), ralphaStrings, false) }
|
|
func (i R_ALPHA) GoString() string { return stringName(uint32(i), ralphaStrings, true) }
|
|
|
|
+// Relocation types for SW_64.
|
|
+type R_SW_64 int
|
|
+
|
|
+const (
|
|
+ R_SW_64_NONE R_SW_64 = 0 /* No reloc */
|
|
+ R_SW_64_REFLONG R_SW_64 = 1 /* Direct 32 bit */
|
|
+ R_SW_64_REFQUAD R_SW_64 = 2 /* Direct 64 bit */
|
|
+ R_SW_64_GPREL32 R_SW_64 = 3 /* GP relative 32 bit */
|
|
+ R_SW_64_LITERAL R_SW_64 = 4 /* GP relative 16 bit w/optimization */
|
|
+ R_SW_64_LITUSE R_SW_64 = 5 /* Optimization hint for LITERAL */
|
|
+ R_SW_64_GPDISP R_SW_64 = 6 /* Add displacement to GP */
|
|
+ R_SW_64_BRADDR R_SW_64 = 7 /* PC+4 relative 23 bit shifted */
|
|
+ R_SW_64_HINT R_SW_64 = 8 /* PC+4 relative 16 bit shifted */
|
|
+ R_SW_64_SREL16 R_SW_64 = 9 /* PC relative 16 bit */
|
|
+ R_SW_64_SREL32 R_SW_64 = 10 /* PC relative 32 bit */
|
|
+ R_SW_64_SREL64 R_SW_64 = 11 /* PC relative 64 bit */
|
|
+ R_SW_64_OP_PUSH R_SW_64 = 12 /* OP stack push */
|
|
+ R_SW_64_OP_STORE R_SW_64 = 13 /* OP stack pop and store */
|
|
+ R_SW_64_OP_PSUB R_SW_64 = 14 /* OP stack subtract */
|
|
+ R_SW_64_OP_PRSHIFT R_SW_64 = 15 /* OP stack right shift */
|
|
+ R_SW_64_GPVALUE R_SW_64 = 16
|
|
+ R_SW_64_GPRELHIGH R_SW_64 = 17
|
|
+ R_SW_64_GPRELLOW R_SW_64 = 18
|
|
+ R_SW_64_IMMED_GP_16 R_SW_64 = 19
|
|
+ R_SW_64_IMMED_GP_HI32 R_SW_64 = 20
|
|
+ R_SW_64_IMMED_SCN_HI32 R_SW_64 = 21
|
|
+ R_SW_64_IMMED_BR_HI32 R_SW_64 = 22
|
|
+ R_SW_64_IMMED_LO32 R_SW_64 = 23
|
|
+ R_SW_64_COPY R_SW_64 = 24 /* Copy sympol at runtime */
|
|
+ R_SW_64_GLOB_DAT R_SW_64 = 25 /* Create GOT entry */
|
|
+ R_SW_64_JMP_SLOT R_SW_64 = 26 /* Create PLT entry */
|
|
+ R_SW_64_RELATIVE R_SW_64 = 27 /* Adjust by program base */
|
|
+)
|
|
+var rsw_64Strings = []intName{
|
|
+ {0, "R_SW_64_NONE"},
|
|
+ {1, "R_SW_64_REFLONG"},
|
|
+ {2, "R_SW_64_REFQUAD"},
|
|
+ {3, "R_SW_64_GPREL32"},
|
|
+ {4, "R_SW_64_LITERAL"},
|
|
+ {5, "R_SW_64_LITUSE"},
|
|
+ {6, "R_SW_64_GPDISP"},
|
|
+ {7, "R_SW_64_BRADDR"},
|
|
+ {8, "R_SW_64_HINT"},
|
|
+ {9, "R_SW_64_SREL16"},
|
|
+ {10, "R_SW_64_SREL32"},
|
|
+ {11, "R_SW_64_SREL64"},
|
|
+ {12, "R_SW_64_OP_PUSH"},
|
|
+ {13, "R_SW_64_OP_STORE"},
|
|
+ {14, "R_SW_64_OP_PSUB"},
|
|
+ {15, "R_SW_64_OP_PRSHIFT"},
|
|
+ {16, "R_SW_64_GPVALUE"},
|
|
+ {17, "R_SW_64_GPRELHIGH"},
|
|
+ {18, "R_SW_64_GPRELLOW"},
|
|
+ {19, "R_SW_64_IMMED_GP_16"},
|
|
+ {20, "R_SW_64_IMMED_GP_HI32"},
|
|
+ {21, "R_SW_64_IMMED_SCN_HI32"},
|
|
+ {22, "R_SW_64_IMMED_BR_HI32"},
|
|
+ {23, "R_SW_64_IMMED_LO32"},
|
|
+ {24, "R_SW_64_COPY"},
|
|
+ {25, "R_SW_64_GLOB_DAT"},
|
|
+ {26, "R_SW_64_JMP_SLOT"},
|
|
+ {27, "R_SW_64_RELATIVE"},
|
|
+}
|
|
+
|
|
+func (i R_SW_64) String() string { return stringName(uint32(i), rsw_64Strings, false) }
|
|
+func (i R_SW_64) GoString() string { return stringName(uint32(i), rsw_64Strings, true) }
|
|
+
|
|
// Relocation types for ARM.
|
|
type R_ARM int
|
|
|
|
diff --git a/libgo/go/debug/elf/elf_test.go b/libgo/go/debug/elf/elf_test.go
|
|
index b8c310dba..940af9c51 100644
|
|
--- a/libgo/go/debug/elf/elf_test.go
|
|
+++ b/libgo/go/debug/elf/elf_test.go
|
|
@@ -31,6 +31,7 @@ var nameTests = []nameTest{
|
|
{STV_HIDDEN, "STV_HIDDEN"},
|
|
{R_X86_64_PC32, "R_X86_64_PC32"},
|
|
{R_ALPHA_OP_PUSH, "R_ALPHA_OP_PUSH"},
|
|
+ {R_SW_64_OP_PUSH, "R_SW_64_OP_PUSH"},
|
|
{R_ARM_THM_ABS5, "R_ARM_THM_ABS5"},
|
|
{R_386_GOT32, "R_386_GOT32"},
|
|
{R_PPC_GOT16_HI, "R_PPC_GOT16_HI"},
|
|
diff --git a/libgo/go/debug/elf/file.go b/libgo/go/debug/elf/file.go
|
|
index 60d2788c9..53f34d78c 100644
|
|
--- a/libgo/go/debug/elf/file.go
|
|
+++ b/libgo/go/debug/elf/file.go
|
|
@@ -632,6 +632,8 @@ func (f *File) applyRelocations(dst []byte, rels []byte) error {
|
|
return f.applyRelocationsSPARC64(dst, rels)
|
|
case f.Class == ELFCLASS64 && f.Machine == EM_ALPHA:
|
|
return f.applyRelocationsALPHA(dst, rels)
|
|
+ case f.Class == ELFCLASS64 && f.Machine == EM_SW_64:
|
|
+ return f.applyRelocationsSW_64(dst, rels)
|
|
default:
|
|
return errors.New("applyRelocations: not implemented")
|
|
}
|
|
@@ -1266,6 +1268,51 @@ func (f *File) applyRelocationsALPHA(dst []byte, rels []byte) error {
|
|
return nil
|
|
}
|
|
|
|
+func (f *File) applyRelocationsSW_64(dst []byte, rels []byte) error {
|
|
+ // 24 is the size of Rela64.
|
|
+ if len(rels)%24 != 0 {
|
|
+ return errors.New("length of relocation section is not a multiple of 24")
|
|
+ }
|
|
+
|
|
+ symbols, _, err := f.getSymbols(SHT_SYMTAB)
|
|
+ if err != nil {
|
|
+ return err
|
|
+ }
|
|
+
|
|
+ b := bytes.NewReader(rels)
|
|
+ var rela Rela64
|
|
+ for b.Len() > 0 {
|
|
+ binary.Read(b, f.ByteOrder, &rela)
|
|
+ symNo := rela.Info >> 32
|
|
+ t := R_SW_64(rela.Info & 0xffff)
|
|
+
|
|
+ if symNo == 0 || symNo > uint64(len(symbols)) {
|
|
+ continue
|
|
+ }
|
|
+ sym := &symbols[symNo-1]
|
|
+ if SymType(sym.Info&0xf) != STT_SECTION {
|
|
+ // We don't handle non-section relocations for now.
|
|
+ continue
|
|
+ }
|
|
+
|
|
+ // There are relocations, so this must be a normal
|
|
+ // object file, and we only look at section symbols,
|
|
+ // so we assume that the symbol value is 0.
|
|
+ switch t {
|
|
+ case R_SW_64_REFQUAD:
|
|
+ if rela.Off+8 >= uint64(len(dst)) || rela.Addend < 0 {
|
|
+ continue
|
|
+ }
|
|
+ f.ByteOrder.PutUint64(dst[rela.Off:rela.Off+8], uint64(rela.Addend))
|
|
+ case R_SW_64_REFLONG:
|
|
+ if rela.Off+4 >= uint64(len(dst)) || rela.Addend < 0 {
|
|
+ }
|
|
+ f.ByteOrder.PutUint32(dst[rela.Off:rela.Off+4], uint32(rela.Addend))
|
|
+ }
|
|
+ }
|
|
+ return nil
|
|
+}
|
|
+
|
|
func (f *File) DWARF() (*dwarf.Data, error) {
|
|
dwarfSuffix := func(s *Section) string {
|
|
switch {
|
|
diff --git a/libgo/go/encoding/xml/xml.go b/libgo/go/encoding/xml/xml.go
|
|
index 8a0a9c253..f40099a1b 100644
|
|
--- a/libgo/go/encoding/xml/xml.go
|
|
+++ b/libgo/go/encoding/xml/xml.go
|
|
@@ -1727,6 +1727,7 @@ var htmlEntity = map[string]string{
|
|
"Psi": "\u03A8",
|
|
"Omega": "\u03A9",
|
|
"alpha": "\u03B1",
|
|
+ "sw_64": "\u03B1",
|
|
"beta": "\u03B2",
|
|
"gamma": "\u03B3",
|
|
"delta": "\u03B4",
|
|
diff --git a/libgo/go/go/build/syslist.go b/libgo/go/go/build/syslist.go
|
|
index 1b11365f5..74d7fec11 100644
|
|
--- a/libgo/go/go/build/syslist.go
|
|
+++ b/libgo/go/go/build/syslist.go
|
|
@@ -8,4 +8,4 @@ package build
|
|
// Do not remove from this list, as these are used for go/build filename matching.
|
|
|
|
const goosList = "aix android darwin dragonfly freebsd hurd illumos ios js linux nacl netbsd openbsd plan9 solaris windows zos "
|
|
-const goarchList = "386 amd64 amd64p32 arm armbe arm64 arm64be loong64 mips mipsle mips64 mips64le ppc ppc64 ppc64le riscv riscv64 s390 s390x sparc sparc64 wasm alpha m68k nios2 sh shbe "
|
|
+const goarchList = "386 amd64 amd64p32 arm armbe arm64 arm64be loong64 mips mipsle mips64 mips64le ppc ppc64 ppc64le riscv riscv64 s390 s390x sparc sparc64 wasm alpha m68k nios2 sh shbe sw_64"
|
|
diff --git a/libgo/go/internal/syscall/unix/getrandom_linux_sw_64.go b/libgo/go/internal/syscall/unix/getrandom_linux_sw_64.go
|
|
new file mode 100644
|
|
index 000000000..9587b5aa4
|
|
--- /dev/null
|
|
+++ b/libgo/go/internal/syscall/unix/getrandom_linux_sw_64.go
|
|
@@ -0,0 +1,9 @@
|
|
+// Copyright 2016 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 unix
|
|
+
|
|
+// Linux getrandom system call number.
|
|
+// See GetRandom in getrandom_linux.go.
|
|
+const randomTrap uintptr = 511
|
|
diff --git a/libgo/go/internal/syscall/unix/sysnum_linux_sw_64.go b/libgo/go/internal/syscall/unix/sysnum_linux_sw_64.go
|
|
new file mode 100644
|
|
index 000000000..c40bc8488
|
|
--- /dev/null
|
|
+++ b/libgo/go/internal/syscall/unix/sysnum_linux_sw_64.go
|
|
@@ -0,0 +1,10 @@
|
|
+// Copyright 2016 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 unix
|
|
+
|
|
+const (
|
|
+ getrandomTrap uintptr = 511
|
|
+ copyFileRangeTrap uintptr = 519
|
|
+)
|
|
diff --git a/libgo/go/net/listen_test.go b/libgo/go/net/listen_test.go
|
|
index 59c011212..d61055a04 100644
|
|
--- a/libgo/go/net/listen_test.go
|
|
+++ b/libgo/go/net/listen_test.go
|
|
@@ -673,7 +673,7 @@ func multicastRIBContains(ip IP) (bool, error) {
|
|
case "aix", "dragonfly", "netbsd", "openbsd", "plan9", "solaris", "illumos", "windows":
|
|
return true, nil // not implemented yet
|
|
case "linux":
|
|
- if runtime.GOARCH == "arm" || runtime.GOARCH == "alpha" {
|
|
+ if runtime.GOARCH == "arm" || runtime.GOARCH == "alpha" || runtime.GOARCH == "sw_64" {
|
|
return true, nil // not implemented yet
|
|
}
|
|
}
|
|
diff --git a/libgo/go/regexp/testdata/basic.dat b/libgo/go/regexp/testdata/basic.dat
|
|
index 1776b1ff9..b53926812 100644
|
|
--- a/libgo/go/regexp/testdata/basic.dat
|
|
+++ b/libgo/go/regexp/testdata/basic.dat
|
|
@@ -153,6 +153,7 @@ E a[bcd]*dcdcde adcdcde (0,7)
|
|
E (ab|a)b*c abc (0,3)(0,2)
|
|
E ((a)(b)c)(d) abcd (0,4)(0,3)(0,1)(1,2)(3,4)
|
|
BE [A-Za-z_][A-Za-z0-9_]* alpha (0,5)
|
|
+BE [A-Za-z_][A-Za-z0-9_]* sw_64 (0,5)
|
|
E ^a(bc+|b[eh])g|.h$ abh (1,3)
|
|
E (bc+d$|ef*g.|h?i(j|k)) effgz (0,5)(0,5)
|
|
E (bc+d$|ef*g.|h?i(j|k)) ij (0,2)(0,2)(1,2)
|
|
diff --git a/libgo/go/runtime/hash64.go b/libgo/go/runtime/hash64.go
|
|
index a1d2529e7..ee793552c 100644
|
|
--- a/libgo/go/runtime/hash64.go
|
|
+++ b/libgo/go/runtime/hash64.go
|
|
@@ -5,7 +5,7 @@
|
|
// Hashing algorithm inspired by
|
|
// wyhash: https://github.com/wangyi-fudan/wyhash
|
|
|
|
-//go:build amd64 || arm64 || mips64 || mips64le || ppc64 || ppc64le || riscv64 || s390x || wasm || alpha || arm64be || ia64 || sparc64
|
|
+//go:build amd64 || arm64 || mips64 || mips64le || ppc64 || ppc64le || riscv64 || s390x || wasm || alpha || sw_64 || arm64be || ia64 || sparc64
|
|
|
|
package runtime
|
|
|
|
diff --git a/libgo/go/runtime/lfstack_64bit.go b/libgo/go/runtime/lfstack_64bit.go
|
|
index 8e0883094..0e87c5059 100644
|
|
--- a/libgo/go/runtime/lfstack_64bit.go
|
|
+++ b/libgo/go/runtime/lfstack_64bit.go
|
|
@@ -2,7 +2,7 @@
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
-//go:build amd64 || arm64 || mips64 || mips64le || ppc64 || ppc64le || riscv64 || s390x || wasm || arm64be || alpha || sparc64 || ia64
|
|
+//go:build amd64 || arm64 || mips64 || mips64le || ppc64 || ppc64le || riscv64 || s390x || wasm || arm64be || alpha || sw_64 || sparc64 || ia64
|
|
|
|
package runtime
|
|
|
|
diff --git a/libgo/go/runtime/mpagealloc_64bit.go b/libgo/go/runtime/mpagealloc_64bit.go
|
|
index 3d0d4c608..aca127d7c 100644
|
|
--- a/libgo/go/runtime/mpagealloc_64bit.go
|
|
+++ b/libgo/go/runtime/mpagealloc_64bit.go
|
|
@@ -2,7 +2,7 @@
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
-//go:build amd64 || arm64 || mips64 || mips64le || ppc64 || ppc64le || riscv64 || s390x || arm64be || alpha || sparc64 || ia64
|
|
+//go:build amd64 || arm64 || mips64 || mips64le || ppc64 || ppc64le || riscv64 || s390x || arm64be || alpha || sw_64 || sparc64 || ia64
|
|
|
|
package runtime
|
|
|
|
diff --git a/libgo/go/syscall/endian_little.go b/libgo/go/syscall/endian_little.go
|
|
index 63e46d8b1..37af34bce 100644
|
|
--- a/libgo/go/syscall/endian_little.go
|
|
+++ b/libgo/go/syscall/endian_little.go
|
|
@@ -2,7 +2,7 @@
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
-//go:build 386 || alpha || amd64 || amd64p32 || arm || arm64 || ia64 || ppc64le || mips64le || mipsle || mips64p32le || nios2 || riscv || riscv64 || sh || wasm
|
|
+//go:build 386 || alpha || sw_64 || amd64 || amd64p32 || arm || arm64 || ia64 || ppc64le || mips64le || mipsle || mips64p32le || nios2 || riscv || riscv64 || sh || wasm
|
|
|
|
package syscall
|
|
|
|
diff --git a/libgo/go/syscall/libcall_linux_sw_64.go b/libgo/go/syscall/libcall_linux_sw_64.go
|
|
new file mode 100644
|
|
index 000000000..13ccf05a6
|
|
--- /dev/null
|
|
+++ b/libgo/go/syscall/libcall_linux_sw_64.go
|
|
@@ -0,0 +1,13 @@
|
|
+// Copyright 2012 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.
|
|
+
|
|
+// GNU/Linux library calls Alpha specific.
|
|
+
|
|
+package syscall
|
|
+
|
|
+//sys Ioperm(from int, num int, on int) (err error)
|
|
+//ioperm(from _C_long, num _C_long, on _C_int) _C_int
|
|
+
|
|
+//sys Iopl(level int) (err error)
|
|
+//iopl(level _C_int) _C_int
|
|
diff --git a/libgo/go/syscall/syscall_linux_sw_64.go b/libgo/go/syscall/syscall_linux_sw_64.go
|
|
new file mode 100644
|
|
index 000000000..5115b9b7c
|
|
--- /dev/null
|
|
+++ b/libgo/go/syscall/syscall_linux_sw_64.go
|
|
@@ -0,0 +1,25 @@
|
|
+// syscall_linux_alpha.go -- GNU/Linux ALPHA specific support
|
|
+
|
|
+// Copyright 2011 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 syscall
|
|
+
|
|
+import "unsafe"
|
|
+
|
|
+func (r *PtraceRegs) PC() uint64 {
|
|
+ return r.Pc
|
|
+}
|
|
+
|
|
+func (r *PtraceRegs) SetPC(pc uint64) {
|
|
+ r.Pc = pc
|
|
+}
|
|
+
|
|
+func PtraceGetRegs(pid int, regsout *PtraceRegs) (err error) {
|
|
+ return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
|
|
+}
|
|
+
|
|
+func PtraceSetRegs(pid int, regs *PtraceRegs) (err error) {
|
|
+ return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
|
|
+}
|
|
diff --git a/libgo/goarch.sh b/libgo/goarch.sh
|
|
index 977f318b3..a0cdcf17e 100755
|
|
--- a/libgo/goarch.sh
|
|
+++ b/libgo/goarch.sh
|
|
@@ -54,6 +54,11 @@ case $goarch in
|
|
defaultphyspagesize=8192
|
|
pcquantum=4
|
|
;;
|
|
+ sw_64)
|
|
+ family=SW_64
|
|
+ defaultphyspagesize=8192
|
|
+ pcquantum=4
|
|
+ ;;
|
|
amd64)
|
|
family=AMD64
|
|
;;
|
|
diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh
|
|
index 0c52ea5d7..11031f5a0 100755
|
|
--- a/libgo/mksysinfo.sh
|
|
+++ b/libgo/mksysinfo.sh
|
|
@@ -377,7 +377,12 @@ if test "$regs" = ""; then
|
|
# mips*
|
|
regs=`grep '^type _pt_regs struct' gen-sysinfo.go || true`
|
|
fi
|
|
+if test "$regs" = ""; then
|
|
+ # sw_64*
|
|
+ regs=`grep '^type _user_pt_regs struct' gen-sysinfo.go || true`
|
|
+fi
|
|
if test "$regs" != ""; then
|
|
+ regs=`echo $regs | sed -e 's/type _user_pt_regs struct//'`
|
|
regs=`echo $regs | sed -e 's/type _pt_regs struct//'`
|
|
regs=`echo $regs |
|
|
sed -e 's/type __*user_regs_struct struct //' -e 's/[{}]//g'`
|
|
diff --git a/libgo/runtime/go-signal.c b/libgo/runtime/go-signal.c
|
|
index 528d9b6d9..20e6947b5 100644
|
|
--- a/libgo/runtime/go-signal.c
|
|
+++ b/libgo/runtime/go-signal.c
|
|
@@ -230,6 +230,8 @@ getSiginfo(siginfo_t *info, void *context __attribute__((unused)))
|
|
ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.gregs[REG_EIP];
|
|
#elif defined(__alpha__) && defined(__linux__)
|
|
ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.sc_pc;
|
|
+#elif defined(__sw_64__) && defined(__linux__)
|
|
+ ret.sigpc = ((ucontext_t *) (context))->uc_mcontext.sc_pc;
|
|
#elif defined(__PPC64__) && defined(__linux__)
|
|
ret.sigpc = ((ucontext_t*)(context))->uc_mcontext.gp_regs[32];
|
|
#elif defined(__PPC__) && defined(__linux__)
|
|
@@ -311,43 +313,43 @@ dumpregs(siginfo_t *info __attribute__((unused)), void *context __attribute__((u
|
|
runtime_printf("fs %x\n", m->gregs[REG_FS]);
|
|
runtime_printf("gs %x\n", m->gregs[REG_GS]);
|
|
}
|
|
-#elif defined(__alpha__) && defined(__linux__)
|
|
- {
|
|
- mcontext_t *m = &((ucontext_t*)(context))->uc_mcontext;
|
|
-
|
|
- runtime_printf("v0 %X\n", m->sc_regs[0]);
|
|
- runtime_printf("t0 %X\n", m->sc_regs[1]);
|
|
- runtime_printf("t1 %X\n", m->sc_regs[2]);
|
|
- runtime_printf("t2 %X\n", m->sc_regs[3]);
|
|
- runtime_printf("t3 %X\n", m->sc_regs[4]);
|
|
- runtime_printf("t4 %X\n", m->sc_regs[5]);
|
|
- runtime_printf("t5 %X\n", m->sc_regs[6]);
|
|
- runtime_printf("t6 %X\n", m->sc_regs[7]);
|
|
- runtime_printf("t7 %X\n", m->sc_regs[8]);
|
|
- runtime_printf("s0 %X\n", m->sc_regs[9]);
|
|
- runtime_printf("s1 %X\n", m->sc_regs[10]);
|
|
- runtime_printf("s2 %X\n", m->sc_regs[11]);
|
|
- runtime_printf("s3 %X\n", m->sc_regs[12]);
|
|
- runtime_printf("s4 %X\n", m->sc_regs[13]);
|
|
- runtime_printf("s5 %X\n", m->sc_regs[14]);
|
|
- runtime_printf("fp %X\n", m->sc_regs[15]);
|
|
- runtime_printf("a0 %X\n", m->sc_regs[16]);
|
|
- runtime_printf("a1 %X\n", m->sc_regs[17]);
|
|
- runtime_printf("a2 %X\n", m->sc_regs[18]);
|
|
- runtime_printf("a3 %X\n", m->sc_regs[19]);
|
|
- runtime_printf("a4 %X\n", m->sc_regs[20]);
|
|
- runtime_printf("a5 %X\n", m->sc_regs[21]);
|
|
- runtime_printf("t8 %X\n", m->sc_regs[22]);
|
|
- runtime_printf("t9 %X\n", m->sc_regs[23]);
|
|
- runtime_printf("t10 %X\n", m->sc_regs[24]);
|
|
- runtime_printf("t11 %X\n", m->sc_regs[25]);
|
|
- runtime_printf("ra %X\n", m->sc_regs[26]);
|
|
- runtime_printf("t12 %X\n", m->sc_regs[27]);
|
|
- runtime_printf("at %X\n", m->sc_regs[28]);
|
|
- runtime_printf("gp %X\n", m->sc_regs[29]);
|
|
- runtime_printf("sp %X\n", m->sc_regs[30]);
|
|
- runtime_printf("pc %X\n", m->sc_pc);
|
|
- }
|
|
+#elif (defined(__alpha__) || defined(__sw_64__)) && defined(__linux__)
|
|
+ {
|
|
+ mcontext_t *m = &((ucontext_t *) (context))->uc_mcontext;
|
|
+
|
|
+ runtime_printf ("v0 %X\n", m->sc_regs[0]);
|
|
+ runtime_printf ("t0 %X\n", m->sc_regs[1]);
|
|
+ runtime_printf ("t1 %X\n", m->sc_regs[2]);
|
|
+ runtime_printf ("t2 %X\n", m->sc_regs[3]);
|
|
+ runtime_printf ("t3 %X\n", m->sc_regs[4]);
|
|
+ runtime_printf ("t4 %X\n", m->sc_regs[5]);
|
|
+ runtime_printf ("t5 %X\n", m->sc_regs[6]);
|
|
+ runtime_printf ("t6 %X\n", m->sc_regs[7]);
|
|
+ runtime_printf ("t7 %X\n", m->sc_regs[8]);
|
|
+ runtime_printf ("s0 %X\n", m->sc_regs[9]);
|
|
+ runtime_printf ("s1 %X\n", m->sc_regs[10]);
|
|
+ runtime_printf ("s2 %X\n", m->sc_regs[11]);
|
|
+ runtime_printf ("s3 %X\n", m->sc_regs[12]);
|
|
+ runtime_printf ("s4 %X\n", m->sc_regs[13]);
|
|
+ runtime_printf ("s5 %X\n", m->sc_regs[14]);
|
|
+ runtime_printf ("fp %X\n", m->sc_regs[15]);
|
|
+ runtime_printf ("a0 %X\n", m->sc_regs[16]);
|
|
+ runtime_printf ("a1 %X\n", m->sc_regs[17]);
|
|
+ runtime_printf ("a2 %X\n", m->sc_regs[18]);
|
|
+ runtime_printf ("a3 %X\n", m->sc_regs[19]);
|
|
+ runtime_printf ("a4 %X\n", m->sc_regs[20]);
|
|
+ runtime_printf ("a5 %X\n", m->sc_regs[21]);
|
|
+ runtime_printf ("t8 %X\n", m->sc_regs[22]);
|
|
+ runtime_printf ("t9 %X\n", m->sc_regs[23]);
|
|
+ runtime_printf ("t10 %X\n", m->sc_regs[24]);
|
|
+ runtime_printf ("t11 %X\n", m->sc_regs[25]);
|
|
+ runtime_printf ("ra %X\n", m->sc_regs[26]);
|
|
+ runtime_printf ("t12 %X\n", m->sc_regs[27]);
|
|
+ runtime_printf ("at %X\n", m->sc_regs[28]);
|
|
+ runtime_printf ("gp %X\n", m->sc_regs[29]);
|
|
+ runtime_printf ("sp %X\n", m->sc_regs[30]);
|
|
+ runtime_printf ("pc %X\n", m->sc_pc);
|
|
+ }
|
|
#elif defined(__PPC__) && defined(__linux__)
|
|
{
|
|
int i;
|
|
--
|
|
2.25.1
|
|
|