Package: golang-1.21
Version: 1.21.3
Severity: wishlist
Tags: patch
User: debian-loonga...@lists.debian.org
Usertags: loong64
Hi,
Golang upstream supports loong64 starting from Go1.19 version, and currently
all dependencies for building golang-1.21 package on debian sid have been
met. Golang-1.21 on loong64 can now be built.
The three backport patches in the attachment are mainly to solve glibc dynamic
linker path errors([1]) and relocation-related errors([2] [3]), otherwise
related
tests may fail.
[1] https://go-review.googlesource.com/c/go/+/526535
[2] https://go-review.googlesource.com/c/go/+/528455
[3] https://go-review.googlesource.com/c/go/+/537615
--
thanks,
Guoqi Chen
>From 5af694637ec9d26dcf94c06a542724b3e15f9ff7 Mon Sep 17 00:00:00 2001
From: Guoqi Chen
Date: Fri, 27 Oct 2023 09:47:52 +
Subject: [PATCH] Add support for loong64
---
debian/control| 2 +-
debian/control.in | 2 +-
debian/helpers/goenv.sh | 2 +-
...l-loong64-correct-the-glibc-dynamic-.patch | 36 +
...l-loadelf-correct-the-relocation-siz.patch | 38 +
...nk-add-additional-relocations-for-lo.patch | 132 ++
debian/patches/series | 4 +
7 files changed, 213 insertions(+), 3 deletions(-)
create mode 100644 debian/patches/0001-cmd-link-internal-loong64-correct-the-glibc-dynamic-.patch
create mode 100644 debian/patches/0002-cmd-link-internal-loadelf-correct-the-relocation-siz.patch
create mode 100644 debian/patches/0003-debug-elf-cmd-link-add-additional-relocations-for-lo.patch
create mode 100644 debian/patches/series
diff --git a/debian/control b/debian/control
index 0fb79d3..426c59d 100644
--- a/debian/control
+++ b/debian/control
@@ -22,7 +22,7 @@ Homepage: https://go.dev/
Rules-Requires-Root: no
Package: golang-1.21-go
-Architecture: amd64 arm64 armel armhf i386 mips mips64el mipsel ppc64 ppc64el riscv64 s390x
+Architecture: amd64 arm64 armel armhf i386 loong64 mips mips64el mipsel ppc64 ppc64el riscv64 s390x
Depends: golang-1.21-src (>= ${source:Version}),
${misc:Depends},
${perl:Depends},
diff --git a/debian/control.in b/debian/control.in
index c65794e..2ef1965 100644
--- a/debian/control.in
+++ b/debian/control.in
@@ -18,7 +18,7 @@ Homepage: https://go.dev/
Rules-Requires-Root: no
Package: golang-X.Y-go
-Architecture: amd64 arm64 armel armhf i386 mips mips64el mipsel ppc64 ppc64el riscv64 s390x
+Architecture: amd64 arm64 armel armhf i386 loong64 mips mips64el mipsel ppc64 ppc64el riscv64 s390x
Depends: golang-X.Y-src (>= ${source:Version}),
${misc:Depends},
${perl:Depends},
diff --git a/debian/helpers/goenv.sh b/debian/helpers/goenv.sh
index 172df51..488537a 100755
--- a/debian/helpers/goenv.sh
+++ b/debian/helpers/goenv.sh
@@ -11,7 +11,7 @@ __goos__deb_arch_os() {
__goarch__deb_arch_cpu() {
case "$1" in
- amd64|arm|arm64|mips|ppc64|riscv64|s390x) echo "$1" ;;
+ amd64|arm|arm64|loong64|mips|ppc64|riscv64|s390x) echo "$1" ;;
i386) echo 386 ;;
mips64el) echo mips64le ;;
mipsel) echo mipsle ;;
diff --git a/debian/patches/0001-cmd-link-internal-loong64-correct-the-glibc-dynamic-.patch b/debian/patches/0001-cmd-link-internal-loong64-correct-the-glibc-dynamic-.patch
new file mode 100644
index 000..3e42a7b
--- /dev/null
+++ b/debian/patches/0001-cmd-link-internal-loong64-correct-the-glibc-dynamic-.patch
@@ -0,0 +1,36 @@
+From 050c02f1f0395c08583588a60d166a0f7562f322 Mon Sep 17 00:00:00 2001
+From: limeidan
+Date: Wed, 6 Sep 2023 17:09:35 +0800
+Subject: [PATCH 1/3] cmd/link/internal/loong64: correct the glibc dynamic
+ linker path.
+
+Ref: https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html#_program_interpreter_path
+
+Change-Id: Ic2598110cc091362cb09f877b6b86433cacf32c6
+Reviewed-on: https://go-review.googlesource.com/c/go/+/526535
+Reviewed-by: Ian Lance Taylor
+Run-TryBot: Ian Lance Taylor
+Auto-Submit: Ian Lance Taylor
+TryBot-Result: Gopher Robot
+Reviewed-by: abner chenc
+Reviewed-by: Cherry Mui
+---
+ src/cmd/link/internal/loong64/obj.go | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/cmd/link/internal/loong64/obj.go b/src/cmd/link/internal/loong64/obj.go
+index c3f6ed9386..fd193a2445 100644
+--- a/src/cmd/link/internal/loong64/obj.go
b/src/cmd/link/internal/loong64/obj.go
+@@ -29,7 +29,7 @@ func Init() (*sys.Arch, ld.Arch) {
+ Gentext: gentext,
+
+ ELF: ld.ELFArch{
+- Linuxdynld: "/lib64/ld.so.1",
++ Linuxdynld: "/lib64/ld-linux-loongarch-lp64d.so.1",
+ LinuxdynldMusl: "/lib64/ld-musl-loongarch.so.1",
+ Freebsddynld: "XXX",
+ Openbsddynld: "XXX",
+--
+2.38.1
+
diff --git a/debian/patches/0002-cmd-link-internal-loadelf-correct-the-relocation-siz.patch b/debian/patches/0002-cmd-link-internal-loadelf-correct-the-relocation-siz.patch
new file mode 100644
index 000..40a2586
--- /dev/null
+++