Skip to contentSkip to conversation

package/ibm-sw-tpm2: fix patch to address musl builds

PATCH New Vincent Fazio 3 participants 4 messages Apr 30, 2020 – Aug 28, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/ibm-sw-tpm2: fix patch to address musl builds

From: Vincent Fazio <[email protected]>

Previously, __WORDSIZE was being used to define RADIX_BITS.

__WORDSIZE is not defined consistently via limits.h across all libc variants, so use LONG_BIT instead.

Fixes:

http://autobuild.buildroot.net/results/b5cb347a98dc64f77982633c0fc48d14030aa5b6/

---
 ...TS.patch => 0001-Use-LONG_BIT-to-define-RADIX_BITS.patch} | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
 rename package/ibm-sw-tpm2/{0001-Use-__WORDSIZE-to-define-RADIX_BITS.patch => 0001-Use-LONG_BIT-to-define-RADIX_BITS.patch} (91%)
package/ibm-sw-tpm2/0001-Use-LONG_BIT-to-define-RADIX_BITS.patch renamed from package/ibm-sw-tpm2/0001-Use-__WORDSIZE-to-define-RADIX_BITS.patch +3 -2
similarity index 91%
rename from package/ibm-sw-tpm2/0001-Use-__WORDSIZE-to-define-RADIX_BITS.patch
rename to package/ibm-sw-tpm2/0001-Use-LONG_BIT-to-define-RADIX_BITS.patch
index a19160f68c..3a7e02ba7a 100644
@@ -1,12 +1,13 @@
 From 24a352fc99ebde22235b05b18615817ef7f4263c Mon Sep 17 00:00:00 2001
 From: Thomas Petazzoni <[email protected]>
 Date: Sun, 26 Apr 2020 15:33:39 +0200
-Subject: [PATCH] Use __WORDSIZE to define RADIX_BITS
+Subject: [PATCH] Use LONG_BIT to define RADIX_BITS
 
 This allows to avoid having to support each CPU architecture
 individually.
 
 Signed-off-by: Thomas Petazzoni <[email protected]>
+Signed-off-by: Vincent Fazio <[email protected]>
 ---
  src/LibSupport.h | 17 +++--------------
  1 file changed, 3 insertions(+), 14 deletions(-)
@@ -35,7 +36,7 @@ index b2e6a51..f064d20 100644
 -#endif // RADIX_BITS
 +#include <limits.h>
 +
-+#define RADIX_BITS __WORDSIZE
++#define RADIX_BITS LONG_BIT
  
  // These macros use the selected libraries to the proper include files.
  #define LIB_QUOTE(_STRING_) #_STRING_
Signature · 1 line
2.26.2
#1 lore raw

PATCH 1/1 package/ibm-sw-tpm2: fix patch to address musl builds

Note, if we don't like this option i've also seen other packages do something akin to:

#if ULONG_MAX == 0xffffffff
#define RADIX_BITS 32
#elif ULONG_MAX == 0xffffffffffffffff
#define RADIX_BITS 64
#else
#error "Unsupported radix size"
#endif

Vincent Fazio
Embedded Software Engineer - Linux
Extreme Engineering Solutions, Inc
http://www.xes-inc.com

Quoted 41 lines · Vincent Fazio

From: Vincent Fazio <[email protected]>

Previously, __WORDSIZE was being used to define RADIX_BITS.

__WORDSIZE is not defined consistently via limits.h across all libc variants, so use LONG_BIT instead.

Fixes:

   http://autobuild.buildroot.net/results/b5cb347a98dc64f77982633c0fc48d14030aa5b6/
---
  ...TS.patch => 0001-Use-LONG_BIT-to-define-RADIX_BITS.patch} | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)

rename package/ibm-sw-tpm2/{0001-Use-__WORDSIZE-to-define-RADIX_BITS.patch => 0001-Use-LONG_BIT-to-define-RADIX_BITS.patch} (91%)

