All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libusb1: Link with -latomic only if no atomic builtins
@ 2022-07-27 12:00 Otavio Salvador
  2022-07-27 15:28 ` [OE-core] " Ross Burton
  0 siblings, 1 reply; 9+ messages in thread
From: Otavio Salvador @ 2022-07-27 12:00 UTC (permalink / raw)
  To: openembedded-core

Backport a fix from 1.0.27 so we only link atomic if no atomic builtins
are available.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
 ...k-with-latomic-only-if-no-atomic-bui.patch | 51 +++++++++++++++++++
 meta/recipes-support/libusb/libusb1_1.0.26.bb |  1 +
 2 files changed, 52 insertions(+)
 create mode 100644 meta/recipes-support/libusb/libusb1/0001-configure.ac-Link-with-latomic-only-if-no-atomic-bui.patch

diff --git a/meta/recipes-support/libusb/libusb1/0001-configure.ac-Link-with-latomic-only-if-no-atomic-bui.patch b/meta/recipes-support/libusb/libusb1/0001-configure.ac-Link-with-latomic-only-if-no-atomic-bui.patch
new file mode 100644
index 0000000000..7c20dc0478
--- /dev/null
+++ b/meta/recipes-support/libusb/libusb1/0001-configure.ac-Link-with-latomic-only-if-no-atomic-bui.patch
@@ -0,0 +1,51 @@
+From a6890a6a9a8f88b567631874e209aaadc79e28e5 Mon Sep 17 00:00:00 2001
+From: Lonnie Abelbeck <lonnie@abelbeck.com>
+Date: Sun, 8 May 2022 14:05:56 -0500
+Subject: [PATCH] configure.ac: Link with -latomic only if no atomic builtins
+
+Follow-up to 561dbda, a check of GCC atomic builtins needs to be done
+first.
+
+I'm no autoconf guru, but using this:
+https://github.com/mesa3d/mesa/blob/0df485c285b73c34ba9062f0c27e55c3c702930d/configure.ac#L469
+as inspiration, I created a pre-check before calling AC_SEARCH_LIBS(...)
+
+Upstream-Status: Backport [1.0.27]
+
+Fixes #1135
+Closes #1139
+(cherry picked from commit 95e601ce116dd46ea7915c171976b85ea0905d58)
+---
+ configure.ac | 16 +++++++++++++++-
+ 1 file changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index d4f12510..96787500 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -153,7 +153,21 @@ if test "x$platform" = xposix; then
+ 	AC_SEARCH_LIBS([pthread_create], [pthread],
+ 		[test "x$ac_cv_search_pthread_create" != "xnone required" && AC_SUBST(THREAD_LIBS, [-lpthread])],
+ 		[], [])
+-	AC_SEARCH_LIBS([__atomic_fetch_add_4], [atomic])
++	dnl Check for new-style atomic builtins. We first check without linking to -latomic.
++	AC_MSG_CHECKING(whether __atomic_load_n is supported)
++	AC_LINK_IFELSE([AC_LANG_SOURCE([[
++	#include <stdint.h>
++	int main() {
++		struct {
++			uint64_t *v;
++		} x;
++		return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE) &
++		       (int)__atomic_add_fetch(x.v, (uint64_t)1, __ATOMIC_ACQ_REL);
++	}]])], GCC_ATOMIC_BUILTINS_SUPPORTED=yes, GCC_ATOMIC_BUILTINS_SUPPORTED=no)
++	AC_MSG_RESULT($GCC_ATOMIC_BUILTINS_SUPPORTED)
++	if test "x$GCC_ATOMIC_BUILTINS_SUPPORTED" != xyes; then
++		AC_SEARCH_LIBS([__atomic_fetch_add_4], [atomic])
++	fi
+ elif test "x$platform" = xwindows; then
+ 	AC_DEFINE([PLATFORM_WINDOWS], [1], [Define to 1 if compiling for a Windows platform.])
+ else
+-- 
+2.37.0
+
diff --git a/meta/recipes-support/libusb/libusb1_1.0.26.bb b/meta/recipes-support/libusb/libusb1_1.0.26.bb
index fd63e7adc2..ff3f0be7a5 100644
--- a/meta/recipes-support/libusb/libusb1_1.0.26.bb
+++ b/meta/recipes-support/libusb/libusb1_1.0.26.bb
@@ -11,6 +11,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=fbc093901857fcd118f065f900982c24"
 BBCLASSEXTEND = "native nativesdk"
 
 SRC_URI = "https://github.com/libusb/libusb/releases/download/v${PV}/libusb-${PV}.tar.bz2 \
+           file://0001-configure.ac-Link-with-latomic-only-if-no-atomic-bui.patch \
            file://run-ptest \
           "
 
-- 
2.37.0



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

* Re: [OE-core] [PATCH] libusb1: Link with -latomic only if no atomic builtins
  2022-07-27 12:00 [PATCH] libusb1: Link with -latomic only if no atomic builtins Otavio Salvador
@ 2022-07-27 15:28 ` Ross Burton
  2022-07-27 16:20   ` Otavio Salvador
  0 siblings, 1 reply; 9+ messages in thread
From: Ross Burton @ 2022-07-27 15:28 UTC (permalink / raw)
  To: otavio; +Cc: openembedded-core

The patch is missing your S-o-b.

Ross

> On 27 Jul 2022, at 13:00, Otavio Salvador via lists.openembedded.org <otavio=ossystems.com.br@lists.openembedded.org> wrote:
> 
> Backport a fix from 1.0.27 so we only link atomic if no atomic builtins
> are available.
> 
> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
> ---
> ...k-with-latomic-only-if-no-atomic-bui.patch | 51 +++++++++++++++++++
> meta/recipes-support/libusb/libusb1_1.0.26.bb |  1 +
> 2 files changed, 52 insertions(+)
> create mode 100644 meta/recipes-support/libusb/libusb1/0001-configure.ac-Link-with-latomic-only-if-no-atomic-bui.patch
> 
> diff --git a/meta/recipes-support/libusb/libusb1/0001-configure.ac-Link-with-latomic-only-if-no-atomic-bui.patch b/meta/recipes-support/libusb/libusb1/0001-configure.ac-Link-with-latomic-only-if-no-atomic-bui.patch
> new file mode 100644
> index 0000000000..7c20dc0478
> --- /dev/null
> +++ b/meta/recipes-support/libusb/libusb1/0001-configure.ac-Link-with-latomic-only-if-no-atomic-bui.patch
> @@ -0,0 +1,51 @@
> +From a6890a6a9a8f88b567631874e209aaadc79e28e5 Mon Sep 17 00:00:00 2001
> +From: Lonnie Abelbeck <lonnie@abelbeck.com>
> +Date: Sun, 8 May 2022 14:05:56 -0500
> +Subject: [PATCH] configure.ac: Link with -latomic only if no atomic builtins
> +
> +Follow-up to 561dbda, a check of GCC atomic builtins needs to be done
> +first.
> +
> +I'm no autoconf guru, but using this:
> +https://github.com/mesa3d/mesa/blob/0df485c285b73c34ba9062f0c27e55c3c702930d/configure.ac#L469
> +as inspiration, I created a pre-check before calling AC_SEARCH_LIBS(...)
> +
> +Upstream-Status: Backport [1.0.27]
> +
> +Fixes #1135
> +Closes #1139
> +(cherry picked from commit 95e601ce116dd46ea7915c171976b85ea0905d58)
> +---
> + configure.ac | 16 +++++++++++++++-
> + 1 file changed, 15 insertions(+), 1 deletion(-)
> +
> +diff --git a/configure.ac b/configure.ac
> +index d4f12510..96787500 100644
> +--- a/configure.ac
> ++++ b/configure.ac
> +@@ -153,7 +153,21 @@ if test "x$platform" = xposix; then
> + 	AC_SEARCH_LIBS([pthread_create], [pthread],
> + 		[test "x$ac_cv_search_pthread_create" != "xnone required" && AC_SUBST(THREAD_LIBS, [-lpthread])],
> + 		[], [])
> +-	AC_SEARCH_LIBS([__atomic_fetch_add_4], [atomic])
> ++	dnl Check for new-style atomic builtins. We first check without linking to -latomic.
> ++	AC_MSG_CHECKING(whether __atomic_load_n is supported)
> ++	AC_LINK_IFELSE([AC_LANG_SOURCE([[
> ++	#include <stdint.h>
> ++	int main() {
> ++		struct {
> ++			uint64_t *v;
> ++		} x;
> ++		return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE) &
> ++		       (int)__atomic_add_fetch(x.v, (uint64_t)1, __ATOMIC_ACQ_REL);
> ++	}]])], GCC_ATOMIC_BUILTINS_SUPPORTED=yes, GCC_ATOMIC_BUILTINS_SUPPORTED=no)
> ++	AC_MSG_RESULT($GCC_ATOMIC_BUILTINS_SUPPORTED)
> ++	if test "x$GCC_ATOMIC_BUILTINS_SUPPORTED" != xyes; then
> ++		AC_SEARCH_LIBS([__atomic_fetch_add_4], [atomic])
> ++	fi
> + elif test "x$platform" = xwindows; then
> + 	AC_DEFINE([PLATFORM_WINDOWS], [1], [Define to 1 if compiling for a Windows platform.])
> + else
> +-- 
> +2.37.0
> +
> diff --git a/meta/recipes-support/libusb/libusb1_1.0.26.bb b/meta/recipes-support/libusb/libusb1_1.0.26.bb
> index fd63e7adc2..ff3f0be7a5 100644
> --- a/meta/recipes-support/libusb/libusb1_1.0.26.bb
> +++ b/meta/recipes-support/libusb/libusb1_1.0.26.bb
> @@ -11,6 +11,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=fbc093901857fcd118f065f900982c24"
> BBCLASSEXTEND = "native nativesdk"
> 
> SRC_URI = "https://github.com/libusb/libusb/releases/download/v${PV}/libusb-${PV}.tar.bz2 \
> +           file://0001-configure.ac-Link-with-latomic-only-if-no-atomic-bui.patch \
>            file://run-ptest \
>           "
> 
> -- 
> 2.37.0
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#168559): https://lists.openembedded.org/g/openembedded-core/message/168559
> Mute This Topic: https://lists.openembedded.org/mt/92647443/6875888
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ross.burton@arm.com]
> -=-=-=-=-=-=-=-=-=-=-=-
> 



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

* Re: [OE-core] [PATCH] libusb1: Link with -latomic only if no atomic builtins
  2022-07-27 15:28 ` [OE-core] " Ross Burton
@ 2022-07-27 16:20   ` Otavio Salvador
  2022-07-27 16:35     ` Ross Burton
  0 siblings, 1 reply; 9+ messages in thread
From: Otavio Salvador @ 2022-07-27 16:20 UTC (permalink / raw)
  To: Ross Burton, Purdie, Richard; +Cc: otavio, openembedded-core

[-- Attachment #1: Type: text/plain, Size: 412 bytes --]

Em qua., 27 de jul. de 2022 às 12:28, Ross Burton <ross.burton@arm.com>
escreveu:

> The patch is missing your S-o-b.
>

The patch isn't mine but a backport. Richard can add it when adding it to
MUT, though.

-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9 9981-7854          Mobile: +1 (347) 903-9750

[-- Attachment #2: Type: text/html, Size: 941 bytes --]

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

* Re: [OE-core] [PATCH] libusb1: Link with -latomic only if no atomic builtins
  2022-07-27 16:20   ` Otavio Salvador
@ 2022-07-27 16:35     ` Ross Burton
  2022-07-27 16:41       ` Otavio Salvador
  0 siblings, 1 reply; 9+ messages in thread
From: Ross Burton @ 2022-07-27 16:35 UTC (permalink / raw)
  To: Otavio Salvador, Purdie, Richard; +Cc: otavio, openembedded-core

[-- Attachment #1: Type: text/plain, Size: 911 bytes --]

Whoever adds the patch needs to add their S-o-b.

Ross

From: Otavio Salvador <otavio.salvador@ossystems.com.br>
Date: Wednesday, 27 July 2022 at 17:20
To: Ross Burton <Ross.Burton@arm.com>, Purdie, Richard <richard.purdie@linuxfoundation.org>
Cc: otavio@ossystems.com.br <otavio@ossystems.com.br>, openembedded-core@lists.openembedded.org <openembedded-core@lists.openembedded.org>
Subject: Re: [OE-core] [PATCH] libusb1: Link with -latomic only if no atomic builtins


Em qua., 27 de jul. de 2022 às 12:28, Ross Burton <ross.burton@arm.com<mailto:ross.burton@arm.com>> escreveu:
The patch is missing your S-o-b.

The patch isn't mine but a backport. Richard can add it when adding it to MUT, though.

--
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9 9981-7854          Mobile: +1 (347) 903-9750

[-- Attachment #2: Type: text/html, Size: 4117 bytes --]

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

* Re: [OE-core] [PATCH] libusb1: Link with -latomic only if no atomic builtins
  2022-07-27 16:35     ` Ross Burton
@ 2022-07-27 16:41       ` Otavio Salvador
  2022-07-27 16:45         ` Khem Raj
  2022-07-27 18:43         ` Ross Burton
  0 siblings, 2 replies; 9+ messages in thread
From: Otavio Salvador @ 2022-07-27 16:41 UTC (permalink / raw)
  To: Ross Burton; +Cc: Purdie, Richard, otavio, openembedded-core

[-- Attachment #1: Type: text/plain, Size: 442 bytes --]

Em qua., 27 de jul. de 2022 às 13:35, Ross Burton <ross.burton@arm.com>
escreveu:

> Whoever adds the patch needs to add their S-o-b.
>

The patch sanity check should warn about it as it does for the status
header. I said, RP can add it.

-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9 9981-7854          Mobile: +1 (347) 903-9750

[-- Attachment #2: Type: text/html, Size: 1154 bytes --]

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

* Re: [OE-core] [PATCH] libusb1: Link with -latomic only if no atomic builtins
  2022-07-27 16:41       ` Otavio Salvador
@ 2022-07-27 16:45         ` Khem Raj
  2022-07-27 16:55           ` Otavio Salvador
  2022-07-27 18:43         ` Ross Burton
  1 sibling, 1 reply; 9+ messages in thread
From: Khem Raj @ 2022-07-27 16:45 UTC (permalink / raw)
  To: Otavio Salvador, Ross Burton; +Cc: Purdie, Richard, otavio, openembedded-core



On 7/27/22 12:41 PM, Otavio Salvador wrote:
> 
> 
> Em qua., 27 de jul. de 2022 às 13:35, Ross Burton <ross.burton@arm.com 
> <mailto:ross.burton@arm.com>> escreveu:
> 
>     Whoever adds the patch needs to add their S-o-b.
> 
> 
> The patch sanity check should warn about it as it does for the status 
> header. I said, RP can add it.

RP can do, but he can only do so much :) lets try to help him.
Its not something that can be added during applying patch which could be 
done, this needs to change the libusb1 patch and then final patch 
regenerated, its better if it can be done by you and resend a v2.

> -- 
> Otavio Salvador                             O.S. Systems
> http://www.ossystems.com.br <http://www.ossystems.com.br> 
> http://code.ossystems.com.br <http://code.ossystems.com.br>
> Mobile: +55 (53) 9 9981-7854          Mobile: +1 (347) 903-9750
> 
> 
> 
> 

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

* Re: [OE-core] [PATCH] libusb1: Link with -latomic only if no atomic builtins
  2022-07-27 16:45         ` Khem Raj
@ 2022-07-27 16:55           ` Otavio Salvador
  2022-07-27 17:56             ` Alexander Kanavin
  0 siblings, 1 reply; 9+ messages in thread
From: Otavio Salvador @ 2022-07-27 16:55 UTC (permalink / raw)
  To: Khem Raj; +Cc: Ross Burton, Purdie, Richard, otavio, openembedded-core

[-- Attachment #1: Type: text/plain, Size: 1690 bytes --]

Sent :-)

Em qua., 27 de jul. de 2022 às 13:45, Khem Raj <raj.khem@gmail.com>
escreveu:

>
>
> On 7/27/22 12:41 PM, Otavio Salvador wrote:
> >
> >
> > Em qua., 27 de jul. de 2022 às 13:35, Ross Burton <ross.burton@arm.com
> > <mailto:ross.burton@arm.com>> escreveu:
> >
> >     Whoever adds the patch needs to add their S-o-b.
> >
> >
> > The patch sanity check should warn about it as it does for the status
> > header. I said, RP can add it.
>
> RP can do, but he can only do so much :) lets try to help him.
> Its not something that can be added during applying patch which could be
> done, this needs to change the libusb1 patch and then final patch
> regenerated, its better if it can be done by you and resend a v2.
>
> > --
> > Otavio Salvador                             O.S. Systems
> > http://www.ossystems.com.br <http://www.ossystems.com.br>
> > http://code.ossystems.com.br <http://code.ossystems.com.br>
> > Mobile: +55 (53) 9 9981-7854          Mobile: +1 (347) 903-9750
> >
> >
> >
> >
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#168577):
> https://lists.openembedded.org/g/openembedded-core/message/168577
> Mute This Topic: https://lists.openembedded.org/mt/92647443/3617537
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> otavio.salvador@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>

-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9 9981-7854          Mobile: +1 (347) 903-9750

[-- Attachment #2: Type: text/html, Size: 3249 bytes --]

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

* Re: [OE-core] [PATCH] libusb1: Link with -latomic only if no atomic builtins
  2022-07-27 16:55           ` Otavio Salvador
@ 2022-07-27 17:56             ` Alexander Kanavin
  0 siblings, 0 replies; 9+ messages in thread
From: Alexander Kanavin @ 2022-07-27 17:56 UTC (permalink / raw)
  To: Otavio Salvador
  Cc: Khem Raj, Ross Burton, Purdie, Richard, otavio, openembedded-core

Adding s-o-b in behalf of others is not allowed, it's akin to a
signature - it literally says 'signed off by me'. The only s-o-b you
can add is your own.

Besides, RP should not be fixing up things for you, and when he does
it's a favour and not an entitlement.

Alex

On Wed, 27 Jul 2022 at 18:56, Otavio Salvador
<otavio.salvador@ossystems.com.br> wrote:
>
> Sent :-)
>
> Em qua., 27 de jul. de 2022 às 13:45, Khem Raj <raj.khem@gmail.com> escreveu:
>>
>>
>>
>> On 7/27/22 12:41 PM, Otavio Salvador wrote:
>> >
>> >
>> > Em qua., 27 de jul. de 2022 às 13:35, Ross Burton <ross.burton@arm.com
>> > <mailto:ross.burton@arm.com>> escreveu:
>> >
>> >     Whoever adds the patch needs to add their S-o-b.
>> >
>> >
>> > The patch sanity check should warn about it as it does for the status
>> > header. I said, RP can add it.
>>
>> RP can do, but he can only do so much :) lets try to help him.
>> Its not something that can be added during applying patch which could be
>> done, this needs to change the libusb1 patch and then final patch
>> regenerated, its better if it can be done by you and resend a v2.
>>
>> > --
>> > Otavio Salvador                             O.S. Systems
>> > http://www.ossystems.com.br <http://www.ossystems.com.br>
>> > http://code.ossystems.com.br <http://code.ossystems.com.br>
>> > Mobile: +55 (53) 9 9981-7854          Mobile: +1 (347) 903-9750
>> >
>> >
>> >
>> >
>>
>>
>>
>
>
> --
> Otavio Salvador                             O.S. Systems
> http://www.ossystems.com.br        http://code.ossystems.com.br
> Mobile: +55 (53) 9 9981-7854          Mobile: +1 (347) 903-9750
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#168580): https://lists.openembedded.org/g/openembedded-core/message/168580
> Mute This Topic: https://lists.openembedded.org/mt/92647443/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>


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

* Re: [OE-core] [PATCH] libusb1: Link with -latomic only if no atomic builtins
  2022-07-27 16:41       ` Otavio Salvador
  2022-07-27 16:45         ` Khem Raj
@ 2022-07-27 18:43         ` Ross Burton
  1 sibling, 0 replies; 9+ messages in thread
From: Ross Burton @ 2022-07-27 18:43 UTC (permalink / raw)
  To: Otavio Salvador; +Cc: Purdie, Richard, otavio, openembedded-core

[-- Attachment #1: Type: text/plain, Size: 484 bytes --]

> The patch sanity check should warn about it as it does for the status header. I said, RP can add it.

Easier said than done when a patch already contains S-o-b and we want to allow people to S-o-b from their corporate accounts whilst posting patches from their personal account.

Ross
--
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9 9981-7854          Mobile: +1 (347) 903-9750

[-- Attachment #2: Type: text/html, Size: 2609 bytes --]

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

end of thread, other threads:[~2022-07-27 18:44 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-27 12:00 [PATCH] libusb1: Link with -latomic only if no atomic builtins Otavio Salvador
2022-07-27 15:28 ` [OE-core] " Ross Burton
2022-07-27 16:20   ` Otavio Salvador
2022-07-27 16:35     ` Ross Burton
2022-07-27 16:41       ` Otavio Salvador
2022-07-27 16:45         ` Khem Raj
2022-07-27 16:55           ` Otavio Salvador
2022-07-27 17:56             ` Alexander Kanavin
2022-07-27 18:43         ` Ross Burton

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.