Bug#1069166: runc: add loong64 build supoort

2024-04-17 Thread chenguoqi

Package: runc
Version: 1.1.12+ds1-2
Severity: wishlist
Tags: patch
User: debian-loonga...@lists.debian.org
Usertags: loong64

Hi,

The Golang package on Loong64 has been built and is working properly, so the 
runc package can be built.
However, the following error occurred:
/Github. com/opencontainers/runc/libcontainer#Github. com/opencontainers/runc/libcontainerSrc/github. com/opencontainers/runc/libcontainer/inittlinux. go: 
415:19: undefined: system SetgidSrc/github. com/opencontainers/runc/libcontainer/inittlinux. go: 
418:19: undefined: system Setuid/






--
Guoqi Chen

>From 10c19dffb9dc2121a3d5d6b8e8ee905fbe11c012 Mon Sep 17 00:00:00 2001
From: Guoqi Chen 
Date: Wed, 17 Apr 2024 08:16:06 +
Subject: [PATCH] libcontainer: add loong64 build support.

Signed-off-by: Guoqi Chen 
---
 libcontainer/nsenter/cloned_binary.c| 2 +-
 libcontainer/system/syscall_linux_64.go | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libcontainer/nsenter/cloned_binary.c b/libcontainer/nsenter/cloned_binary.c
index d1b2d4c..88f3255 100644
--- a/libcontainer/nsenter/cloned_binary.c
+++ b/libcontainer/nsenter/cloned_binary.c
@@ -73,7 +73,7 @@
 #  define SYS_memfd_create 1340
 #elif defined(__arm__)
 #  define SYS_memfd_create 385
-#elif defined(__aarch64__)
+#elif defined(__aarch64__) || defined(__loongarch64)
 #  define SYS_memfd_create 279
 #elif defined(__ppc__) || defined(__PPC64__) || defined(__powerpc64__)
 #  define SYS_memfd_create 360
diff --git a/libcontainer/system/syscall_linux_64.go b/libcontainer/system/syscall_linux_64.go
index 1ed0dba..262450a 100644
--- a/libcontainer/system/syscall_linux_64.go
+++ b/libcontainer/system/syscall_linux_64.go
@@ -1,6 +1,6 @@
-//go:build linux && (arm64 || amd64 || mips || mipsle || mips64 || mips64le || ppc || ppc64 || ppc64le || riscv64 || s390x)
+//go:build linux && (arm64 || amd64 || loong64 || mips || mipsle || mips64 || mips64le || ppc || ppc64 || ppc64le || riscv64 || s390x)
 // +build linux
-// +build arm64 amd64 mips mipsle mips64 mips64le ppc ppc64 ppc64le riscv64 s390x
+// +build arm64 amd64 loong64 mips mipsle mips64 mips64le ppc ppc64 ppc64le riscv64 s390x
 
 package system
 
-- 
2.43.0



Bug#1055087: golang-1.21: Add support for loong64

2024-01-07 Thread chenguoqi
On Sun, 7 Jan 2024 03:50:13 +0800 Shengjing Zhu wrote:
> On Tue, Oct 31, 2023 at 4:39 PM chenguoqi wrote:
> >
> > 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.
> >
>
> Could you look at the failures when bootstrapping Go 1.22?
> https://buildd.debian.org/status/fetch.php?pkg=golang-1.22=loong64=1.22%7Erc1-2=170456=0
>
> --
> Shengjing Zhu
>

Hi, Shengjing Zhu:
This error is caused by the missing file 
/usr/include/loongarch64-linux-gnu/asm/errno.h in the build environment.
This file is  provided by the package linux-libc-dev. I checked the latest 
linux-libc -dev, this header file is already included,
just reinstall linux-libc-dev to solve this error.


--

Best regards,
Guoqi Chen


本邮件及其附件含有龙芯中科的商业秘密信息,仅限于发送给上面地址中列出的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制或散发)本邮件及其附件中的信息。如果您错收本邮件,请您立即电话或邮件通知发件人并删除本邮件。
 
This email and its attachments contain confidential information from Loongson 
Technology , which is intended only for the person or entity whose address is 
listed above. Any use of the information contained herein in any way 
(including, but not limited to, total or partial disclosure, reproduction or 
dissemination) by persons other than the intended recipient(s) is prohibited. 
If you receive this email in error, please notify the sender by phone or email 
immediately and delete it. 

Bug#1055087: golang-1.21: Add support for loong64

2023-10-31 Thread chenguoqi

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
+++