package/ibm-sw-tpm2/0001-Use-LONG_BIT-to-define-RADIX_BITS.patch renamed from package/ibm-sw-tpm2/0001-Use-__WORDSIZE-to-define-RADIX_BITS.patch +2 -1
similarity index 91%
rename from package/ibm-sw-tpm2/0001-Use-__WORDSIZE-to-define-RADIX_BITS.patch
rename to package/ibm-sw-tpm2/0001-Use-LONG_BIT-to-define-RADIX_BITS.patch
index a19160f68c..3a7e02ba7a 100644
@@ -1,12 +1,13 @@
  From 24a352fc99ebde22235b05b18615817ef7f4263c Mon Sep 17 00:00:00 2001
  From: Thomas Petazzoni <[email protected]>
  Date: Sun, 26 Apr 2020 15:33:39 +0200
-Subject: [PATCH] Use __WORDSIZE to define RADIX_BITS
+Subject: [PATCH] Use LONG_BIT to define RADIX_BITS
 
  This allows to avoid having to support each CPU architecture
  individually.
 
  Signed-off-by: Thomas Petazzoni <[email protected]>
+Signed-off-by: Vincent Fazio <[email protected]>
  ---
   src/LibSupport.h | 17 +++--------------
   1 file changed, 3 insertions(+), 14 deletions(-)

package/ibm-sw-tpm2/0001-Use-LONG_BIT-to-define-RADIX_BITS.patch index b2e6a51..f064d20 100644 · line 42

Quoted 8 lines
package/ibm-sw-tpm2/0001-Use-LONG_BIT-to-define-RADIX_BITS.patch renamed from package/ibm-sw-tpm2/0001-Use-__WORDSIZE-to-define-RADIX_BITS.patch +1 -1
@@ -35,7 +36,7 @@ index b2e6a51..f064d20 100644
  -#endif // RADIX_BITS
  +#include <limits.h>
  +
-+#define RADIX_BITS __WORDSIZE
++#define RADIX_BITS LONG_BIT
 
   // These macros use the selected libraries to the proper include files.
   #define LIB_QUOTE(_STRING_) #_STRING_

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20200501/df20f264/attachment.html>

#2 lore raw

PATCH 1/1 package/ibm-sw-tpm2: fix patch to address musl builds

In reply to Vincent Fazio
Quoted 9 lines · On Thu, 30 Apr 2020 14:44:21 -0500 Vincent Fazio <[email protected]> wrote:

From: Vincent Fazio <[email protected]>

Previously, __WORDSIZE was being used to define RADIX_BITS.

__WORDSIZE is not defined consistently via limits.h across all libc variants, so use LONG_BIT instead.

Fixes:

Quoted 8 lines

http://autobuild.buildroot.net/results/b5cb347a98dc64f77982633c0fc48d14030aa5b6/

---
 ...TS.patch => 0001-Use-LONG_BIT-to-define-RADIX_BITS.patch} | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
 rename package/ibm-sw-tpm2/{0001-Use-__WORDSIZE-to-define-RADIX_BITS.patch => 0001-Use-LONG_BIT-to-define-RADIX_BITS.patch} (91%)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#3 lore raw

PATCH 1/1 package/ibm-sw-tpm2: fix patch to address musl builds

Quoted 14 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Quoted 9 lines · On Thu, 30 Apr 2020 14:44:21 -0500 Vincent Fazio <[email protected]> wrote:

From: Vincent Fazio <[email protected]>

Previously, __WORDSIZE was being used to define RADIX_BITS.

__WORDSIZE is not defined consistently via limits.h across all libc variants, so use LONG_BIT instead.

Fixes:

Quoted 8 lines
Quoted 8 lines

http://autobuild.buildroot.net/results/b5cb347a98dc64f77982633c0fc48d14030aa5b6/

---
...TS.patch => 0001-Use-LONG_BIT-to-define-RADIX_BITS.patch} | 5 +++--

1 file changed, 3 insertions(+), 2 deletions(-)

rename package/ibm-sw-tpm2/{0001-Use-__WORDSIZE-to-define-RADIX_BITS.patch => 0001-Use-LONG_BIT-to-define-RADIX_BITS.patch} (91%)

Committed to 2020.05.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard