[oe,meta-oe,2/5] libkcapi: Move static inline functions where used

Message ID 20191118050352.1379153-2-raj.khem@gmail.com
State New
Headers show
Series
  • [oe,meta-oe,1/5] libmad: Define O2 for all arches as default optimization
Related show

Commit Message

Khem Raj Nov. 18, 2019, 5:03 a.m.
Clang warns about unused functions on some arches e.g. mips
unused function '_bswap32' [-Werror,-Wunused-function]

Signed-off-by: Khem Raj <raj.khem@gmail.com>

---
 .../0001-kcapi-kdf-Move-code-to-fix.patch     | 67 +++++++++++++++++++
 .../recipes-crypto/libkcapi/libkcapi_git.bb   |  1 +
 2 files changed, 68 insertions(+)
 create mode 100644 meta-oe/recipes-crypto/libkcapi/libkcapi/0001-kcapi-kdf-Move-code-to-fix.patch

-- 
2.24.0

-- 
_______________________________________________
Openembedded-devel mailing list
Openembedded-devel@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

Patch

diff --git a/meta-oe/recipes-crypto/libkcapi/libkcapi/0001-kcapi-kdf-Move-code-to-fix.patch b/meta-oe/recipes-crypto/libkcapi/libkcapi/0001-kcapi-kdf-Move-code-to-fix.patch
new file mode 100644
index 0000000000..3801207ed9
--- /dev/null
+++ b/meta-oe/recipes-crypto/libkcapi/libkcapi/0001-kcapi-kdf-Move-code-to-fix.patch
@@ -0,0 +1,67 @@ 
+From bf6c816ef61240a1dbbbf6f2a7b2a5ad5f846461 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 16 Nov 2019 23:03:51 -0800
+Subject: [PATCH] kcapi-kdf: Move code to fix
+
+Fixes clang build
+unused function '_bswap32' [-Werror,-Wunused-function]
+
+Upstream-Status: Submitted [https://github.com/smuellerDD/libkcapi/pull/83]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ lib/kcapi-kdf.c | 32 +++++++++++++++++---------------
+ 1 file changed, 17 insertions(+), 15 deletions(-)
+
+diff --git a/lib/kcapi-kdf.c b/lib/kcapi-kdf.c
+index ea39846..49c2d88 100644
+--- a/lib/kcapi-kdf.c
++++ b/lib/kcapi-kdf.c
+@@ -54,21 +54,6 @@
+ #include "kcapi.h"
+ #include "internal.h"
+ 
+-static inline uint32_t rol32(uint32_t x, int n)
+-{
+-	return ( (x << (n&(32-1))) | (x >> ((32-n)&(32-1))) );
+-}
+-
+-static inline uint32_t ror32(uint32_t x, int n)
+-{
+-	return ( (x >> (n&(32-1))) | (x << ((32-n)&(32-1))) );
+-}
+-
+-static inline uint32_t _bswap32(uint32_t x)
+-{
+-	return ((rol32(x, 8) & 0x00ff00ffL) | (ror32(x, 8) & 0xff00ff00L));
+-}
+-
+ #define GCC_VERSION (__GNUC__ * 10000		\
+ 		     + __GNUC_MINOR__ * 100	\
+ 		     + __GNUC_PATCHLEVEL__)
+@@ -86,6 +71,23 @@ static inline uint32_t _bswap32(uint32_t x)
+ #if __BYTE_ORDER__ ==  __ORDER_BIG_ENDIAN__
+ # define be_bswap32(x) ((uint32_t)(x))
+ #elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
++
++static inline uint32_t rol32(uint32_t x, int n)
++{
++	return ( (x << (n&(32-1))) | (x >> ((32-n)&(32-1))) );
++}
++
++static inline uint32_t ror32(uint32_t x, int n)
++{
++	return ( (x >> (n&(32-1))) | (x << ((32-n)&(32-1))) );
++}
++
++
++static inline uint32_t _bswap32(uint32_t x)
++{
++	return ((rol32(x, 8) & 0x00ff00ffL) | (ror32(x, 8) & 0xff00ff00L));
++}
++
+ # define be_bswap32(x) _swap32(x)
+ #else
+ #error "Endianess not defined"
+-- 
+2.24.0
+
diff --git a/meta-oe/recipes-crypto/libkcapi/libkcapi_git.bb b/meta-oe/recipes-crypto/libkcapi/libkcapi_git.bb
index 799070972a..aa438e5859 100644
--- a/meta-oe/recipes-crypto/libkcapi/libkcapi_git.bb
+++ b/meta-oe/recipes-crypto/libkcapi/libkcapi_git.bb
@@ -10,6 +10,7 @@  SRCREV = "5649050d201856bf06c8738b5d2aa1710c86ac2f"
 PV = "1.1.5"
 SRC_URI = " \
     git://github.com/smuellerDD/libkcapi.git \
+    file://0001-kcapi-kdf-Move-code-to-fix.patch \
 "
 
 inherit autotools