Your message dated Tue, 07 May 2024 20:50:44 +0000
with message-id <[email protected]>
and subject line Bug#1069002: fixed in purelibc 1.0.8-1
has caused the Debian Bug report #1069002,
regarding purelibc: please add support for loong64
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
1069002: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1069002
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Source: purelibc
Severity: normal
X-Debbugs-Cc: [email protected]

Dear Maintainer,

purelibc failed to compile on loongarch, upstream has added support for 
loongarch, 
please refer to the attached patch or upgrade the software version to solve the 
problem. 
The link to the upstream commit code is as follows: 
https://github.com/virtualsquare/purelibc/commit/6df6bd54f40205e4a79115f49ad01dd080d5886c
https://github.com/virtualsquare/purelibc/commit/4d22452b569b5aa47ec44d8f66d1e36c8e0fcd45
https://github.com/virtualsquare/purelibc/commit/278dac7ea75df7df561daaec4c2ad746cbed901c

wuruilong

-- System Information:
Debian Release: trixie/sid
  APT prefers unreleased
  APT policy: (500, 'unreleased'), (500, 'unstable')
Architecture: loong64 (loongarch64)

Kernel: Linux 5.10.0-60.96.0.126.oe2203.loongarch64 (SMP w/32 CPU threads)
Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: unable to detect
>From 6df6bd54f40205e4a79115f49ad01dd080d5886c Mon Sep 17 00:00:00 2001
From: Renzo Davoli <[email protected]>
Date: Tue, 3 Oct 2023 11:58:04 +0200
Subject: [PATCH 1/3] syscall: support archs without fstat

---
 syscalls.c | 42 ++++++++++++++++++++++++++++++++----------
 1 file changed, 32 insertions(+), 10 deletions(-)

