Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 2/2] package/tcf-agent: fix uClibc-ng compile on ARM
@ 2023-08-13  7:23 Waldemar Brodkorb
  2023-08-14 14:53 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 4+ messages in thread
From: Waldemar Brodkorb @ 2023-08-13  7:23 UTC (permalink / raw)
  To: buildroot; +Cc: Eugene Tarassov, Norbert Lange

When a shared build is used, we can use getauxval and no ARM only
instuctions are in use.

When a static build is used, we need to override, as uClibc-ng only
supports getauxval for shared case.

Fixes:
 - http://autobuild.buildroot.net/results/3b5/3b5c5519a3e5ee490308bc1a1b9579ce13417235

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
---
 .../0001-fix-uClibc-ng-compile.patch          | 27 +++++++++++++++++++
 package/tcf-agent/tcf-agent.mk                |  6 +++++
 2 files changed, 33 insertions(+)
 create mode 100644 package/tcf-agent/0001-fix-uClibc-ng-compile.patch

diff --git a/package/tcf-agent/0001-fix-uClibc-ng-compile.patch b/package/tcf-agent/0001-fix-uClibc-ng-compile.patch
new file mode 100644
index 0000000000..b8f46f3c48
--- /dev/null
+++ b/package/tcf-agent/0001-fix-uClibc-ng-compile.patch
@@ -0,0 +1,27 @@
+From a78007cd139e1dea3d893f5fe1d1c3a47503e6a2 Mon Sep 17 00:00:00 2001
+From: Waldemar Brodkorb <wbx@openadk.org>
+Date: Sat, 12 Aug 2023 18:27:02 +0200
+Subject: [PATCH] fix uClibc-ng compile
+
+Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
+Upstream: N/A only mail available
+---
+ agent/machine/arm/tcf/cpudefs-mdep.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/agent/machine/arm/tcf/cpudefs-mdep.c b/agent/machine/arm/tcf/cpudefs-mdep.c
+index 051631a0..7c4fbf3e 100644
+--- a/agent/machine/arm/tcf/cpudefs-mdep.c
++++ b/agent/machine/arm/tcf/cpudefs-mdep.c
+@@ -21,7 +21,7 @@
+ 
+ #ifndef USE_getauxval
+ #  include <features.h>
+-#  define USE_getauxval (defined(__GLIBC__) && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 16)))
++#  define USE_getauxval (defined(__GLIBC__) && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 16)) || (defined(__UCLIBC__) && defined(__HAVE_SHARED__)))
+ #endif
+ 
+ #include <stddef.h>
+-- 
+2.39.2
+
diff --git a/package/tcf-agent/tcf-agent.mk b/package/tcf-agent/tcf-agent.mk
index 2b8a61b66f..7859d0ed43 100644
--- a/package/tcf-agent/tcf-agent.mk
+++ b/package/tcf-agent/tcf-agent.mk
@@ -21,6 +21,12 @@ TCF_AGENT_CONF_OPTS = \
 	-DBUILD_SHARED_LIBS=OFF \
 	-DTCF_MACHINE=$(call qstrip,$(BR2_PACKAGE_TCF_AGENT_ARCH))
 
+ifeq ($(BR2_STATIC_LIBS),y)
+ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)
+TCF_AGENT_CONF_OPTS += -DCMAKE_C_FLAGS="$(TARGET_CFLAGS) -marm"
+endif
+endif
+
 define TCF_AGENT_INSTALL_INIT_SYSTEMD
 	$(INSTALL) -D -m 644 package/tcf-agent/tcf-agent.service \
 		$(TARGET_DIR)/usr/lib/systemd/system/tcf-agent.service
-- 
2.39.2

_______________________________________________
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 2/2] package/tcf-agent: fix uClibc-ng compile on ARM
  2023-08-13  7:23 [Buildroot] [PATCH 2/2] package/tcf-agent: fix uClibc-ng compile on ARM Waldemar Brodkorb
@ 2023-08-14 14:53 ` Thomas Petazzoni via buildroot
  2023-08-15  3:36   ` Waldemar Brodkorb
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Petazzoni via buildroot @ 2023-08-14 14:53 UTC (permalink / raw)
  To: Waldemar Brodkorb; +Cc: Eugene Tarassov, Norbert Lange, buildroot

On Sun, 13 Aug 2023 09:23:44 +0200
Waldemar Brodkorb <wbx@openadk.org> wrote:

> +ifeq ($(BR2_STATIC_LIBS),y)
> +ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)
> +TCF_AGENT_CONF_OPTS += -DCMAKE_C_FLAGS="$(TARGET_CFLAGS) -marm"
> +endif
> +endif

What is the situation with musl?

With glibc, BR2_STATIC_LIBS=y is impossible.

But with musl, BR2_STATIC_LIBS=y is possible. Is getauxval() always
supported on musl, regardless of static or shared?

Also, shouldn't the horrible "#  define USE_getauxval
(defined(__GLIBC__) && (__GLIBC__ > 2 || (__GLIBC__ == 2 &&
__GLIBC_MINOR__ >= 16)) || (defined(__UCLIBC__) &&
defined(__HAVE_SHARED__)))" be turned into a proper CMake test ?

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 2/2] package/tcf-agent: fix uClibc-ng compile on ARM
  2023-08-14 14:53 ` Thomas Petazzoni via buildroot
@ 2023-08-15  3:36   ` Waldemar Brodkorb
  2023-08-17  9:59     ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 4+ messages in thread
From: Waldemar Brodkorb @ 2023-08-15  3:36 UTC (permalink / raw)
  To: Thomas Petazzoni; +Cc: Eugene Tarassov, Norbert Lange, buildroot

Hi Thomas,
Thomas Petazzoni wrote,

> On Sun, 13 Aug 2023 09:23:44 +0200
> Waldemar Brodkorb <wbx@openadk.org> wrote:
> 
> > +ifeq ($(BR2_STATIC_LIBS),y)
> > +ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)
> > +TCF_AGENT_CONF_OPTS += -DCMAKE_C_FLAGS="$(TARGET_CFLAGS) -marm"
> > +endif
> > +endif
> 
> What is the situation with musl?

Musl works fine with static and shared without this patch.
How should a v2 look like? 
 
> With glibc, BR2_STATIC_LIBS=y is impossible.
> 
> But with musl, BR2_STATIC_LIBS=y is possible. Is getauxval() always
> supported on musl, regardless of static or shared?

Yes.
 
> Also, shouldn't the horrible "#  define USE_getauxval
> (defined(__GLIBC__) && (__GLIBC__ > 2 || (__GLIBC__ == 2 &&
> __GLIBC_MINOR__ >= 16)) || (defined(__UCLIBC__) &&
> defined(__HAVE_SHARED__)))" be turned into a proper CMake test ?

That might be something upstream should do. :)

best regards
 Waldemar
_______________________________________________
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 2/2] package/tcf-agent: fix uClibc-ng compile on ARM
  2023-08-15  3:36   ` Waldemar Brodkorb
@ 2023-08-17  9:59     ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Petazzoni via buildroot @ 2023-08-17  9:59 UTC (permalink / raw)
  To: Waldemar Brodkorb; +Cc: Eugene Tarassov, Norbert Lange, buildroot

On Tue, 15 Aug 2023 05:36:14 +0200
Waldemar Brodkorb <wbx@openadk.org> wrote:

> > What is the situation with musl?  
> 
> Musl works fine with static and shared without this patch.
> How should a v2 look like? 

Is there a reason why uClibc-ng doesn't support getauxval() with static
linking? If musl does it, probably it can be done?

Otherwise, if we want to stick to that, it could be:

# Some good explanation goes here
ifeq ($(BR2_STATIC_LIBS)$(BR2_TOOLCHAIN_USES_UCLIBC)$(BR2_ARM_INSTRUCTIONS_THUMB),yyy)
TCF_AGENT_CONF_OPTS += -DCMAKE_C_FLAGS="$(TARGET_CFLAGS) -marm"
endif

> > Also, shouldn't the horrible "#  define USE_getauxval
> > (defined(__GLIBC__) && (__GLIBC__ > 2 || (__GLIBC__ == 2 &&
> > __GLIBC_MINOR__ >= 16)) || (defined(__UCLIBC__) &&
> > defined(__HAVE_SHARED__)))" be turned into a proper CMake test ?  
> 
> That might be something upstream should do. :)

Well, we generally try to have upstreamable patches in Buildroot, and
the project seems relatively active
(https://git.eclipse.org/c/tcf/org.eclipse.tcf.agent.git/log/), so
there is a good chance to get our patch merged.

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

end of thread, other threads:[~2023-08-17  9:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-13  7:23 [Buildroot] [PATCH 2/2] package/tcf-agent: fix uClibc-ng compile on ARM Waldemar Brodkorb
2023-08-14 14:53 ` Thomas Petazzoni via buildroot
2023-08-15  3:36   ` Waldemar Brodkorb
2023-08-17  9:59     ` 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