package/ibm-sw-tpm2: fix patch to address musl builds
authorVincent Fazio <vfazio@gmail.com>
Thu, 30 Apr 2020 19:44:21 +0000 (14:44 -0500)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Sat, 15 Aug 2020 21:30:08 +0000 (23:30 +0200)
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/

Signed-off-by: Vincent Fazio <vfazio@gmail.com>
Signed-off-by: Vincent Fazio <vfazio@xes-inc.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
package/ibm-sw-tpm2/0001-Use-LONG_BIT-to-define-RADIX_BITS.patch [new file with mode: 0644]
package/ibm-sw-tpm2/0001-Use-__WORDSIZE-to-define-RADIX_BITS.patch [deleted file]

diff --git a/package/ibm-sw-tpm2/0001-Use-LONG_BIT-to-define-RADIX_BITS.patch b/package/ibm-sw-tpm2/0001-Use-LONG_BIT-to-define-RADIX_BITS.patch
new file mode 100644 (file)
index 0000000..3a7e02b
--- /dev/null
@@ -0,0 +1,45 @@
+From 24a352fc99ebde22235b05b18615817ef7f4263c Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
+Date: Sun, 26 Apr 2020 15:33:39 +0200
+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 <thomas.petazzoni@bootlin.com>
+Signed-off-by: Vincent Fazio <vfazio@gmail.com>
+---
+ src/LibSupport.h | 17 +++--------------
+ 1 file changed, 3 insertions(+), 14 deletions(-)
+
+diff --git a/src/LibSupport.h b/src/LibSupport.h
+index b2e6a51..f064d20 100644
+--- a/src/LibSupport.h
++++ b/src/LibSupport.h
+@@ -64,20 +64,9 @@
+ #ifndef _LIB_SUPPORT_H_
+ #define _LIB_SUPPORT_H_
+-#ifndef RADIX_BITS
+-#   if defined(__x86_64__) || defined(__x86_64)                               \
+-    || defined(__amd64__) || defined(__amd64) || defined(_WIN64) || defined(_M_X64) \
+-    || defined(_M_ARM64) || defined(__aarch64__) \
+-    || defined(__powerpc64__) || defined(__ppc64__)
+-#       define RADIX_BITS                      64
+-#   elif defined(__i386__) || defined(__i386) || defined(i386)                \
+-    || defined(_WIN32) || defined(_M_IX86)                            \
+-    || defined(_M_ARM) || defined(__arm__) || defined(__thumb__)
+-#       define RADIX_BITS                      32
+-#   else
+-#       error Unable to determine RADIX_BITS from compiler environment
+-#   endif
+-#endif // RADIX_BITS
++#include <limits.h>
++
++#define RADIX_BITS LONG_BIT
+ // These macros use the selected libraries to the proper include files.
+ #define LIB_QUOTE(_STRING_) #_STRING_
+-- 
+2.25.3
+
diff --git a/package/ibm-sw-tpm2/0001-Use-__WORDSIZE-to-define-RADIX_BITS.patch b/package/ibm-sw-tpm2/0001-Use-__WORDSIZE-to-define-RADIX_BITS.patch
deleted file mode 100644 (file)
index a19160f..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-From 24a352fc99ebde22235b05b18615817ef7f4263c Mon Sep 17 00:00:00 2001
-From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
-Date: Sun, 26 Apr 2020 15:33:39 +0200
-Subject: [PATCH] Use __WORDSIZE to define RADIX_BITS
-
-This allows to avoid having to support each CPU architecture
-individually.
-
-Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
----
- src/LibSupport.h | 17 +++--------------
- 1 file changed, 3 insertions(+), 14 deletions(-)
-
-diff --git a/src/LibSupport.h b/src/LibSupport.h
-index b2e6a51..f064d20 100644
---- a/src/LibSupport.h
-+++ b/src/LibSupport.h
-@@ -64,20 +64,9 @@
- #ifndef _LIB_SUPPORT_H_
- #define _LIB_SUPPORT_H_
--#ifndef RADIX_BITS
--#   if defined(__x86_64__) || defined(__x86_64)                               \
--    || defined(__amd64__) || defined(__amd64) || defined(_WIN64) || defined(_M_X64) \
--    || defined(_M_ARM64) || defined(__aarch64__) \
--    || defined(__powerpc64__) || defined(__ppc64__)
--#       define RADIX_BITS                      64
--#   elif defined(__i386__) || defined(__i386) || defined(i386)                \
--    || defined(_WIN32) || defined(_M_IX86)                            \
--    || defined(_M_ARM) || defined(__arm__) || defined(__thumb__)
--#       define RADIX_BITS                      32
--#   else
--#       error Unable to determine RADIX_BITS from compiler environment
--#   endif
--#endif // RADIX_BITS
-+#include <limits.h>
-+
-+#define RADIX_BITS __WORDSIZE
- // These macros use the selected libraries to the proper include files.
- #define LIB_QUOTE(_STRING_) #_STRING_
--- 
-2.25.3
-