Skip to contentSkip to conversation

board/qemu/sh4*: Remove linux-headers patch

PATCH New Geoffrey Le Gourriérec 3 participants 6 messages Jan 27, 2021 – Feb 1, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 board/qemu/sh4*: Remove linux-headers patch

Previous patch about time data structures [1] provided a dirty fix that did not solve the real issue.

After discussing with Linux folks on the SuperH mailing list [2], the patch was deemed unnecessary, as the problem lied in uclibc.

[1] https://git.buildroot.net/buildroot/commit/?id=742f37de8d0e3797698411dfc6a63bd7e98aafe2
[2] https://patchwork.kernel.org/project/linux-sh/patch/20210123165652.10884-1-geoffrey.legourrierec at gmail.com/

---
 ....h-and-not-time_types.h-in-sockios.h.patch | 76 -------------------
 ....h-and-not-time_types.h-in-sockios.h.patch | 76 -------------------
 configs/qemu_sh4_r2d_defconfig                |  1 -
 configs/qemu_sh4eb_r2d_defconfig              |  1 -
 4 files changed, 154 deletions(-)
 delete mode 100644 board/qemu/sh4-r2d/patches/linux-headers/0001-Use-types.h-and-not-time_types.h-in-sockios.h.patch
 delete mode 100644 board/qemu/sh4eb-r2d/patches/linux-headers/0001-Use-types.h-and-not-time_types.h-in-sockios.h.patch
board/qemu/sh4-r2d/patches/linux-headers/0001-Use-types.h-and-not-time_types.h-in-sockios.h.patch deleted +0 -76
deleted file mode 100644
index 90bd4e8c6c..0000000000
@@ -1,76 +0,0 @@
-From 34c78b21878ae7b0471299d11a7e861125e31b2c Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Geoffrey=20Le=20Gourri=C3=A9rec?=
- <[email protected]>
-Date: Mon, 18 Jan 2021 23:40:28 +0100
-Subject: [PATCH] Use types.h and not time_types.h in sockios.h
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This fixes builds for sh arch when libc is not using relevant
-time data structures definitions for 32-bit machines. A previous
-commit [1] provided a fix, that we seemed to slip through here.
-
-As of the time of this writing, the bug was found with non-
-up to date uclibc 1.0.37 only (currently the only libc supporting
-sh architecture).
-
-[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=fc94cf2092c7c1267fa2deb8388d624f50eba808
-
-Signed-off-by: Geoffrey Le Gourri?rec <[email protected]>
-Cc: Arnd Bergmann <[email protected]>
-
----
-
-For the record, here's the build-time error:
-
-/usr/bin/make -j2 -C /builds/clumsyape/buildroot/output/build/uclibc-1.0.37 ARCH="sh" CROSS_COMPILE="/builds/clumsyape/buildroot/output/host/bin/sh4-buildroot-linux-uclibc-" UCLIBC_EXTRA_CFLAGS="" HOSTCC="/usr/bin/gcc"
-make[1]: Entering directory '/builds/clumsyape/buildroot/output/build/uclibc-1.0.37'
-  GEN libpthread/nptl/sysdeps/unix/sysv/linux/lowlevelcond.h
-  GEN libpthread/nptl/sysdeps/unix/sysv/linux/lowlevelcond.h
-  GEN libpthread/nptl/sysdeps/unix/sysv/linux/lowlevelrobustlock.h
-  GEN libpthread/nptl/sysdeps/unix/sysv/linux/lowlevelrobustlock.h
-In file included from /builds/clumsyape/buildroot/output/build/linux-headers-5.10.7/usr/include/asm/sockios.h:5,
-                 from /builds/clumsyape/buildroot/output/build/linux-headers-5.10.7/usr/include/asm-generic/socket.h:6,
-                 from /builds/clumsyape/buildroot/output/build/linux-headers-5.10.7/usr/include/asm/socket.h:1,
-                 from ./include/bits/socket.h:360,
-                 from ./include/sys/socket.h:39,
-                 from ./include/netinet/in.h:24,
-                 from ./include/resolv.h:57,
-                 from ./libpthread/nptl/descr.h:36,
-                 from ./libpthread/nptl/pthreadP.h:25,
-                 from <stdin>:2:
-/builds/clumsyape/buildroot/output/build/linux-headers-5.10.7/usr/include/linux/time_types.h:8:2: error: unknown type name '__kernel_time64_t'
-    8 |  __kernel_time64_t       tv_sec;                 /* seconds */
-      |  ^~~~~~~~~~~~~~~~~
-/builds/clumsyape/buildroot/output/build/linux-headers-5.10.7/usr/include/linux/time_types.h:32:2: error: unknown type name '__kernel_old_time_t'
-   32 |  __kernel_old_time_t tv_sec;  /* seconds */
-      |  ^~~~~~~~~~~~~~~~~~~
-libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.commonarch:135: recipe for target 'libpthread/nptl/sysdeps/unix/sysv/linux/lowlevelrobustlock.h' failed
-make[1]: *** [libpthread/nptl/sysdeps/unix/sysv/linux/lowlevelrobustlock.h] Error 1
-make[1]: Leaving directory '/builds/clumsyape/buildroot/output/build/uclibc-1.0.37'
-
-I did a quick header dependency analysis starting from __kernel_time64_t
-(one of the offending types), but could "follow up" to linux/time_types.h
-as expected; so I fail to understand how this could break. What's even
-more confusing is linux/time_types.h includes linux/types.h itself.
----
- arch/sh/include/uapi/asm/sockios.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/arch/sh/include/uapi/asm/sockios.h b/arch/sh/include/uapi/asm/sockios.h
-index ef01ced9e169..d97d14685305 100644
---- a/arch/sh/include/uapi/asm/sockios.h
-+++ b/arch/sh/include/uapi/asm/sockios.h
-@@ -2,7 +2,7 @@
- #ifndef __ASM_SH_SOCKIOS_H
- #define __ASM_SH_SOCKIOS_H
- 
--#include <linux/time_types.h>
-+#include <linux/types.h>
- 
- /* Socket-level I/O control calls. */
- #define FIOGETOWN	_IOR('f', 123, int)
--- 
-2.17.1
-
board/qemu/sh4eb-r2d/patches/linux-headers/0001-Use-types.h-and-not-time_types.h-in-sockios.h.patch deleted +0 -76

76 lines not on this page · raw message

configs/qemu_sh4_r2d_defconfig +0 -1
index 395e0fc849..a14277dd05 100644
@@ -3,7 +3,6 @@ BR2_sh=y
 BR2_sh4=y
 
 # System
-BR2_GLOBAL_PATCH_DIR="board/qemu/sh4-r2d/patches"
 BR2_SYSTEM_DHCP="eth0"
 BR2_TARGET_GENERIC_GETTY_PORT="ttySC1"
 
configs/qemu_sh4eb_r2d_defconfig +0 -1
index 7f8e879b5d..4911ba0353 100644
@@ -3,7 +3,6 @@ BR2_sh=y
 BR2_sh4eb=y
 
 # System
-BR2_GLOBAL_PATCH_DIR="board/qemu/sh4eb-r2d/patches"
 BR2_TARGET_GENERIC_GETTY_PORT="ttySC1"
 
 # Filesystem
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/2 package/uclibc: Patch with updated kernel time definitions

Building uclibc 1.0.37 for SuperH architecture with linux-headers 5.10.7 fails at libpthread level due to missing time-related data structures, usually defined by the kernel. Make uclibc correctly define those types.

A previous patch in buildroot [1] fixed the symptom by tampering with linux-headers inclusions, but analysis [2] done in collaboration with Linux folks concluded that the issue lied in (voluntary) include guard "preemption" in uclibc kernel_types.h.
However, kernel_types.h was not up to date with relevant 64-bit time data structures, so defining those here was needed.

The present uclibc patch was mailed to uclibc-ng mailing list and got a positive response; I am not able to give a link to the discussion, as it has not appeared yet [3] (perhaps I'm not looking at the right place ?)
So until the patch is merged upstream and we bump uclibc version, keep our patch here.

[1] https://git.buildroot.net/buildroot/commit/?id=742f37de8d0e3797698411dfc6a63bd7e98aafe2
[2] https://patchwork.kernel.org/project/linux-sh/patch/20210123165652.10884-1-geoffrey.legourrierec at gmail.com/
[3] https://mailman.uclibc-ng.org/pipermail/devel/2021-January/thread.html

---
 ...sh-Add-64-bit-time-types-from-kernel.patch | 33 +++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 package/uclibc/0001-arch-sh-Add-64-bit-time-types-from-kernel.patch
package/uclibc/0001-arch-sh-Add-64-bit-time-types-from-kernel.patch new file +33 -0
new file mode 100644
index 0000000000..aec8fcda9f
@@ -0,0 +1,33 @@
+From 385f2b18ccde15f72a6e8aee4c960a5bc18481d7 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Geoffrey=20Le=20Gourri=C3=A9rec?=
+ <[email protected]>
+Date: Tue, 26 Jan 2021 20:39:36 +0100
+Subject: [PATCH] arch/sh: Add 64-bit time types from kernel
+
+---
+ libc/sysdeps/linux/sh/bits/kernel_types.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/libc/sysdeps/linux/sh/bits/kernel_types.h b/libc/sysdeps/linux/sh/bits/kernel_types.h
+index ac97261e6..90b2e66b6 100644
+--- a/libc/sysdeps/linux/sh/bits/kernel_types.h
++++ b/libc/sysdeps/linux/sh/bits/kernel_types.h
+@@ -21,6 +21,7 @@ typedef unsigned int	__kernel_size_t;
+ typedef int		__kernel_ssize_t;
+ typedef int		__kernel_ptrdiff_t;
+ typedef long		__kernel_time_t;
++typedef long long	__kernel_time64_t;
+ typedef long		__kernel_suseconds_t;
+ typedef long		__kernel_clock_t;
+ typedef int		__kernel_daddr_t;
+@@ -33,6 +34,7 @@ typedef unsigned short	__kernel_old_uid_t;
+ typedef unsigned short	__kernel_old_gid_t;
+ typedef __kernel_dev_t	__kernel_old_dev_t;
+ typedef long		__kernel_long_t;
++typedef __kernel_long_t	__kernel_old_time_t;
+ typedef unsigned long	__kernel_ulong_t;
+ typedef long long	__kernel_loff_t;
+ 
+-- 
+2.17.1
+
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/2 package/uclibc: Patch with updated kernel time definitions

Quoted 22 lines · On Wed, 27 Jan 2021 12:56:48 +0100 Geoffrey Le Gourri?rec…

Building uclibc 1.0.37 for SuperH architecture with linux-headers 5.10.7 fails at libpthread level due to missing time-related data structures, usually defined by the kernel. Make uclibc correctly define those types.

A previous patch in buildroot [1] fixed the symptom by tampering with linux-headers inclusions, but analysis [2] done in collaboration with Linux folks concluded that the issue lied in (voluntary) include guard "preemption" in uclibc kernel_types.h.
However, kernel_types.h was not up to date with relevant 64-bit time data structures, so defining those here was needed.

The present uclibc patch was mailed to uclibc-ng mailing list and got a positive response; I am not able to give a link to the discussion, as it has not appeared yet [3] (perhaps I'm not looking at the right place ?)
So until the patch is merged upstream and we bump uclibc version, keep our patch here.

[1] https://git.buildroot.net/buildroot/commit/?id=742f37de8d0e3797698411dfc6a63bd7e98aafe2
[2] https://patchwork.kernel.org/project/linux-sh/patch/20210123165652.10884-1-geoffrey.legourrierec at gmail.com/
[3] https://mailman.uclibc-ng.org/pipermail/devel/2021-January/thread.html

Quoted 5 lines
---
 ...sh-Add-64-bit-time-types-from-kernel.patch | 33 +++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 package/uclibc/0001-arch-sh-Add-64-bit-time-types-from-kernel.patch

I confirm this fixes the build of SH4 toolchains.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#3 lore raw

PATCH 2/2 package/uclibc: Patch with updated kernel time definitions

In reply to Geoffrey Le Gourriérec
Quoted 20 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Geoffrey" == Geoffrey Le Gourri?rec <[email protected]> writes:

Building uclibc 1.0.37 for SuperH architecture with linux-headers 5.10.7 fails at libpthread level due to missing time-related data structures, usually defined by the kernel. Make uclibc correctly define those types.

A previous patch in buildroot [1] fixed the symptom by tampering with linux-headers inclusions, but analysis [2] done in collaboration with Linux folks concluded that the issue lied in (voluntary) include guard "preemption" in uclibc kernel_types.h.
However, kernel_types.h was not up to date with relevant 64-bit time data structures, so defining those here was needed.

The present uclibc patch was mailed to uclibc-ng mailing list and got a positive response; I am not able to give a link to the discussion, as it has not appeared yet [3] (perhaps I'm not looking at the right place ?)
So until the patch is merged upstream and we bump uclibc version, keep our patch here.

Quoted 5 lines

[1] https://git.buildroot.net/buildroot/commit/?id=742f37de8d0e3797698411dfc6a63bd7e98aafe2
[2] https://patchwork.kernel.org/project/linux-sh/patch/20210123165652.10884-1-geoffrey.legourrierec at gmail.com/
[3] https://mailman.uclibc-ng.org/pipermail/devel/2021-January/thread.html

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#4 lore raw

PATCH 2/2 package/uclibc: Patch with updated kernel time definitions

In reply to Geoffrey Le Gourriérec
Quoted 20 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Geoffrey" == Geoffrey Le Gourri?rec <[email protected]> writes:

Building uclibc 1.0.37 for SuperH architecture with linux-headers 5.10.7 fails at libpthread level due to missing time-related data structures, usually defined by the kernel. Make uclibc correctly define those types.

A previous patch in buildroot [1] fixed the symptom by tampering with linux-headers inclusions, but analysis [2] done in collaboration with Linux folks concluded that the issue lied in (voluntary) include guard "preemption" in uclibc kernel_types.h.
However, kernel_types.h was not up to date with relevant 64-bit time data structures, so defining those here was needed.

The present uclibc patch was mailed to uclibc-ng mailing list and got a positive response; I am not able to give a link to the discussion, as it has not appeared yet [3] (perhaps I'm not looking at the right place ?)
So until the patch is merged upstream and we bump uclibc version, keep our patch here.

Quoted 6 lines

[1] https://git.buildroot.net/buildroot/commit/?id=742f37de8d0e3797698411dfc6a63bd7e98aafe2
[2]
https://patchwork.kernel.org/project/linux-sh/patch/20210123165652.10884-1-geoffrey.legourrierec at gmail.com/
[3] https://mailman.uclibc-ng.org/pipermail/devel/2021-January/thread.html

Committed to 2020.11.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#5 lore raw

PATCH 1/2 board/qemu/sh4*: Remove linux-headers patch

In reply to Geoffrey Le Gourriérec
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Geoffrey" == Geoffrey Le Gourri?rec <[email protected]> writes:

Previous patch about time data structures [1] provided a dirty fix that did not solve the real issue.

Quoted 7 lines

After discussing with Linux folks on the SuperH mailing list [2], the patch was deemed unnecessary, as the problem lied in uclibc.

[1] https://git.buildroot.net/buildroot/commit/?id=742f37de8d0e3797698411dfc6a63bd7e98aafe2
[2] https://patchwork.kernel.org/project/linux-sh/patch/20210123165652.10884-1-geoffrey.legourrierec at gmail.com/

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard