All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/numactl: needs atomic
@ 2022-04-27 20:50 Fabrice Fontaine
  2022-04-28 21:45 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 4+ messages in thread
From: Fabrice Fontaine @ 2022-04-27 20:50 UTC (permalink / raw)
  To: buildroot; +Cc: Pierre-Jean Texier, Fabrice Fontaine, Thomas Petazzoni

numactl unconditionally uses __atomic_fetch_and resulting in the
following build failure on microblaze since commit
4ed540ddf59bec4b389be44d7f42820d2466904f:

/nvmedata/autobuild/instance-5/output-1/host/lib/gcc/microblaze-buildroot-linux-uclibc/10.3.0/../../../../microblaze-buildroot-linux-uclibc/bin/ld: ./.libs/libnuma.a(libnuma.o): in function `numa_node_to_cpus_v1':
(.text+0x2a34): undefined reference to `__atomic_fetch_and_1'

Fixes:
 - http://autobuild.buildroot.org/results/e225cb83dae390d9dc543d4da85c52180efbd40a

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 package/numactl/Config.in  | 1 +
 package/rt-tests/Config.in | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/package/numactl/Config.in b/package/numactl/Config.in
index 23cf7facb0..325a05d609 100644
--- a/package/numactl/Config.in
+++ b/package/numactl/Config.in
@@ -1,6 +1,7 @@
 config BR2_PACKAGE_NUMACTL
 	bool "numactl"
 	depends on BR2_USE_MMU # madvise()
+	depends on BR2_TOOLCHAIN_HAS_ATOMIC
 	help
 	  numactl allows you to run your application on specific cpus
 	  and memory nodes. It does this by supplying a NUMA memory
diff --git a/package/rt-tests/Config.in b/package/rt-tests/Config.in
index 8efa3d194e..ccfa040d70 100644
--- a/package/rt-tests/Config.in
+++ b/package/rt-tests/Config.in
@@ -1,6 +1,7 @@
 config BR2_PACKAGE_RT_TESTS
 	bool "rt-tests"
 	depends on BR2_TOOLCHAIN_HAS_SYNC_4 # __sync_*_4 intrisics
+	depends on BR2_TOOLCHAIN_HAS_ATOMIC # numactl
 	depends on BR2_TOOLCHAIN_HAS_THREADS_NPTL
 	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_5
 	depends on BR2_USE_MMU # fork(), numactl
@@ -32,6 +33,7 @@ comment "rt-tests may not work on MIPS with an external uClibc toolchain"
 
 comment "rt-tests needs a uClibc or glibc toolchain w/ NPTL, headers >= 4.5, dynamic library"
 	depends on BR2_TOOLCHAIN_HAS_SYNC_4
+	depends on BR2_TOOLCHAIN_HAS_ATOMIC
 	depends on !BR2_TOOLCHAIN_HAS_THREADS_NPTL || BR2_STATIC_LIBS \
 		|| BR2_TOOLCHAIN_USES_MUSL || !BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_5
 	depends on BR2_USE_MMU
-- 
2.35.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/numactl: needs atomic
  2022-04-27 20:50 [Buildroot] [PATCH 1/1] package/numactl: needs atomic Fabrice Fontaine
@ 2022-04-28 21:45 ` Thomas Petazzoni via buildroot
  2022-04-29  7:05   ` Fabrice Fontaine
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Petazzoni via buildroot @ 2022-04-28 21:45 UTC (permalink / raw)
  To: Fabrice Fontaine; +Cc: Pierre-Jean Texier, buildroot

On Wed, 27 Apr 2022 22:50:57 +0200
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:

> numactl unconditionally uses __atomic_fetch_and resulting in the
> following build failure on microblaze since commit
> 4ed540ddf59bec4b389be44d7f42820d2466904f:

This explanation is unfortunately incorrect. It has nothing to do with
microblaze, because BR2_TOOLCHAIN_HAS_ATOMIC is true on microblaze:

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

config BR2_TOOLCHAIN_HAS_ATOMIC
        bool
        default y if BR2_TOOLCHAIN_HAS_LIBATOMIC
        default y if BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 && BR2_arm
        default y if BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 && BR2_armeb
        default y if BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 && BR2_xtensa
        default y if BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 && BR2_ARCH_IS_64

However, the key thing is that the build failure
http://autobuild.buildroot.org/results/e225cb83dae390d9dc543d4da85c52180efbd40a
has thread support disabled, and when threads are disabled, libatomic
is not built, and therefore BR2_TOOLCHAIN_HAS_LIBATOMIC is false.

