Source: purelibc
Version: 1.0.5-1
Severity: normal
Tags: ftbfs, patch
User: debian-ri...@lists.debian.org
Usertags: riscv64
X-Debbugs-Cc: debian-ri...@lists.debian.org

Dear purelibc Maintainer,
The package has a ftbfs issue on riscv64:

```
/<<PKGBUILDDIR>>/syscalls.c: In function ‘fork’:
/<<PKGBUILDDIR>>/syscalls.c:1026:30: error: ‘__NR_fork’ undeclared (first use 
in this function)
 1026 |         return _pure_syscall(__NR_fork);
      |                              ^~~~~~~~~
/<<PKGBUILDDIR>>/syscalls.c:1026:30: note: each undeclared identifier is 
reported only once for each function it appears in
/<<PKGBUILDDIR>>/syscalls.c: In function ‘select’:
/<<PKGBUILDDIR>>/syscalls.c:1198:30: error: ‘__NR_select’ undeclared (first use 
in this function)
 1198 |         return 
_pure_syscall(__NR_select,n,readfds,writefds,exceptfds,timeout);
      |                              ^~~~~~~~~~~
/usr/include/unistd.h: In function ‘fork’:
/<<PKGBUILDDIR>>/syscalls.c:1028:1: warning: control reaches end of non-void 
function [-Wreturn-type]
 1028 | }
      | ^
/usr/include/riscv64-linux-gnu/sys/select.h: In function ‘select’:
/<<PKGBUILDDIR>>/syscalls.c:1209:1: warning: control reaches end of non-void 
function [-Wreturn-type]
 1209 | }
```

The full buildd log is here:
https://buildd.debian.org/status/fetch.php?pkg=purelibc&arch=riscv64&ver=1.0.5-1&stamp=1651106695&raw=0

The patch attached is to fix the isssue and I can build riscv64 on
my locally real riscv64 hardware(Unmatched board) with it.

Please review it carefully and let me konw if you need my assistant to
do more tests, thanks.

Bo
-- 
Best Regards,

--- a/syscalls.c
+++ b/syscalls.c
@@ -1016,7 +1016,7 @@
 		return -1;
 	else
 		return child_tid;
-#elif defined(__aarch64__)
+#elif defined(__aarch64__) || defined(__riscv) && __riscv_xlen==64
 	int child_tid;
 	if (_pure_syscall(__NR_clone, NULL, CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, &child_tid) < 0)
 		return -1;
@@ -1193,10 +1193,9 @@
 #ifdef __NR_epoll_create1
 int select(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout){
 #if defined(__x86_64__) || defined(__s390x__) || \
-	defined(__alpha__) || defined(__ia64__) || \
-	(defined(__riscv) && __riscv_xlen==64)
+	defined(__alpha__) || defined(__ia64__) 
 	return _pure_syscall(__NR_select,n,readfds,writefds,exceptfds,timeout);
-#elif defined(__aarch64__)
+#elif defined(__aarch64__) || defined(__riscv) && __riscv_xlen==64
 	if (timeout == NULL)
 		return pselect(n,readfds,writefds,exceptfds,NULL,NULL);
 	else {

Attachment: signature.asc
Description: PGP signature

Reply via email to