Source: click
Severity: normal
Tags: patch
User: debian-loonga...@lists.debian.org
Usertags: loong64
X-Debbugs-Cc: wuruil...@loongson.cn

Dear Maintainer,

click failed to test on loongarch platform, please refer to the attached patch 
to fix the error.

-- 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 ad41a4ef425dcc65692d272d4589552ebfc6d933 Mon Sep 17 00:00:00 2001
From: wuruilong <wuruil...@loongson.cn>
Date: Wed, 27 Mar 2024 06:13:07 +0000
Subject: [PATCH] add support for loongarch

---
 configure.ac           |  2 ++
 preload/clickpreload.c | 18 ++++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/configure.ac b/configure.ac
index ff69711..fca64bb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -57,6 +57,8 @@ AS_IF([test "${DBUS_TEST_RUNNER_CHECK}" != "yes"], 
[AC_MSG_ERROR([dbus-test-runn
 AC_CHECK_PROG(GDBUS_CHECK,gdbus,yes)
 AS_IF([test "${GDBUS_CHECK}" != "yes"], [AC_MSG_ERROR([gdbus (glib) not 
found])])
 
+AC_CHECK_FUNC(__xmknod __xstat __xstat64)
+
 # Structure characteristics needed for the Python/C integration in the test
 # suite.
 AC_COMPUTE_INT([STAT_OFFSET_UID], [offsetof(struct stat, st_uid)], [
diff --git a/preload/clickpreload.c b/preload/clickpreload.c
index 2799bff..2c564ab 100644
--- a/preload/clickpreload.c
+++ b/preload/clickpreload.c
@@ -60,9 +60,15 @@ static int (*libc_open) (const char *, int, ...) = (void *) 
0;
 static int (*libc_open64) (const char *, int, ...) = (void *) 0;
 #endif
 static int (*libc_symlink) (const char *, const char *) = (void *) 0;
+#ifdef HAVE___XMKNOD
 static int (*libc___xmknod) (int, const char *, mode_t, dev_t *) = (void *) 0;
+#endif
+#ifdef HAVE___XSTAT
 static int (*libc___xstat) (int, const char *, struct stat *) = (void *) 0;
+#endif
+#ifdef HAVE___XSTAT64
 static int (*libc___xstat64) (int, const char *, struct stat64 *) = (void *) 0;
+#endif
 static int (*libc_stat) (const char *, struct stat *) = (void *) 0;
 #ifdef __GLIBC__
 static int (*libc_stat64) (const char *, struct stat64 *) = (void *) 0;
@@ -125,9 +131,15 @@ static void __attribute__ ((constructor)) 
clickpreload_init (void)
     GET_NEXT_SYMBOL (open64);
 #endif
     GET_NEXT_SYMBOL (symlink);
+#ifdef HAVE___XMKNOD
     GET_NEXT_SYMBOL (__xmknod);
+#endif
+#ifdef HAVE___XSTAT
     GET_NEXT_SYMBOL (__xstat);
+#endif
+#ifdef HAVE___XSTAT64
     GET_NEXT_SYMBOL (__xstat64);
+#endif
     GET_NEXT_SYMBOL (stat);
 #ifdef __GLIBC__
     GET_NEXT_SYMBOL (stat64);
@@ -430,6 +442,7 @@ int open64 (const char *pathname, int flags, ...)
 }
 #endif
 
+#ifdef HAVE___XMKNOD
 int __xmknod (int ver, const char *pathname, mode_t mode, dev_t *dev)
 {
     if (!libc___xmknod)
@@ -438,7 +451,9 @@ int __xmknod (int ver, const char *pathname, mode_t mode, 
dev_t *dev)
     clickpreload_assert_path_in_instdir ("mknod", pathname);
     return (*libc___xmknod) (ver, pathname, mode, dev);
 }
+#endif
 
+#ifdef HAVE___XSTAT
 int __xstat (int ver, const char *pathname, struct stat *buf)
 {
     if (!libc___xstat)
@@ -449,7 +464,9 @@ int __xstat (int ver, const char *pathname, struct stat 
*buf)
 
     return (*libc___xstat) (ver, pathname, buf);
 }
+#endif
 
+#ifdef HAVE___XSTAT64
 int __xstat64 (int ver, const char *pathname, struct stat64 *buf)
 {
     if (!libc___xstat64)
@@ -460,6 +477,7 @@ int __xstat64 (int ver, const char *pathname, struct stat64 
*buf)
 
     return (*libc___xstat64) (ver, pathname, buf);
 }
+#endif
 
 int stat(const char * pathname, struct stat * buf)
 {
-- 
2.43.0

Reply via email to