diff --git a/syscalls.c b/syscalls.c
index cf5e4c7..fea7463 100644
--- a/syscalls.c
+++ b/syscalls.c
@@ -213,13 +213,19 @@ int dup3(int oldfd, int newfd, int flags){
 
 #if __WORDSIZE == 64 || defined(__ILP32__)
 # if defined(__NR_FSTATAT64) && ! defined(__NR_stat)
-#  define __USE_FSTATAT64
+#  define __USE_NEWSTAT64_STAT
+# endif
+# if defined(__NR_FSTATAT64) && ! defined(__NR_fstat)
+#  define __USE_NEWSTAT64_FSTAT
 # endif
 #      define arch_stat64 stat
 #      define IFNOT64(x)
 #else
 # if defined(__NR_FSTATAT64) && ! defined(__NR_stat64)
-#  define __USE_FSTATAT64
+#  define __USE_NEWSTAT64_STAT
+# endif
+# if defined(__NR_FSTATAT64) && ! defined(__NR_fstat64)
+#  define __USE_NEWSTAT64_FSTAT
 # endif
 #      define arch_stat64 stat64
 #      define IFNOT64(x) x
@@ -256,7 +262,7 @@ int stat(const char* pathname, struct stat* buf_stat)
        IFNOT64(struct stat64 *buf_stat64 = alloca(sizeof(struct stat64)));
                int rv;
 
-#ifdef __USE_FSTATAT64
+#ifdef __USE_NEWSTAT64_STAT
        rv = _pure_syscall(__NR_FSTATAT64, AT_FDCWD, pathname, MAKE_NAME(buf_, 
arch_stat64), 0);
 #else
        rv = _pure_syscall(MAKE_NAME(__NR_, arch_stat64), pathname, 
MAKE_NAME(buf_, arch_stat64));
@@ -272,7 +278,7 @@ int lstat(const char* pathname, struct stat* buf_stat)
        IFNOT64(struct stat64 *buf_stat64 = alloca(sizeof(struct stat64)));
                int rv;
 
-#ifdef __USE_FSTATAT64
+#ifdef __USE_NEWSTAT64_STAT
        rv = _pure_syscall(__NR_FSTATAT64, AT_FDCWD, pathname, MAKE_NAME(buf_, 
arch_stat64), AT_SYMLINK_NOFOLLOW);
 #else
        rv = _pure_syscall(MAKE_NAME(__NR_l, arch_stat64), pathname, 
MAKE_NAME(buf_, arch_stat64));
@@ -287,7 +293,11 @@ int fstat(int fildes, struct stat* buf_stat)
 {
        IFNOT64(struct stat64 *buf_stat64 = alloca(sizeof(struct stat64)));
                int rv;
+#ifdef __USE_NEWSTAT64_FSTAT
+       rv = _pure_syscall(__NR_FSTATAT64, fildes, "", MAKE_NAME(buf_, 
arch_stat64), AT_EMPTY_PATH);
+#else
        rv = _pure_syscall(MAKE_NAME(__NR_f, arch_stat64), fildes, 
MAKE_NAME(buf_, arch_stat64));
+#endif
        if (rv >= 0)
                arch_stat64_2_stat(MAKE_NAME(buf_, arch_stat64), buf_stat);
 
@@ -295,7 +305,7 @@ int fstat(int fildes, struct stat* buf_stat)
 }
 
 int stat64(const char* pathname,struct stat64* buf){
-#ifdef __USE_FSTATAT64
+#ifdef __USE_NEWSTAT64_STAT
        return _pure_syscall(__NR_FSTATAT64, AT_FDCWD, pathname, buf, 0);
 #else
        return _pure_syscall(MAKE_NAME(__NR_, arch_stat64), pathname, buf);
@@ -303,7 +313,7 @@ int stat64(const char* pathname,struct stat64* buf){
 }
 
 int lstat64(const char* pathname,struct stat64* buf){
-#ifdef __USE_FSTATAT64
+#ifdef __USE_NEWSTAT64_STAT
   return _pure_syscall(__NR_FSTATAT64, AT_FDCWD, pathname, buf, 
AT_SYMLINK_NOFOLLOW);
 #else
   return _pure_syscall(MAKE_NAME(__NR_l, arch_stat64), pathname, buf);
@@ -311,7 +321,11 @@ int lstat64(const char* pathname,struct stat64* buf){
 }
 
 int fstat64 (int fildes, struct stat64 *buf){
+#ifdef __USE_NEWSTAT64_FTAT
+  return _pure_syscall(__NR_FSTATAT64, fildes, "", buf, AT_EMPTY_PATH);
+#else
   return _pure_syscall(MAKE_NAME(__NR_f, arch_stat64), fildes, buf);
+#endif
 }
 
 int mknod(const char *pathname, mode_t mode, dev_t dev) {
@@ -331,7 +345,7 @@ int __xstat(int ver, const char* pathname, struct stat* 
buf_stat)
        switch(ver)
        {
                case _STAT_VER_LINUX:
-#ifdef __USE_FSTATAT64
+#ifdef __USE_NEWSTAT64_STAT
                        rv = _pure_syscall(__NR_FSTATAT64, AT_FDCWD, pathname, 
MAKE_NAME(buf_, arch_stat64), 0);
 #else
                        rv = _pure_syscall(MAKE_NAME(__NR_, arch_stat64), 
pathname, MAKE_NAME(buf_, arch_stat64));
@@ -357,7 +371,7 @@ int __lxstat(int ver, const char* pathname, struct stat* 
buf_stat)
        switch(ver)
        {
                case _STAT_VER_LINUX:
-#ifdef __USE_FSTATAT64
+#ifdef __USE_NEWSTAT64_STAT
                        rv = _pure_syscall(__NR_FSTATAT64, AT_FDCWD, pathname, 
MAKE_NAME(buf_, arch_stat64), AT_SYMLINK_NOFOLLOW);
 #else
                        rv = _pure_syscall(MAKE_NAME(__NR_l, arch_stat64), 
pathname, MAKE_NAME(buf_, arch_stat64));
@@ -382,7 +396,11 @@ int __fxstat(int ver, int fildes, struct stat* buf_stat)
        switch(ver)
        {
                case _STAT_VER_LINUX:
+#ifdef __USE_NEWSTAT64_FSTAT
+                       rv = _pure_syscall(__NR_FSTATAT64, fildes, "", 
MAKE_NAME(buf_, arch_stat64), AT_EMPTY_PATH);
+#else
                        rv = _pure_syscall(MAKE_NAME(__NR_f, arch_stat64), 
fildes, MAKE_NAME(buf_, arch_stat64));
+#endif
                        break;
 
                default:
@@ -396,7 +414,7 @@ int __fxstat(int ver, int fildes, struct stat* buf_stat)
 }
 
 int __xstat64(int ver,const char* pathname,struct stat64* buf){
-#ifdef __USE_FSTATAT64
+#ifdef __USE_NEWSTAT64_STAT
        return _pure_syscall(__NR_FSTATAT64, AT_FDCWD, pathname, buf, 0);
 #else
        return _pure_syscall(MAKE_NAME(__NR_, arch_stat64), pathname, buf);
@@ -404,7 +422,7 @@ int __xstat64(int ver,const char* pathname,struct stat64* 
buf){
 }
 
 int __lxstat64(int ver,const char* pathname,struct stat64* buf){
-#ifdef __USE_FSTATAT64
+#ifdef __USE_NEWSTAT64_STAT
        return _pure_syscall(__NR_FSTATAT64, AT_FDCWD, pathname, buf,   
AT_SYMLINK_NOFOLLOW);
 #else
        return _pure_syscall(MAKE_NAME(__NR_l, arch_stat64), pathname, buf);
@@ -412,7 +430,11 @@ int __lxstat64(int ver,const char* pathname,struct stat64* 
buf){
 }
 
 int __fxstat64 (int ver, int fildes, struct stat64 *buf){
+#ifdef __USE_NEWSTAT64_FSTAT
+       return _pure_syscall(__NR_FSTATAT64, fildes, "", buf,   AT_EMPTY_PATH);
+#else
        return _pure_syscall(MAKE_NAME(__NR_f, arch_stat64), fildes, buf);
+#endif
 }
 
 #ifdef __NR_FSTATAT64
-- 
2.43.0

>From 4d22452b569b5aa47ec44d8f66d1e36c8e0fcd45 Mon Sep 17 00:00:00 2001
From: Renzo Davoli <[email protected]>
Date: Tue, 3 Oct 2023 12:20:09 +0200
Subject: [PATCH 2/3] syscall: support for archs using statx for all
 stat/lstat/fstat etc.

---
 syscalls.c | 76 ++++++++++++++++++++++++++++++++++++++----------------
 1 file changed, 54 insertions(+), 22 deletions(-)

diff --git a/syscalls.c b/syscalls.c
index fea7463..8e979b1 100644
--- a/syscalls.c
+++ b/syscalls.c
@@ -45,6 +45,7 @@
 #include <sys/timeb.h>
 #include <sys/mman.h>
 #include <sys/epoll.h>
+#include <sys/sysmacros.h>
 #include <bits/wordsize.h>
 #include <utime.h>
 #include <stdarg.h>
@@ -211,6 +212,37 @@ int dup3(int oldfd, int newfd, int flags){
 #define __NR_FSTATAT64 __NR_newfstatat
 #endif
 
+#if defined(__NR_statx) && ! defined(__NR_FSTATAT64)
+       #define __NR_FSTATAT64 __NR_statx
+int __purelibc_newstat64(int dirfd, const char *restrict pathname,
+               struct stat *restrict statbuf, int flags) {
+  struct statx buf[1];
+  int rv = _pure_syscall(__NR_statx, dirfd, pathname, flags, 
STATX_BASIC_STATS, buf);
+  if (rv == 0) {
+    statbuf->st_dev = makedev(buf->stx_dev_major, buf->stx_dev_minor);
+    statbuf->st_ino = buf->stx_ino;
+    statbuf->st_mode = buf->stx_mode;
+    statbuf->st_nlink = buf->stx_nlink;
+    statbuf->st_uid = buf->stx_uid;
+    statbuf->st_gid = buf->stx_gid;
+    statbuf->st_rdev = makedev(buf->stx_rdev_major, buf->stx_rdev_minor);
+    statbuf->st_size = buf->stx_size;
+    statbuf->st_blksize = buf->stx_blksize;
+    statbuf->st_blocks = buf->stx_blocks;
+    statbuf->st_atim.tv_sec = buf->stx_atime.tv_sec;
+    statbuf->st_atim.tv_nsec = buf->stx_atime.tv_nsec;
+    statbuf->st_mtim.tv_sec = buf->stx_mtime.tv_sec;
+    statbuf->st_mtim.tv_nsec = buf->stx_mtime.tv_nsec;
+    statbuf->st_ctim.tv_sec = buf->stx_ctime.tv_sec;
+    statbuf->st_ctim.tv_nsec = buf->stx_ctime.tv_nsec;
+  }
+  return rv;
+}
+#else
+       #define __purelibc_newstat64(dirfd, pathname, statbuf, flags) \
+               _pure_syscall(__NR_FSTATAT64, (dirfd), (pathname), (statbuf), 
(flags))
+#endif
+
 #if __WORDSIZE == 64 || defined(__ILP32__)
 # if defined(__NR_FSTATAT64) && ! defined(__NR_stat)
 #  define __USE_NEWSTAT64_STAT
@@ -263,7 +295,7 @@ int stat(const char* pathname, struct stat* buf_stat)
                int rv;
 
 #ifdef __USE_NEWSTAT64_STAT
-       rv = _pure_syscall(__NR_FSTATAT64, AT_FDCWD, pathname, MAKE_NAME(buf_, 
arch_stat64), 0);
+       rv = __purelibc_newstat64(AT_FDCWD, pathname, MAKE_NAME(buf_, 
arch_stat64), 0);
 #else
        rv = _pure_syscall(MAKE_NAME(__NR_, arch_stat64), pathname, 
MAKE_NAME(buf_, arch_stat64));
 #endif
@@ -279,7 +311,7 @@ int lstat(const char* pathname, struct stat* buf_stat)
                int rv;
 
 #ifdef __USE_NEWSTAT64_STAT
-       rv = _pure_syscall(__NR_FSTATAT64, AT_FDCWD, pathname, MAKE_NAME(buf_, 
arch_stat64), AT_SYMLINK_NOFOLLOW);
+       rv = __purelibc_newstat64(AT_FDCWD, pathname, MAKE_NAME(buf_, 
arch_stat64), AT_SYMLINK_NOFOLLOW);
 #else
        rv = _pure_syscall(MAKE_NAME(__NR_l, arch_stat64), pathname, 
MAKE_NAME(buf_, arch_stat64));
 #endif
@@ -294,7 +326,7 @@ int fstat(int fildes, struct stat* buf_stat)
        IFNOT64(struct stat64 *buf_stat64 = alloca(sizeof(struct stat64)));
                int rv;
 #ifdef __USE_NEWSTAT64_FSTAT
-       rv = _pure_syscall(__NR_FSTATAT64, fildes, "", MAKE_NAME(buf_, 
arch_stat64), AT_EMPTY_PATH);
+       rv = __purelibc_newstat64(fildes, "", MAKE_NAME(buf_, arch_stat64), 
AT_EMPTY_PATH);
 #else
        rv = _pure_syscall(MAKE_NAME(__NR_f, arch_stat64), fildes, 
MAKE_NAME(buf_, arch_stat64));
 #endif
@@ -306,7 +338,7 @@ int fstat(int fildes, struct stat* buf_stat)
 
 int stat64(const char* pathname,struct stat64* buf){
 #ifdef __USE_NEWSTAT64_STAT
-       return _pure_syscall(__NR_FSTATAT64, AT_FDCWD, pathname, buf, 0);
+       return __purelibc_newstat64(AT_FDCWD, pathname, buf, 0);
 #else
        return _pure_syscall(MAKE_NAME(__NR_, arch_stat64), pathname, buf);
 #endif
@@ -314,15 +346,15 @@ int stat64(const char* pathname,struct stat64* buf){
 
 int lstat64(const char* pathname,struct stat64* buf){
 #ifdef __USE_NEWSTAT64_STAT
-  return _pure_syscall(__NR_FSTATAT64, AT_FDCWD, pathname, buf, 
AT_SYMLINK_NOFOLLOW);
+  return __purelibc_newstat64(AT_FDCWD, pathname, buf, AT_SYMLINK_NOFOLLOW);
 #else
   return _pure_syscall(MAKE_NAME(__NR_l, arch_stat64), pathname, buf);
 #endif
 }
 
 int fstat64 (int fildes, struct stat64 *buf){
-#ifdef __USE_NEWSTAT64_FTAT
-  return _pure_syscall(__NR_FSTATAT64, fildes, "", buf, AT_EMPTY_PATH);
+#ifdef __USE_NEWSTAT64_FSTAT
+  return __purelibc_newstat64(fildes, "", buf, AT_EMPTY_PATH);
 #else
   return _pure_syscall(MAKE_NAME(__NR_f, arch_stat64), fildes, buf);
 #endif
@@ -346,7 +378,7 @@ int __xstat(int ver, const char* pathname, struct stat* 
buf_stat)
        {
                case _STAT_VER_LINUX:
 #ifdef __USE_NEWSTAT64_STAT
-                       rv = _pure_syscall(__NR_FSTATAT64, AT_FDCWD, pathname, 
MAKE_NAME(buf_, arch_stat64), 0);
+                       rv = __purelibc_newstat64(AT_FDCWD, pathname, 
MAKE_NAME(buf_, arch_stat64), 0);
 #else
                        rv = _pure_syscall(MAKE_NAME(__NR_, arch_stat64), 
pathname, MAKE_NAME(buf_, arch_stat64));
 #endif
@@ -372,7 +404,7 @@ int __lxstat(int ver, const char* pathname, struct stat* 
buf_stat)
        {
                case _STAT_VER_LINUX:
 #ifdef __USE_NEWSTAT64_STAT
-                       rv = _pure_syscall(__NR_FSTATAT64, AT_FDCWD, pathname, 
MAKE_NAME(buf_, arch_stat64), AT_SYMLINK_NOFOLLOW);
+                       rv = __purelibc_newstat64(AT_FDCWD, pathname, 
MAKE_NAME(buf_, arch_stat64), AT_SYMLINK_NOFOLLOW);
 #else
                        rv = _pure_syscall(MAKE_NAME(__NR_l, arch_stat64), 
pathname, MAKE_NAME(buf_, arch_stat64));
 #endif
@@ -397,7 +429,7 @@ int __fxstat(int ver, int fildes, struct stat* buf_stat)
        {
                case _STAT_VER_LINUX:
 #ifdef __USE_NEWSTAT64_FSTAT
-                       rv = _pure_syscall(__NR_FSTATAT64, fildes, "", 
MAKE_NAME(buf_, arch_stat64), AT_EMPTY_PATH);
+                       rv = __purelibc_newstat64(fildes, "", MAKE_NAME(buf_, 
arch_stat64), AT_EMPTY_PATH);
 #else
                        rv = _pure_syscall(MAKE_NAME(__NR_f, arch_stat64), 
fildes, MAKE_NAME(buf_, arch_stat64));
 #endif
@@ -415,7 +447,7 @@ int __fxstat(int ver, int fildes, struct stat* buf_stat)
 
 int __xstat64(int ver,const char* pathname,struct stat64* buf){
 #ifdef __USE_NEWSTAT64_STAT
-       return _pure_syscall(__NR_FSTATAT64, AT_FDCWD, pathname, buf, 0);
+       return __purelibc_newstat64(AT_FDCWD, pathname, buf, 0);
 #else
        return _pure_syscall(MAKE_NAME(__NR_, arch_stat64), pathname, buf);
 #endif
@@ -423,7 +455,7 @@ int __xstat64(int ver,const char* pathname,struct stat64* 
buf){
 
 int __lxstat64(int ver,const char* pathname,struct stat64* buf){
 #ifdef __USE_NEWSTAT64_STAT
-       return _pure_syscall(__NR_FSTATAT64, AT_FDCWD, pathname, buf,   
AT_SYMLINK_NOFOLLOW);
+       return __purelibc_newstat64(AT_FDCWD, pathname, buf,    
AT_SYMLINK_NOFOLLOW);
 #else
        return _pure_syscall(MAKE_NAME(__NR_l, arch_stat64), pathname, buf);
 #endif
@@ -431,7 +463,7 @@ int __lxstat64(int ver,const char* pathname,struct stat64* 
buf){
 
 int __fxstat64 (int ver, int fildes, struct stat64 *buf){
 #ifdef __USE_NEWSTAT64_FSTAT
-       return _pure_syscall(__NR_FSTATAT64, fildes, "", buf,   AT_EMPTY_PATH);
+       return __purelibc_newstat64(fildes, "", buf,    AT_EMPTY_PATH);
 #else
        return _pure_syscall(MAKE_NAME(__NR_f, arch_stat64), fildes, buf);
 #endif
@@ -439,7 +471,7 @@ int __fxstat64 (int ver, int fildes, struct stat64 *buf){
 
 #ifdef __NR_FSTATAT64
 int __fxstatat64 (int ver, int dirfd, const char *pathname, struct stat64 
*buf, int flags){
-       return _pure_syscall(__NR_FSTATAT64,dirfd,pathname,buf,flags);
+       return __purelibc_newstat64(dirfd,pathname,buf,flags);
 }
 int __fxstatat(int ver, int fildes, const char *pathname, struct stat* 
buf_stat,int flags)
 {
@@ -448,7 +480,7 @@ int __fxstatat(int ver, int fildes, const char *pathname, 
struct stat* buf_stat,
        switch(ver)
        {
                case _STAT_VER_LINUX:
-                       rv = _pure_syscall(__NR_FSTATAT64, fildes, pathname, 
MAKE_NAME(buf_, arch_stat64), flags);
+                       rv = __purelibc_newstat64(fildes, pathname, 
MAKE_NAME(buf_, arch_stat64), flags);
                        break;
 
                default:
@@ -474,7 +506,7 @@ int __xmknod (int ver, const char *path, mode_t mode, dev_t 
*dev) {
 
 #ifdef __NR_FSTATAT64
 int fstatat(int dirfd, const char *pathname, struct stat *buf, int flags) {
-       return _pure_syscall(__NR_FSTATAT64,dirfd,pathname,buf,flags);
+       return __purelibc_newstat64(dirfd,pathname,buf,flags);
 }
 #endif
 
@@ -634,7 +666,7 @@ ssize_t pread64(int fs,void* buf, size_t count, __off64_t 
offset){
 #if defined(__powerpc__) || defined(__arm__)
                        0,
 #endif
-                       __LONG_LONG_PAIR( 
(__off_t)(offset>>32),(__off_t)(offset&0xffffffff)));
+                       
__LONG_LONG_PAIR((__off_t)(offset>>32),(__off_t)(offset&0xffffffff)));
 }
 ssize_t pread(int fs,void* buf, size_t count, __off_t offset){
        return pread64(fs,buf,count,(__off64_t)offset);
@@ -647,7 +679,7 @@ ssize_t pwrite64(int fs,const void* buf, size_t count, 
__off64_t offset){
 #if defined(__powerpc__) || defined(__arm__)
                        0,
 #endif
-                       __LONG_LONG_PAIR( 
(__off_t)(offset>>32),(__off_t)(offset&0xffffffff)));
+                       
__LONG_LONG_PAIR((__off_t)(offset>>32),(__off_t)(offset&0xffffffff)));
 }
 ssize_t pwrite(int fs,const void* buf, size_t count, __off_t offset){
        return pwrite64(fs,buf,count,(__off64_t)offset);
@@ -661,7 +693,7 @@ ssize_t preadv64(int fs,const struct iovec *iov, int 
iovcnt, __off64_t offset){
 #if defined(__powerpc__) || defined(__arm__)
                        0,
 #endif
-                       __LONG_LONG_PAIR( 
(__off_t)(offset>>32),(__off_t)(offset&0xffffffff))
+                       
__LONG_LONG_PAIR((__off_t)(offset>>32),(__off_t)(offset&0xffffffff))
 #else
                        offset
 #endif
@@ -700,7 +732,7 @@ ssize_t pwritev64(int fs,const struct iovec *iov, int 
iovcnt, __off64_t offset){
 #if defined(__powerpc__) || defined(__arm__)
                        0,
 #endif
-                       __LONG_LONG_PAIR( 
(__off_t)(offset>>32),(__off_t)(offset&0xffffffff))
+                       
__LONG_LONG_PAIR((__off_t)(offset>>32),(__off_t)(offset&0xffffffff))
 #else
                        offset
 #endif
@@ -1284,7 +1316,7 @@ int truncate64(const char *path, __off64_t length){
 #if defined(__powerpc__)
                        0,
 #endif
-                       __LONG_LONG_PAIR( 
(__off_t)(length>>32),(__off_t)(length&0xffffffff)));
+                       
__LONG_LONG_PAIR((__off_t)(length>>32),(__off_t)(length&0xffffffff)));
 }
 #endif
 
@@ -1294,7 +1326,7 @@ int ftruncate64(int fd, __off64_t length){
 #if defined(__powerpc__)
                        0,
 #endif
-                       __LONG_LONG_PAIR( 
(__off_t)(length>>32),(__off_t)(length&0xffffffff)));
+                       
__LONG_LONG_PAIR((__off_t)(length>>32),(__off_t)(length&0xffffffff)));
 }
 #endif
 
-- 
2.43.0

>From 278dac7ea75df7df561daaec4c2ad746cbed901c Mon Sep 17 00:00:00 2001
From: Renzo Davoli <[email protected]>
Date: Wed, 4 Oct 2023 10:28:30 +0200
Subject: [PATCH 3/3] syscall: loongarch compatibility

---
 syscalls.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/syscalls.c b/syscalls.c
index 8e979b1..9027867 100644
--- a/syscalls.c
+++ b/syscalls.c
@@ -1070,7 +1070,7 @@ pid_t fork(void){
                return -1;
        else
                return child_tid;
-#elif defined(__aarch64__) || defined(__riscv) && __riscv_xlen==64
+#elif defined(__aarch64__) || (defined(__riscv) && __riscv_xlen==64) || 
defined(__loongarch__)
        int child_tid;
        if (_pure_syscall(__NR_clone, NULL, 
CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, &child_tid) < 0)
                return -1;
@@ -1120,7 +1120,8 @@ int nice(int inc){
        defined(__alpha__) || defined(__s390x__) || \
        (defined(__mips__) && defined(__LP64__)) || \
        defined(__aarch64__) || \
-       (defined(__riscv) && __riscv_xlen==64)
+       (defined(__riscv) && __riscv_xlen==64) || \
+       defined(__loongarch__)
        int nice = _pure_syscall(__NR_getpriority,PRIO_PROCESS,0);
        return _pure_syscall(__NR_setpriority,PRIO_PROCESS,0,nice + inc);
 #else
@@ -1249,7 +1250,7 @@ int select(int n, fd_set *readfds, fd_set *writefds, 
fd_set *exceptfds, struct t
 #if defined(__x86_64__) || defined(__s390x__) || \
        defined(__alpha__) || defined(__ia64__)
        return _pure_syscall(__NR_select,n,readfds,writefds,exceptfds,timeout);
-#elif defined(__aarch64__) || defined(__riscv) && __riscv_xlen==64
+#elif defined(__aarch64__) || (defined(__riscv) && __riscv_xlen==64) || 
defined(__loongarch__)
        if (timeout == NULL)
                return pselect(n,readfds,writefds,exceptfds,NULL,NULL);
        else {
-- 
2.43.0


--- End Message ---
--- Begin Message ---
Source: purelibc
Source-Version: 1.0.8-1
Done: Mattia Rizzolo <[email protected]>

We believe that the bug you reported is fixed in the latest version of
purelibc, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Mattia Rizzolo <[email protected]> (supplier of updated purelibc package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Tue, 07 May 2024 22:18:19 +0200
Source: purelibc
Architecture: source
Version: 1.0.8-1
Distribution: unstable
Urgency: medium
Maintainer: Debian VirtualSquare Team <[email protected]>
Changed-By: Mattia Rizzolo <[email protected]>
Closes: 1069002 1069452
Changes:
 purelibc (1.0.8-1) unstable; urgency=medium
 .
   * Team upload.
   * Import version 1.0.8.
     + Add support for loong64.  Closes: #1069002
     + Fix FTBFS with __USE_FILE_OFFSET64/__USE_TIME_BITS64 on armhf.
       Closes: #1069452
Checksums-Sha1:
 7a71afa3d2fa3dde3b7181334d17300ecb81f95d 2073 purelibc_1.0.8-1.dsc
 708d6c3f624dfe910cfa0fc2863bc0853c49f05c 27849 purelibc_1.0.8.orig.tar.gz
 fdd8debd6b99d9daaed703a6dea912ace3052cb3 3592 purelibc_1.0.8-1.debian.tar.xz
 1cf6375694c829a607806eb22022da593fc2f85d 7442 purelibc_1.0.8-1_amd64.buildinfo
Checksums-Sha256:
 3e0f99ddf7724c038cd37c8c258ff1288b5863681d664d433cb800debe9825cf 2073 
purelibc_1.0.8-1.dsc
 4c79969cd700e13459f852fa43c978d6d7f4305ad3f32b4280e57ce70a415ac6 27849 
purelibc_1.0.8.orig.tar.gz
 6578fb2382c69eb969eda19ed3d75d002f34b4f212cc427c6ad562fb20016f6d 3592 
purelibc_1.0.8-1.debian.tar.xz
 b8abd2af366a345b4a62cb2fb793bfa17dfb7501f603c5b40e4f336426097786 7442 
purelibc_1.0.8-1_amd64.buildinfo
Files:
 a70ebb9a3562dd5aa2ed5ca85c5cc102 2073 libs optional purelibc_1.0.8-1.dsc
 975b84ab5eeaa027c2e54f7b09af52ba 27849 libs optional purelibc_1.0.8.orig.tar.gz
 8d771aaecada7c37876ad390462647ac 3592 libs optional 
purelibc_1.0.8-1.debian.tar.xz
 7ba2632933f728381fa40437a8b94619 7442 libs optional 
purelibc_1.0.8-1_amd64.buildinfo

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEi3hoeGwz5cZMTQpICBa54Yx2K60FAmY6jcQACgkQCBa54Yx2
K62uYRAAsB7x19fMdRvd4KEH1WAAqGnU/hNQ51XlTffzp7Pcu17QKJF5DKBpQfaK
kw82L6Nqu0UELv3mJDngyG1s+mYAYWshpmOEGjvziLo4Zbw1dO3CdB15KrrJb89D
viNZPdVl2ceqqFXuCOT/CnNe1HU+mVtFWmqMr3RHIxB2W3MOnnGgo/qvTY9ZsCWr
lB8S12N6kxYeK70qQ4So27d6Pk2lri6KJMF38p/ycHvCLgF4T6Ulsmg7syjIG4rw
1o/fwHlskLlOjn0T6BRUZuZwQGkKjcA2Ad4vn5i4na7PukWjv1SRWDamx8XH3bLN
IHmLRuVyY8IE1+TRh4RvQc0P6jiZiGE2vP3ss6SW0ALNnj0zhUh6YL7b2i75n4XD
MSBN4PGurjDdB90YMVU9azVPKLK2bJ3A8NMD3PyAa57wg73vxZAMc99/3ra6Qoyk
kXYOuegG7cuEZDE7bYOsAnf3liNckVbW9o4RHgTLsHF+A4di930zWfN3mAgGSPsA
/G07gM2gctrnXh2kCudd2nliR4QASyZQVVCtINHcMXVGqf8WrSSRxGIvHlU7PLGD
y7e/0KnF7IWOElwj9bTGoUSCCc0Yxy0Bf0YCzDDDy2dLlGT5CxDq7bhWvgrkYl3u
ByLuq8r6MdGfvJ9jE2nodZtFCYpmVG5qbYjl4yN1fQpgq0Gl36E=
=QTio
-----END PGP SIGNATURE-----

Attachment: pgpFpEvyGtgFp.pgp
Description: PGP signature


--- End Message ---

Reply via email to