mirror of
https://github.com/thead-yocto-mirror/meta-riscv
synced 2026-06-21 08:52:24 +02:00
ltp: Make 64bit time_t futex patch generic
This fixed build on glibc/rv32 as well Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
From a20107ab47554798e0de0347dd4d7259f01675af Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Sun, 15 Nov 2020 16:33:45 -0800
|
||||
Subject: [PATCH] Define SYS_futex on 32bit arches using 64-bit time_t
|
||||
|
||||
Newer 32bit arches like RISCV32 and ARC are using 64bit time_t
|
||||
from get go unlike other 32bit architecture therefore aliasing __NR_futex to
|
||||
__NR_futex_time64 helps avoid the below errors
|
||||
|
||||
tst_checkpoint.c:99:17: error: use of undeclared identifier 'SYS_futex'
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
[ moved definitions to lapi/futex.h ]
|
||||
Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
|
||||
---
|
||||
include/lapi/futex.h | 4 ++++
|
||||
testcases/kernel/syscalls/clone/clone08.c | 1 +
|
||||
2 files changed, 5 insertions(+)
|
||||
|
||||
diff --git a/include/lapi/futex.h b/include/lapi/futex.h
|
||||
index 72209e4c98..00b26c3559 100644
|
||||
--- a/include/lapi/futex.h
|
||||
+++ b/include/lapi/futex.h
|
||||
@@ -10,4 +10,8 @@
|
||||
|
||||
typedef volatile uint32_t futex_t;
|
||||
|
||||
+#if !defined(SYS_futex) && defined(SYS_futex_time64)
|
||||
+#define SYS_futex SYS_futex_time64
|
||||
+#endif
|
||||
+
|
||||
#endif /* LAPI_FUTEX_H__ */
|
||||
diff --git a/testcases/kernel/syscalls/clone/clone08.c b/testcases/kernel/syscalls/clone/clone08.c
|
||||
index 8e115b0421..3de1fe9bbd 100644
|
||||
--- a/testcases/kernel/syscalls/clone/clone08.c
|
||||
+++ b/testcases/kernel/syscalls/clone/clone08.c
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "tst_test.h"
|
||||
#include "clone_platform.h"
|
||||
#include "lapi/syscalls.h"
|
||||
+#include "lapi/futex.h"
|
||||
|
||||
static pid_t ptid, ctid, tgid;
|
||||
static void *child_stack;
|
||||
@@ -1,66 +0,0 @@
|
||||
From 39c985e3f03c9c7d361c2fa3dcbe8104a868d959 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Tue, 28 Apr 2020 20:30:56 -0700
|
||||
Subject: [PATCH] Define __NR_futex to be __NR_futex_time64 on riscv32
|
||||
|
||||
RISCV glibc has decided to use 64bit time_t from get go unlike
|
||||
other 32bit architecture therefore aliasing __NR_futex to
|
||||
__NR_futex_time64 helps avoid the below errors on rv32
|
||||
|
||||
tst_checkpoint.c:99:17: error: use of undeclared identifier 'SYS_futex'
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
lib/tst_checkpoint.c | 4 ++++
|
||||
testcases/kernel/syscalls/clone/clone08.c | 4 ++++
|
||||
testcases/kernel/syscalls/futex/futextest.h | 4 ++++
|
||||
3 files changed, 12 insertions(+)
|
||||
|
||||
diff --git a/lib/tst_checkpoint.c b/lib/tst_checkpoint.c
|
||||
index 5e5b11496c..0388e9db2f 100644
|
||||
--- a/lib/tst_checkpoint.c
|
||||
+++ b/lib/tst_checkpoint.c
|
||||
@@ -21,6 +21,10 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
+#if !defined(__NR_futex) && defined(__riscv) && __riscv_xlen == 32
|
||||
+# define __NR_futex __NR_futex_time64
|
||||
+#endif
|
||||
+
|
||||
#include <stdint.h>
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
diff --git a/testcases/kernel/syscalls/clone/clone08.c b/testcases/kernel/syscalls/clone/clone08.c
|
||||
index aace308068..85a2bd9246 100644
|
||||
--- a/testcases/kernel/syscalls/clone/clone08.c
|
||||
+++ b/testcases/kernel/syscalls/clone/clone08.c
|
||||
@@ -5,6 +5,10 @@
|
||||
* Author: Zeng Linggang <zenglg.jy@cn.fujitsu.com>
|
||||
*/
|
||||
|
||||
+#if !defined(__NR_futex) && defined(__riscv) && __riscv_xlen == 32
|
||||
+# define __NR_futex __NR_futex_time64
|
||||
+#endif
|
||||
+
|
||||
#define _GNU_SOURCE
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
diff --git a/testcases/kernel/syscalls/futex/futextest.h b/testcases/kernel/syscalls/futex/futextest.h
|
||||
index 5754d36dae..59d877e30f 100644
|
||||
--- a/testcases/kernel/syscalls/futex/futextest.h
|
||||
+++ b/testcases/kernel/syscalls/futex/futextest.h
|
||||
@@ -34,6 +34,10 @@
|
||||
#ifndef _FUTEXTEST_H
|
||||
#define _FUTEXTEST_H
|
||||
|
||||
+#if !defined(__NR_futex) && defined(__riscv) && __riscv_xlen == 32
|
||||
+# define __NR_futex __NR_futex_time64
|
||||
+#endif
|
||||
+
|
||||
#include <unistd.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <sys/types.h>
|
||||
--
|
||||
2.26.2
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
|
||||
|
||||
SRC_URI_append_riscv32 = " file://0001-Define-__NR_futex-to-be-__NR_futex_time64-on-riscv32.patch"
|
||||
SRC_URI_append_riscv32 = " file://0001-Define-SYS_futex-on-32bit-arches-using-64-bit-time_t.patch"
|
||||
|
||||
Reference in New Issue
Block a user