* [Buildroot] [PATCH v2, 1/1] toolchain/Config.in: update BR2_TOOLCHAIN_HAS_LIBATOMIC dependencies
@ 2024-05-12 10:05 Fabrice Fontaine
2024-05-12 10:16 ` Thomas Petazzoni via buildroot
2024-06-08 11:13 ` Peter Korsgaard
0 siblings, 2 replies; 3+ messages in thread
From: Fabrice Fontaine @ 2024-05-12 10:05 UTC (permalink / raw)
To: buildroot
Cc: Romain Naour, Giulio Benetti, Thomas Petazzoni, Fabrice Fontaine
Update BR2_TOOLCHAIN_HAS_LIBATOMIC dependencies to avoid the following
build failure with libopenssl and
BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_ARMV7M_UCLIBC_STABLE:
/home/buildroot/autobuild/run/instance-2/output-1/host/opt/ext-toolchain/arm-buildroot-uclinux-uclibcgnueabi/bin/ld.real: ./libcrypto.a(libcrypto-lib-threads_pthread.o): in function `CRYPTO_atomic_or':
threads_pthread.c:(.text+0xfa): undefined reference to `__atomic_is_lock_free'
libatomic is available since gcc 4.8, when thread support is enabled.
However, the gcc logic in libatomic/configure.tgt does not recognize
"uclinux" as a valid OS part of the target tuple, and therefore it
does not build libatomic. The "uclinux" part of the tuple is used by
Buildroot when BR2_BINFMT_FLAT=y [1]. This broken logic has only been
fixed for arm since gcc 10.1.0 [2].
Indeed, bootlin armv7m is an uclibc toolchain compiled with atomic
support through libatomic.
[1] https://git.buildroot.net/buildroot/commit/?id=b3d1fb26dcadd8c570e2c415ce05398ecc810b32
[2] https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=b1e21e5a5d19b436f948710e09157c5b3244f541
Fixes:
- http://autobuild.buildroot.org/results/d25e898f9715bf6a21284807361a57735a7a2e1d
- http://autobuild.buildroot.org/results/e37ed5ad6ba41d610bffe9c234f699e203ef5069
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
Changes v1 -> v2 (after review of Thomas Petazzoni):
- Update dependencies to enable libatomic with uclibc only on arm with
gcc 10
toolchain/Config.in | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/toolchain/Config.in b/toolchain/Config.in
index 655f1a53dc..ef8a8ba381 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -888,15 +888,19 @@ config BR2_TOOLCHAIN_HAS_SYNC_8
default y if BR2_TOOLCHAIN_ARM_HAS_SYNC_8
default y if BR2_TOOLCHAIN_X86_HAS_SYNC_8
-# libatomic is available since gcc 4.8, when thread support is
-# enabled. Also, libatomic doesn't recognize "uclinux" as a valid OS
-# part of the tuple, and is therefore not build on uclinux targets,
-# which is why BR2_BINFMT_FLAT configurations are excluded.
+# libatomic is available since gcc 4.8, when thread support is enabled.
+# However, the gcc logic in libatomic/configure.tgt does not recognize
+# "uclinux" as a valid OS part of the target tuple, and therefore it
+# does not build libatomic. The "uclinux" part of the tuple is used by
+# Buildroot when BR2_BINFMT_FLAT=y. This broken logic has only been
+# fixed for arm since gcc 10.1.0.
config BR2_TOOLCHAIN_HAS_LIBATOMIC
bool
- default y if BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 && \
- BR2_TOOLCHAIN_HAS_THREADS && \
- !BR2_BINFMT_FLAT
+ default y if BR2_TOOLCHAIN_GCC_AT_LEAST_4_8
+ depends on BR2_TOOLCHAIN_HAS_THREADS
+ depends on BR2_BINFMT_ELF || \
+ (BR2_BINFMT_FLAT && BR2_arm && \
+ BR2_TOOLCHAIN_GCC_AT_LEAST_10)
# __atomic intrinsics are available:
# - with gcc 4.8, either through built-ins or libatomic, on all
--
2.43.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Buildroot] [PATCH v2, 1/1] toolchain/Config.in: update BR2_TOOLCHAIN_HAS_LIBATOMIC dependencies
2024-05-12 10:05 [Buildroot] [PATCH v2, 1/1] toolchain/Config.in: update BR2_TOOLCHAIN_HAS_LIBATOMIC dependencies Fabrice Fontaine
@ 2024-05-12 10:16 ` Thomas Petazzoni via buildroot
2024-06-08 11:13 ` Peter Korsgaard
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-05-12 10:16 UTC (permalink / raw)
To: Fabrice Fontaine; +Cc: Romain Naour, Giulio Benetti, buildroot
Hello,
On Sun, 12 May 2024 12:05:24 +0200
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:
> Update BR2_TOOLCHAIN_HAS_LIBATOMIC dependencies to avoid the following
> build failure with libopenssl and
> BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_ARMV7M_UCLIBC_STABLE:
>
> /home/buildroot/autobuild/run/instance-2/output-1/host/opt/ext-toolchain/arm-buildroot-uclinux-uclibcgnueabi/bin/ld.real: ./libcrypto.a(libcrypto-lib-threads_pthread.o): in function `CRYPTO_atomic_or':
> threads_pthread.c:(.text+0xfa): undefined reference to `__atomic_is_lock_free'
Thanks, I have applied because the patch makes sense. However, what
about other noMMU architectures that use BR2_BINFMT_FLAT, but don't
produce a libatomic? For example m68k noMMU? Won't they still be broken
with this undefined reference to `__atomic_is_lock_free' ?
Thanks,
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Buildroot] [PATCH v2, 1/1] toolchain/Config.in: update BR2_TOOLCHAIN_HAS_LIBATOMIC dependencies
2024-05-12 10:05 [Buildroot] [PATCH v2, 1/1] toolchain/Config.in: update BR2_TOOLCHAIN_HAS_LIBATOMIC dependencies Fabrice Fontaine
2024-05-12 10:16 ` Thomas Petazzoni via buildroot
@ 2024-06-08 11:13 ` Peter Korsgaard
1 sibling, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2024-06-08 11:13 UTC (permalink / raw)
To: Fabrice Fontaine
Cc: Romain Naour, Giulio Benetti, Thomas Petazzoni, buildroot
>>>>> "Fabrice" == Fabrice Fontaine <fontaine.fabrice@gmail.com> writes:
> Update BR2_TOOLCHAIN_HAS_LIBATOMIC dependencies to avoid the following
> build failure with libopenssl and
> BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_ARMV7M_UCLIBC_STABLE:
> /home/buildroot/autobuild/run/instance-2/output-1/host/opt/ext-toolchain/arm-buildroot-uclinux-uclibcgnueabi/bin/ld.real: ./libcrypto.a(libcrypto-lib-threads_pthread.o): in function `CRYPTO_atomic_or':
> threads_pthread.c:(.text+0xfa): undefined reference to `__atomic_is_lock_free'
> libatomic is available since gcc 4.8, when thread support is enabled.
> However, the gcc logic in libatomic/configure.tgt does not recognize
> "uclinux" as a valid OS part of the target tuple, and therefore it
> does not build libatomic. The "uclinux" part of the tuple is used by
> Buildroot when BR2_BINFMT_FLAT=y [1]. This broken logic has only been
> fixed for arm since gcc 10.1.0 [2].
> Indeed, bootlin armv7m is an uclibc toolchain compiled with atomic
> support through libatomic.
> [1] https://git.buildroot.net/buildroot/commit/?id=b3d1fb26dcadd8c570e2c415ce05398ecc810b32
> [2] https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=b1e21e5a5d19b436f948710e09157c5b3244f541
> Fixes:
> - http://autobuild.buildroot.org/results/d25e898f9715bf6a21284807361a57735a7a2e1d
> - http://autobuild.buildroot.org/results/e37ed5ad6ba41d610bffe9c234f699e203ef5069
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> ---
> Changes v1 -> v2 (after review of Thomas Petazzoni):
> - Update dependencies to enable libatomic with uclibc only on arm with
> gcc 10
Committed to 2024.02.x, thanks.
--
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-06-08 11:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-12 10:05 [Buildroot] [PATCH v2, 1/1] toolchain/Config.in: update BR2_TOOLCHAIN_HAS_LIBATOMIC dependencies Fabrice Fontaine
2024-05-12 10:16 ` Thomas Petazzoni via buildroot
2024-06-08 11:13 ` Peter Korsgaard
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.