However, I don't see anywhere in the numactl build system where
-latomic is passed. Does it build on architectures that need to link
against libatomic to get atomic intrinsics?

Could you double check this, and rework the commit message?

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] 4+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/numactl: needs atomic
  2022-04-28 21:45 ` Thomas Petazzoni via buildroot
@ 2022-04-29  7:05   ` Fabrice Fontaine
  2022-04-29  7:33     ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 4+ messages in thread
From: Fabrice Fontaine @ 2022-04-29  7:05 UTC (permalink / raw)
  To: Thomas Petazzoni; +Cc: Pierre-Jean Texier, Buildroot Mailing List

Le jeu. 28 avr. 2022 à 23:45, Thomas Petazzoni
<thomas.petazzoni@bootlin.com> a écrit :
>
> On Wed, 27 Apr 2022 22:50:57 +0200
> Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:
>
> > numactl unconditionally uses __atomic_fetch_and resulting in the
> > following build failure on microblaze since commit
> > 4ed540ddf59bec4b389be44d7f42820d2466904f:
>
> This explanation is unfortunately incorrect. It has nothing to do with
> microblaze, because BR2_TOOLCHAIN_HAS_ATOMIC is true on microblaze:
>
> 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
>
> config BR2_TOOLCHAIN_HAS_ATOMIC
>         bool
>         default y if BR2_TOOLCHAIN_HAS_LIBATOMIC
>         default y if BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 && BR2_arm
>         default y if BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 && BR2_armeb
>         default y if BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 && BR2_xtensa
>         default y if BR2_TOOLCHAIN_GCC_AT_LEAST_4_7 && BR2_ARCH_IS_64
>
> However, the key thing is that the build failure
> http://autobuild.buildroot.org/results/e225cb83dae390d9dc543d4da85c52180efbd40a
> has thread support disabled, and when threads are disabled, libatomic
> is not built, and therefore BR2_TOOLCHAIN_HAS_LIBATOMIC is false.
>
> However, I don't see anywhere in the numactl build system where
> -latomic is passed. Does it build on architectures that need to link
> against libatomic to get atomic intrinsics?

Linking with -latomic is done thanks to 0002-link-with-latomic-if-needed.patch.
This patch was added to fix the build on architectures such as sparcv8.
However, I don't understand why the build fails on microblaze without libatomic.
Are we sure that microblaze really supports atomic without libatomic?

>
> Could you double check this, and rework the commit message?
>
> Thanks!
>
> 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] 4+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/numactl: needs atomic
  2022-04-29  7:05   ` Fabrice Fontaine
@ 2022-04-29  7:33     ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Petazzoni via buildroot @ 2022-04-29  7:33 UTC (permalink / raw)
  To: Fabrice Fontaine; +Cc: Pierre-Jean Texier, Buildroot Mailing List

Hello Fabrice,

On Fri, 29 Apr 2022 09:05:21 +0200
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:

> > However, the key thing is that the build failure
> > http://autobuild.buildroot.org/results/e225cb83dae390d9dc543d4da85c52180efbd40a
> > has thread support disabled, and when threads are disabled, libatomic
> > is not built, and therefore BR2_TOOLCHAIN_HAS_LIBATOMIC is false.
> >
> > However, I don't see anywhere in the numactl build system where
> > -latomic is passed. Does it build on architectures that need to link
> > against libatomic to get atomic intrinsics?  
> 
> Linking with -latomic is done thanks to 0002-link-with-latomic-if-needed.patch.
> This patch was added to fix the build on architectures such as sparcv8.

Ah, I missed that patch, thanks for pointing it out!

> However, I don't understand why the build fails on microblaze without libatomic.
> Are we sure that microblaze really supports atomic without libatomic?

I explained it in my previous e-mail I think :-)

It fails because the configuration you're pointing to has threads
disabled, and when threads are disabled, libatomic is not
built/provided by gcc. This is properly handled by
BR2_TOOLCHAIN_HAS_LIBATOMIC being false in such configurations.

So basically, your patch is correct (IMO), but the commit log isn't:
the problem isn't Microblaze specific, but would happen on any
architecture that needs libatomic to provide atomic intrinsics.

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] 4+ messages in thread

end of thread, other threads:[~2022-04-29  7:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-27 20:50 [Buildroot] [PATCH 1/1] package/numactl: needs atomic Fabrice Fontaine
2022-04-28 21:45 ` Thomas Petazzoni via buildroot
2022-04-29  7:05   ` Fabrice Fontaine
2022-04-29  7:33     ` Thomas Petazzoni via buildroot

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.