package/uclibc: Fix ARC build with 4.x kernel headers
PATCH 1/1 package/uclibc: Fix ARC build with 4.x kernel headers
Provide correct grouping for preprocessor
conditions to avoid building ld.so with
undefined macroses which are in use
Fixes
package/uclibc/0003-Fix-arc-build-with-4.x-kernel-headers.patch
Upstream:
https://patchwork.ozlabs.org/project/uclibc-ng/patch/[email protected]/
--- ...ix-arc-build-with-4.x-kernel-headers.patch | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 package/uclibc/0003-Fix-arc-build-with-4.x-kernel-headers.patch
package/uclibc/0003-Fix-arc-build-with-4.x-kernel-headers.patch new file +34 -0
@@ -0,0 +1,34 @@ +From 1afc19eb6a7948afbcf3dd19091ce127a355ebcb Mon Sep 17 00:00:00 2001 +From: Dmitry Chestnykh <[email protected]> +Date: Sun, 28 Jul 2024 14:12:39 +0300 +Subject: [PATCH] [ldso] Group conditions after `&&` + +If the conditions are not grouped we can reach +this block even if `__NR_stat` is not defined. + +`defined __NR_stat && ((!defined(__UCLIBC_USE_TIME64__) || defined(__sparc__))` +gives us false but `LINUX_VERSION_CODE <= KERNEL_VERSION(5,1,0))` +may give us true. So if linux headers version is below 5.1.0 and +__NR_stat is not defined we can have compilation error + +Signed-off-by: Dmitry Chestnykh <[email protected]> +--- + ldso/include/dl-syscall.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ldso/include/dl-syscall.h b/ldso/include/dl-syscall.h +index 9ec0eac60..180d03012 100644 +--- a/ldso/include/dl-syscall.h ++++ b/ldso/include/dl-syscall.h +@@ -141,7 +141,7 @@ static __always_inline int _dl_stat(const char *file_name, + { + return _dl_newfstatat(AT_FDCWD, file_name, buf, 0); + } +-#elif defined __NR_stat && (!defined(__UCLIBC_USE_TIME64__) || defined(__sparc__)) || (LINUX_VERSION_CODE <= KERNEL_VERSION(5,1,0)) ++#elif defined __NR_stat && (!defined(__UCLIBC_USE_TIME64__) || defined(__sparc__) || (LINUX_VERSION_CODE <= KERNEL_VERSION(5,1,0))) + # define __NR__dl_stat __NR_stat + static __always_inline _syscall2(int, _dl_stat, const char *, file_name, + struct stat *, buf) +-- +2.45.2 +
Signature · 6 lines
2.45.2 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Hello Dmitry,
Quoted 10 lines · On Sun, 28 Jul 2024 14:58:17 +0300 Dmitry Chestnykh <[email protected]>…
Provide correct grouping for preprocessor
conditions to avoid building ld.so with
undefined macroses which are in useFixes
package/uclibc/0003-Fix-arc-build-with-4.x-kernel-headers.patch
Upstream:
https://patchwork.ozlabs.org/project/uclibc-ng/patch/[email protected]/Signed-off-by Dmitry Chestnykh <[email protected]>
Thanks for this patch!
I also encountered a SuperH 4 build issue with uClibc-ng:
/builds/buildroot.org/toolchains-builder/build/sh-sh4--uclibc--stable-2024.05-1/lib/gcc/sh4-buildroot-linux-uclibc/13.3.0/../../../../sh4-buildroot-linux-uclibc/bin/ld: ldso/ldso/ld-uClibc_so.a(ldso.oS): in function `add_ldso.isra.0':
ldso.c:(.text+0x1f28): undefined reference to `_dl_stat'
More details at:
https://gitlab.com/buildroot.org/toolchains-builder/-/jobs/7378437145
Could this be fixed by your patch?
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Hello Thomas
The SuperH4 issue has already been fixed by patch number 0002 (
https://gitlab.com/buildroot.org/buildroot/-/commit/f463a4953534df13397ce113bfbbc03d4b8e4df7
)
вс, 28 июл. 2024 г. в 19:00, Thomas Petazzoni <[email protected]
Quoted 32 lines
:
Hello Dmitry,
Quoted 8 lines · On Sun, 28 Jul 2024 14:58:17 +0300 Dmitry Chestnykh <[email protected]>…
Provide correct grouping for preprocessor
conditions to avoid building ld.so with
undefined macroses which are in useFixes
package/uclibc/0003-Fix-arc-build-with-4.x-kernel-headers.patch
Upstream:https://patchwork.ozlabs.org/project/uclibc-ng/patch/[email protected]/
Quoted 2 lines
Signed-off-by Dmitry Chestnykh <[email protected]>Thanks for this patch!
I also encountered a SuperH 4 build issue with uClibc-ng:
/builds/ buildroot.org/toolchains-builder/build/sh-sh4--uclibc--stable-2024.05-1/lib/gcc/sh4-buildroot-linux-uclibc/13.3.0/../../../../sh4-buildroot-linux-uclibc/bin/ld:
ldso/ldso/ld-uClibc_so.a(ldso.oS): in function `add_ldso.isra.0':
ldso.c:(.text+0x1f28): undefined reference to `_dl_stat'More details at:
https://gitlab.com/buildroot.org/toolchains-builder/-/jobs/7378437145
Quoted 8 lines
Could this be fixed by your patch?
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Hello,
Quoted 4 lines · On Sun, 28 Jul 2024 19:21:20 +0300 Dmitriy Chestnykh <[email protected]>…
Hello Thomas
The SuperH4 issue has already been fixed by patch number 0002 (
https://gitlab.com/buildroot.org/buildroot/-/commit/f463a4953534df13397ce113bfbbc03d4b8e4df7
)
Indeed, thanks!
I still have an issue with SuperH 4 though.. it doesn't boot in Qemu:
https://gitlab.com/buildroot.org/toolchains-builder/-/pipelines/1391146782
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
I will take a look :)
вс, 28 июл. 2024 г., 23:11 Thomas Petazzoni <[email protected]>:
Quoted 16 lines
Hello,
Quoted 3 lines · On Sun, 28 Jul 2024 19:21:20 +0300 Dmitriy Chestnykh <[email protected]>…
Hello Thomas
The SuperH4 issue has already been fixed by patch number 0002 (https://gitlab.com/buildroot.org/buildroot/-/commit/f463a4953534df13397ce113bfbbc03d4b8e4df7
Quoted 1 line
)
Indeed, thanks!
I still have an issue with SuperH 4 though.. it doesn't boot in Qemu:
Quoted 8 lines
https://gitlab.com/buildroot.org/toolchains-builder/-/pipelines/1391146782
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Which version of QEMU do you use? Recently Waldemar sent a patch where he noticed that QEMU 9.x has an issue with SH4 emulation and the system doesn't boot
вс, 28 июл. 2024 г. в 23:11, Thomas Petazzoni <[email protected]
Quoted 18 lines
:
Hello,
Quoted 3 lines · On Sun, 28 Jul 2024 19:21:20 +0300 Dmitriy Chestnykh <[email protected]>…
Hello Thomas
The SuperH4 issue has already been fixed by patch number 0002 (https://gitlab.com/buildroot.org/buildroot/-/commit/f463a4953534df13397ce113bfbbc03d4b8e4df7
Quoted 1 line
)
Indeed, thanks!
I still have an issue with SuperH 4 though.. it doesn't boot in Qemu:
Quoted 8 lines
https://gitlab.com/buildroot.org/toolchains-builder/-/pipelines/1391146782
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 3 lines · On Mon, 29 Jul 2024 07:38:12 +0300 Dmitriy Chestnykh <[email protected]>…
Which version of QEMU do you use? Recently Waldemar sent a patch where he noticed that QEMU 9.x has an issue with SH4 emulation and the system doesn't boot
I do have the fix from Waldemar that brings the rootfs as an initramfs in SuperH configurations, to workaround the Qemu 9.x bug.
Best regards,
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Hi,
Thomas Petazzoni wrote,
Quoted 10 lines
Hello,
Quoted 4 lines · On Sun, 28 Jul 2024 19:21:20 +0300 Dmitriy Chestnykh <[email protected]>…
Hello Thomas
The SuperH4 issue has already been fixed by patch number 0002 (
https://gitlab.com/buildroot.org/buildroot/-/commit/f463a4953534df13397ce113bfbbc03d4b8e4df7
)
Quoted 5 lines
Indeed, thanks!
I still have an issue with SuperH 4 though.. it doesn't boot in Qemu:
https://gitlab.com/buildroot.org/toolchains-builder/-/pipelines/1391146782
That is strange. I cloned buildroot-toolchains,
make qemu_sh4_r2d_defconfig && make
For me it works with the included Qemu 9.0.0.
Strange thing is my zImage is smaller then the artefact which can be downloaded and did not work.
$ ls -l Downloads/zImage -rw-r--r-- 1 6037536 Jul 29 06:06 Downloads/zImage $ ls -l buildroot-toolchains/output/images/zImage -rw-r--r-- 1 4530208 Jul 29 05:57 buildroot-toolchains/output/images/zImage
Are the toolchain checks are running some tests inside the image?
best regards
Waldemar
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Also checked qemu_sh4_r2d_defconfig just now, everything works, qemu (my host qemu is 9.0.2) boots the system
пн, 29 июл. 2024 г. в 07:51, Waldemar Brodkorb <[email protected]>:
Quoted 34 lines
Hi,
Thomas Petazzoni wrote,Quoted 8 lines
Hello,
Quoted 3 lines · On Sun, 28 Jul 2024 19:21:20 +0300 Dmitriy Chestnykh <[email protected]>…
Hello Thomas
The SuperH4 issue has already been fixed by patch number 0002 (https://gitlab.com/buildroot.org/buildroot/-/commit/f463a4953534df13397ce113bfbbc03d4b8e4df7
Quoted 7 lines
Quoted 1 line
)
Indeed, thanks!
I still have an issue with SuperH 4 though.. it doesn't boot in Qemu:
https://gitlab.com/buildroot.org/toolchains-builder/-/pipelines/1391146782
That is strange. I cloned buildroot-toolchains,
makeqemu_sh4_r2d_defconfig&& makeFor me it works with the included Qemu 9.0.0.
Strange thing is my zImage is smaller then the artefact which can be downloaded and did not work.$ ls -l Downloads/zImage -rw-r--r-- 1 6037536 Jul 29 06:06 Downloads/zImage $ ls -l buildroot-toolchains/output/images/zImage -rw-r--r-- 1 4530208 Jul 29 05:57 buildroot-toolchains/output/images/zImage
Quoted 5 lines
Are the toolchain checks are running some tests inside the image?
best regards
Waldemar
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Hello Waldemar,
Quoted 2 lines · On Mon, 29 Jul 2024 06:51:43 +0200 Waldemar Brodkorb <[email protected]> wrote:
That is strange. I cloned buildroot-toolchains,
makeqemu_sh4_r2d_defconfig&& make
Indeed, I agree as well.
Quoted 10 lines
For me it works with the included Qemu 9.0.0.
Strange thing is my zImage is smaller then the artefact which can be downloaded and did not work.$ ls -l Downloads/zImage -rw-r--r-- 1 6037536 Jul 29 06:06 Downloads/zImage $ ls -l buildroot-toolchains/output/images/zImage -rw-r--r-- 1 4530208 Jul 29 05:57 buildroot-toolchains/output/images/zImageAre the toolchain checks are running some tests inside the image?
You probably built "just" qemu_sh4_r2d_defconfig, but the toolchains we built are more featureful: they have C++ support, Fortran support, OpenMP support. This means additional GCC runtime libraries installed in /lib, and therefore a bigger rootfs, which in the SH4 defconfigs is built into zImage as an initramfs. So not too surprising to have a bigger zImage.
The SH4 glibc stable toolchain is built using this configuration:
BR2_sh=y
BR2_TOOLCHAIN_BUILDROOT_GLIBC=y
BR2_PACKAGE_GLIBC_KERNEL_COMPAT=y
BR2_KERNEL_HEADERS_4_19=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_TOOLCHAIN_BUILDROOT_FORTRAN=y
BR2_INIT_NONE=y
BR2_SYSTEM_BIN_SH_NONE=y
# BR2_PACKAGE_BUSYBOX is not set
# BR2_TARGET_ROOTFS_TAR is not set
BR2_PACKAGE_HOST_GDB=y
BR2_PACKAGE_HOST_GDB_TUI=y
BR2_PACKAGE_HOST_GDB_PYTHON3=y
BR2_PACKAGE_GDB=y
BR2_GCC_ENABLE_OPENMP=y
So I am right building the concatenation of this + qemu_sh4_r2d_defconfig to see what is the result.
Best regards,
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH] SuperH qemu issues
Hello Waldemar,
Quoted 2 lines · On Tue, 30 Jul 2024 22:16:30 +0200 Thomas Petazzoni…
So I am right building the concatenation of this +
qemu_sh4_r2d_defconfigto see what is the result.
I can confirm that:
BR2_sh=y
BR2_KERNEL_HEADERS_4_19=y BR2_PACKAGE_GLIBC_KERNEL_COMPAT=y BR2_TOOLCHAIN_BUILDROOT_CXX=y BR2_TOOLCHAIN_BUILDROOT_FORTRAN=y
BR2_GCC_ENABLE_OPENMP=y
BR2_PACKAGE_HOST_GDB=y
BR2_PACKAGE_HOST_GDB_TUI=y
BR2_PACKAGE_HOST_GDB_PYTHON3=y BR2_TARGET_GENERIC_GETTY_PORT="ttySC1" BR2_SYSTEM_DHCP="eth0" BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh" BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)" BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.6.18" BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/sh4-r2d/linux.config" BR2_LINUX_KERNEL_ZIMAGE=y
BR2_PACKAGE_GDB=y
BR2_TARGET_ROOTFS_INITRAMFS=y
# BR2_TARGET_ROOTFS_TAR is not set
BR2_PACKAGE_HOST_QEMU=y BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE=y
generates a system that doesn't boot:
$ ./host/bin/qemu-system-sh4 -M r2d -kernel images/zImage -append "console=ttySC1,115200 noiotrap" -serial null -serial stdio -net nic,model=rtl8139 -net user VNC server running on 127.0.0.1:5900
and then nothing.
Thomas
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Hi Dmitry,
Dmitry Chestnykh wrote,
Quoted 6 lines
Provide correct grouping for preprocessor
conditions to avoid building ld.so with
undefined macroses which are in useFixes
package/uclibc/0003-Fix-arc-build-with-4.x-kernel-headers.patch
Here you have to add the autobuild failure.
Quoted 2 lines
Upstream:
https://patchwork.ozlabs.org/project/uclibc-ng/patch/[email protected]/
You can update Upstream to the uClibc-ng commit:
https://cgit.uclibc-ng.org/cgi/cgit/uclibc-ng.git/commit/?id=841d0729883ee0de606de161c1d6a5c37cedf575
Your Subject is wrong, too.
Can you respin your patch?
best regards
Waldemar
Quoted 54 lines
Signed-off-by Dmitry Chestnykh <[email protected]>--- ...ix-arc-build-with-4.x-kernel-headers.patch | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 package/uclibc/0003-Fix-arc-build-with-4.x-kernel-headers.patchpackage/uclibc/0003-Fix-arc-build-with-4.x-kernel-headers.patch new file +34
-0@@ -0,0 +1,34 @@ +From 1afc19eb6a7948afbcf3dd19091ce127a355ebcb Mon Sep 17 00:00:00 2001 +From: Dmitry Chestnykh <[email protected]> +Date: Sun, 28 Jul 2024 14:12:39 +0300 +Subject: [PATCH] [ldso] Group conditions after `&&` + +If the conditions are not grouped we can reach +this block even if `__NR_stat` is not defined. + +`defined __NR_stat && ((!defined(__UCLIBC_USE_TIME64__) || defined(__sparc__))` +gives us false but `LINUX_VERSION_CODE <= KERNEL_VERSION(5,1,0))` +may give us true. So if linux headers version is below 5.1.0 and +__NR_stat is not defined we can have compilation error + +Signed-off-by: Dmitry Chestnykh <[email protected]> +--- + ldso/include/dl-syscall.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ldso/include/dl-syscall.h b/ldso/include/dl-syscall.h +index 9ec0eac60..180d03012 100644 +--- a/ldso/include/dl-syscall.h ++++ b/ldso/include/dl-syscall.h +@@ -141,7 +141,7 @@ static __always_inline int _dl_stat(const char *file_name, + { + return _dl_newfstatat(AT_FDCWD, file_name, buf, 0); + } +-#elif defined __NR_stat && (!defined(__UCLIBC_USE_TIME64__) || defined(__sparc__)) || (LINUX_VERSION_CODE <= KERNEL_VERSION(5,1,0)) ++#elif defined __NR_stat && (!defined(__UCLIBC_USE_TIME64__) || defined(__sparc__) || (LINUX_VERSION_CODE <= KERNEL_VERSION(5,1,0))) + # define __NR__dl_stat __NR_stat + static __always_inline _syscall2(int, _dl_stat, const char *, file_name, + struct stat *, buf) +-- +2.45.2 +Signature · 6 lines
2.45.2 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Hello Dmitry,
Quoted 6 lines · On Sun, 28 Jul 2024 14:58:17 +0300 Dmitry Chestnykh <[email protected]>…
Provide correct grouping for preprocessor
conditions to avoid building ld.so with
undefined macroses which are in useFixes
package/uclibc/0003-Fix-arc-build-with-4.x-kernel-headers.patch
This patch is 0002, not 0003.
Quoted 2 lines
Upstream:
https://patchwork.ozlabs.org/project/uclibc-ng/patch/[email protected]/
This upstream link had to go within the patch itself.
I fixed both minor issues, and applied to master. Thanks a lot!
Thomas
Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot