* [Buildroot] [PATCH 1/1] toolchain/Config.in: enable libatomic with BR2_BINFMT_FLAT
@ 2024-03-07 12:28 Fabrice Fontaine
2024-03-07 12:49 ` Thomas Petazzoni via buildroot
0 siblings, 1 reply; 6+ messages in thread
From: Fabrice Fontaine @ 2024-03-07 12:28 UTC (permalink / raw)
To: buildroot
Cc: Thomas Petazzoni, Romain Naour, Giulio Benetti,
Thomas De Schampheleire, Fabrice Fontaine
Enable libatomic with BR2_BINFMT_FLAT 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'
Indeed, bootlin armv7m is an uclibc toolchain compiled with atomic
support through libatomic
This build failure is probably raised since activation of threads in
static builds by commit ea3e60229bc5647e587685023de475276e28584d
Fixes:
- http://autobuild.buildroot.org/results/d25e898f9715bf6a21284807361a57735a7a2e1d
- http://autobuild.buildroot.org/results/e37ed5ad6ba41d610bffe9c234f699e203ef5069
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
toolchain/Config.in | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/toolchain/Config.in b/toolchain/Config.in
index 3dd6e83d35..13d1b94fe4 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -880,15 +880,12 @@ config BR2_TOOLCHAIN_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.
+# enabled.
config BR2_TOOLCHAIN_HAS_LIBATOMIC
bool
default y if BR2_TOOLCHAIN_GCC_AT_LEAST_4_8 && \
!BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_AARCH64 && \
- BR2_TOOLCHAIN_HAS_THREADS && \
- !BR2_BINFMT_FLAT
+ BR2_TOOLCHAIN_HAS_THREADS
# __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] 6+ messages in thread
* Re: [Buildroot] [PATCH 1/1] toolchain/Config.in: enable libatomic with BR2_BINFMT_FLAT
2024-03-07 12:28 [Buildroot] [PATCH 1/1] toolchain/Config.in: enable libatomic with BR2_BINFMT_FLAT Fabrice Fontaine
@ 2024-03-07 12:49 ` Thomas Petazzoni via buildroot
2024-03-07 17:18 ` Fabrice Fontaine
0 siblings, 1 reply; 6+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-03-07 12:49 UTC (permalink / raw)
To: Fabrice Fontaine
Cc: Romain Naour, Giulio Benetti, Thomas De Schampheleire, buildroot
Hello Fabrice,
On Thu, 7 Mar 2024 13:28:06 +0100
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:
> Enable libatomic with BR2_BINFMT_FLAT 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'
>
> Indeed, bootlin armv7m is an uclibc toolchain compiled with atomic
> support through libatomic
>
> This build failure is probably raised since activation of threads in
> static builds by commit ea3e60229bc5647e587685023de475276e28584d
>
> Fixes:
> - http://autobuild.buildroot.org/results/d25e898f9715bf6a21284807361a57735a7a2e1d
> - http://autobuild.buildroot.org/results/e37ed5ad6ba41d610bffe9c234f699e203ef5069
>
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Thanks for the patch. Do we know since when there is support for
libatomic for platforms that use the FLAT binary format? Is this
specific to ARM/FLAT, or applicable to all configurations that use the
FLAT binary format?
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] 6+ messages in thread
* Re: [Buildroot] [PATCH 1/1] toolchain/Config.in: enable libatomic with BR2_BINFMT_FLAT
2024-03-07 12:49 ` Thomas Petazzoni via buildroot
@ 2024-03-07 17:18 ` Fabrice Fontaine
2024-03-11 11:35 ` Thomas Petazzoni via buildroot
0 siblings, 1 reply; 6+ messages in thread
From: Fabrice Fontaine @ 2024-03-07 17:18 UTC (permalink / raw)
To: Thomas Petazzoni
Cc: Romain Naour, Giulio Benetti, Thomas De Schampheleire, buildroot
Hello,
Le jeu. 7 mars 2024 à 13:49, Thomas Petazzoni
<thomas.petazzoni@bootlin.com> a écrit :
>
> Hello Fabrice,
>
> On Thu, 7 Mar 2024 13:28:06 +0100
> Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:
>
> > Enable libatomic with BR2_BINFMT_FLAT 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'
> >
> > Indeed, bootlin armv7m is an uclibc toolchain compiled with atomic
> > support through libatomic
> >
> > This build failure is probably raised since activation of threads in
> > static builds by commit ea3e60229bc5647e587685023de475276e28584d
> >
> > Fixes:
> > - http://autobuild.buildroot.org/results/d25e898f9715bf6a21284807361a57735a7a2e1d
> > - http://autobuild.buildroot.org/results/e37ed5ad6ba41d610bffe9c234f699e203ef5069
> >
> > Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
>
> Thanks for the patch. Do we know since when there is support for
> libatomic for platforms that use the FLAT binary format? Is this
> specific to ARM/FLAT, or applicable to all configurations that use the
> FLAT binary format?
Nope, I don't know. I didn't find any clue in uclibc-ng github history.
>
> Thomas
> --
> Thomas Petazzoni, co-owner and CEO, Bootlin
> Embedded Linux and Kernel engineering and training
> https://bootlin.com
Best Regards,
Fabrice
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Buildroot] [PATCH 1/1] toolchain/Config.in: enable libatomic with BR2_BINFMT_FLAT
2024-03-07 17:18 ` Fabrice Fontaine
@ 2024-03-11 11:35 ` Thomas Petazzoni via buildroot
2024-03-12 7:18 ` Fabrice Fontaine
0 siblings, 1 reply; 6+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-03-11 11:35 UTC (permalink / raw)
To: Fabrice Fontaine
Cc: Romain Naour, Giulio Benetti, Thomas De Schampheleire, buildroot
On Thu, 7 Mar 2024 18:18:24 +0100
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:
> > Thanks for the patch. Do we know since when there is support for
> > libatomic for platforms that use the FLAT binary format? Is this
> > specific to ARM/FLAT, or applicable to all configurations that use the
> > FLAT binary format?
>
> Nope, I don't know. I didn't find any clue in uclibc-ng github history.
That's because libatomic has nothing to do with the C library.
libatomic is provided by gcc. So if you want to find out why it is now
available for FLAT platforms, you should check the gcc Git history :-)
Best regards,
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] 6+ messages in thread
* Re: [Buildroot] [PATCH 1/1] toolchain/Config.in: enable libatomic with BR2_BINFMT_FLAT
2024-03-11 11:35 ` Thomas Petazzoni via buildroot
@ 2024-03-12 7:18 ` Fabrice Fontaine
2024-05-12 8:15 ` Thomas Petazzoni via buildroot
0 siblings, 1 reply; 6+ messages in thread
From: Fabrice Fontaine @ 2024-03-12 7:18 UTC (permalink / raw)
To: Thomas Petazzoni
Cc: Romain Naour, Giulio Benetti, Thomas De Schampheleire, buildroot
Hello Thomas,
Le lun. 11 mars 2024 à 12:35, Thomas Petazzoni
<thomas.petazzoni@bootlin.com> a écrit :
>
> On Thu, 7 Mar 2024 18:18:24 +0100
> Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:
>
> > > Thanks for the patch. Do we know since when there is support for
> > > libatomic for platforms that use the FLAT binary format? Is this
> > > specific to ARM/FLAT, or applicable to all configurations that use the
> > > FLAT binary format?
> >
> > Nope, I don't know. I didn't find any clue in uclibc-ng github history.
>
> That's because libatomic has nothing to do with the C library.
> libatomic is provided by gcc. So if you want to find out why it is now
> available for FLAT platforms, you should check the gcc Git history :-)
After reading gcc git history, I didn't find anything either.
However, I found out some information in buildroot git history [1]:
"The cairo package fails to build on some architectures:
BR2_TOOLCHAIN_HAS_LIBATOMIC is enabled, but libatomic is in fact not
available.
This happens because 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, so we make BR2_TOOLCHAIN_HAS_LIBATOMIC enabled only
if !BR2_BINFMT_FLAT."
So finally this libatomic workaround has nothing to do with FLAT by itself.
The uclinux handling has been fixed but only for arm since gcc 10.1.0 with [2].
So dropping BR2_BINFMT_FLAT will probably raise build failure on other
architectures.
How should I proceed for my v2?
Should I replace !BR2_BINFMT_FLAT by (!BR2_BINFMT_FLAT=y ||
(BR2_TOOLCHAIN_GCC_AT_LEAST_10 && BR2_arm))?
An other option would be to add default y if
BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_ARMV7M_UCLIBC_STABLE (more simple but
ugly).
[1] https://git.buildroot.net/buildroot/commit/?id=b3d1fb26dcadd8c570e2c415ce05398ecc810b32
[2] https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=b1e21e5a5d19b436f948710e09157c5b3244f541
>
> Best regards,
>
> Thomas
> --
> Thomas Petazzoni, co-owner and CEO, Bootlin
> Embedded Linux and Kernel engineering and training
> https://bootlin.com
Best Regards,
Fabrice
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Buildroot] [PATCH 1/1] toolchain/Config.in: enable libatomic with BR2_BINFMT_FLAT
2024-03-12 7:18 ` Fabrice Fontaine
@ 2024-05-12 8:15 ` Thomas Petazzoni via buildroot
0 siblings, 0 replies; 6+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-05-12 8:15 UTC (permalink / raw)
To: Fabrice Fontaine
Cc: Romain Naour, Giulio Benetti, Thomas De Schampheleire, buildroot
Hello Fabrice,
On Tue, 12 Mar 2024 08:18:35 +0100
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:
> How should I proceed for my v2?
> Should I replace !BR2_BINFMT_FLAT by (!BR2_BINFMT_FLAT=y ||
> (BR2_TOOLCHAIN_GCC_AT_LEAST_10 && BR2_arm))?
> An other option would be to add default y if
> BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_ARMV7M_UCLIBC_STABLE (more simple but
> ugly).
The latter is indeed ugly. Something like the below?
config BR2_TOOLCHAIN_HAS_LIBATOMIC
bool
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)
What do you think ? The comment above the BR2_TOOLCHAIN_HAS_LIBATOMIC
would need to be updated accordingly, of course.
Best regards,
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] 6+ messages in thread
end of thread, other threads:[~2024-05-12 8:15 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-07 12:28 [Buildroot] [PATCH 1/1] toolchain/Config.in: enable libatomic with BR2_BINFMT_FLAT Fabrice Fontaine
2024-03-07 12:49 ` Thomas Petazzoni via buildroot
2024-03-07 17:18 ` Fabrice Fontaine
2024-03-11 11:35 ` Thomas Petazzoni via buildroot
2024-03-12 7:18 ` Fabrice Fontaine
2024-05-12 8:15 ` Thomas Petazzoni via buildroot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox