[RFC,1/2] toolchain: add BR2_TOOLCHAIN_HAS_ATOMIC_TEST_AND_SET option

Message ID 20241003162629.470273-1-dario.binacchi@amarulasolutions.com
State New
Headers show
Series
  • [RFC,1/2] toolchain: add BR2_TOOLCHAIN_HAS_ATOMIC_TEST_AND_SET option
Related show

Commit Message

Dario Binacchi Oct. 3, 2024, 4:26 p.m. UTC
The build of libcap fails for ARC Targets which don't have the
ATOMICS_EXT flag set:

configure:5053: checking for cap_set_proc in -lcap

cap_proc.c:(.text+0x78): undefined reference to `__atomic_test_and_set'

configure:5086: result: no
configure:5097: error: libcap support was requested but the library was not found

The patch disables BR2_TOOLCHAIN_HAS_ATOMIC_TEST_AND_SET for BR2_arc
without BR2_ARC_ATOMIC_EXT.

Fixes:
- http://autobuild.buildroot.net/results/66ee26677777124eafb4740a3c7437e06f704f98

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---
 toolchain/Config.in | 5 +++++
 1 file changed, 5 insertions(+)

Comments

'Krzysztof Kozlowski' via Amarula Linux Nov. 1, 2024, 8:58 a.m. UTC | #1
On Thu,  3 Oct 2024 18:26:28 +0200
Dario Binacchi <dario.binacchi@amarulasolutions.com> wrote:

> The build of libcap fails for ARC Targets which don't have the
> ATOMICS_EXT flag set:
> 
> configure:5053: checking for cap_set_proc in -lcap
> 
> cap_proc.c:(.text+0x78): undefined reference to `__atomic_test_and_set'
> 
> configure:5086: result: no
> configure:5097: error: libcap support was requested but the library was not found
> 
> The patch disables BR2_TOOLCHAIN_HAS_ATOMIC_TEST_AND_SET for BR2_arc
> without BR2_ARC_ATOMIC_EXT.
> 
> Fixes:
> - http://autobuild.buildroot.net/results/66ee26677777124eafb4740a3c7437e06f704f98
> 
> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
> ---
>  toolchain/Config.in | 5 +++++
>  1 file changed, 5 insertions(+)

Thanks for the patch, but I'm afraid this is not the right approach. We
don't want to have BR2_* options for each and every atomic_* function.
We already have BR2_TOOLCHAIN_HAS_ATOMIC which serves this purpose.
However, what you need to make sure is to link against libatomic. Could
you try this instead?

Thanks,

Thomas

Patch

diff --git a/toolchain/Config.in b/toolchain/Config.in
index 6e91ab756cd4..6e2856b38ae1 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -855,6 +855,11 @@  config BR2_TOOLCHAIN_HAS_SYNC_4
 	depends on !BR2_sparc
 	depends on !(BR2_arc && !BR2_ARC_ATOMIC_EXT)
 
+config BR2_TOOLCHAIN_HAS_ATOMIC_TEST_AND_SET
+	bool
+	default y
+	depends on !(BR2_arc && !BR2_ARC_ATOMIC_EXT)
+
 # The availability of __sync for 8-byte types on ARM is somewhat
 # complicated:
 #