package/libnss: fix build failure with ARM without NEON extension
PATCH 1/4 package/libnss: fix build failure with ARM without NEON extension
At the moment libnss assumes that every ARM has NEON extension but it's not that way. So add a patch to make it aware of it and use native functions in place of NEON optimized ones.
---
Already sent upstream:
https://bugzilla.mozilla.org/show_bug.cgi?id=1590676
--- ...ix-build-if-arm-doesn-t-support-NEON.patch | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 package/libnss/0003-Bug-1590676-Fix-build-if-arm-doesn-t-support-NEON.patch
package/libnss/0003-Bug-1590676-Fix-build-if-arm-doesn-t-support-NEON.patch new file +47 -0
@@ -0,0 +1,47 @@ +From 946bc2864b0de7b63a4ec415e42e622d591a8753 Mon Sep 17 00:00:00 2001 +From: Giulio Benetti <[email protected]> +Date: Wed, 23 Oct 2019 11:47:03 +0200 +Subject: [PATCH] Bug 1590676 - Fix build if arm doesn't support NEON + +At the moment NSS assumes that ARM supports NEON extension but this is +not true and leads to build failure on ARM without NEON extension. +Add check to assure USE_HW_AES is not defined if ARM without NEON +extension is used. + +Signed-off-by: Giulio Benetti <[email protected]> +--- + nss/lib/freebl/aes-armv8.c | 3 ++- + nss/lib/freebl/rijndael.c | 3 ++- + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/nss/lib/freebl/aes-armv8.c b/nss/lib/freebl/aes-armv8.c +index 40d5e2d34..a5df53891 100644 +--- a/nss/lib/freebl/aes-armv8.c ++++ b/nss/lib/freebl/aes-armv8.c +@@ -7,7 +7,8 @@ + + #if (defined(__clang__) || \ + (defined(__GNUC__) && defined(__GNUC_MINOR__) && \ +- (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 8)))) ++ (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 8))) && \ ++ (defined(__ARM_NEON) || defined(__ARM_NEON__))) + + #ifndef __ARM_FEATURE_CRYPTO + #error "Compiler option is invalid" +diff --git a/nss/lib/freebl/rijndael.c b/nss/lib/freebl/rijndael.c +index 26bd58ee0..23893f419 100644 +--- a/nss/lib/freebl/rijndael.c ++++ b/nss/lib/freebl/rijndael.c +@@ -20,7 +20,8 @@ + #include "gcm.h" + #include "mpi.h" + +-#if !defined(IS_LITTLE_ENDIAN) && !defined(NSS_X86_OR_X64) ++#if (!defined(IS_LITTLE_ENDIAN) && !defined(NSS_X86_OR_X64)) || \ ++ (!defined(__ARM_NEON) && !defined(__ARM_NEON__)) + // not test yet on big endian platform of arm + #undef USE_HW_AES + #endif +-- +2.20.1 +
Signature · 1 line
2.20.1
PATCH 2/4 package/libnss: fix build warning
Add patch to fix build warning due to uninitialized variable.
---
https://bugzilla.mozilla.org/show_bug.cgi?id=1590678
--- ...ve-Wmaybe-uninitialized-warning-in-t.patch | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 package/libnss/0004-Bug-1590678-Remove-Wmaybe-uninitialized-warning-in-t.patch
package/libnss/0004-Bug-1590678-Remove-Wmaybe-uninitialized-warning-in-t.patch new file +27 -0
@@ -0,0 +1,27 @@ +From 24bcc8860310149da1524dbf25f3bc77f6476b11 Mon Sep 17 00:00:00 2001 +From: Giulio Benetti <[email protected]> +Date: Wed, 23 Oct 2019 11:58:12 +0200 +Subject: [PATCH] Bug 1590678 - Remove -Wmaybe-uninitialized warning in + tls13esni.c + +Signed-off-by: Giulio Benetti <[email protected]> +--- + nss/lib/ssl/tls13esni.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/nss/lib/ssl/tls13esni.c b/nss/lib/ssl/tls13esni.c +index 4d2e12d62..a7ce6f568 100644 +--- a/nss/lib/ssl/tls13esni.c ++++ b/nss/lib/ssl/tls13esni.c +@@ -728,7 +728,7 @@ tls13_ServerDecryptEsniXtn(const sslSocket *ss, const PRUint8 *in, unsigned int + { + sslReader rdr = SSL_READER(in, inLen); + PRUint64 suite; +- const ssl3CipherSuiteDef *suiteDef; ++ const ssl3CipherSuiteDef *suiteDef = NULL; + SSLAEADCipher aead = NULL; + TLSExtension *keyShareExtension; + TLS13KeyShareEntry *entry = NULL; +-- +2.20.1 +
Signature · 1 line
2.20.1
PATCH 2/4 package/libnss: fix build warning
Quoted 27 lines · Giulio Benetti
Add patch to fix build warning due to uninitialized variable.
Signed-off-by Giulio Benetti <[email protected]>---
https://bugzilla.mozilla.org/show_bug.cgi?id=1590678--- ...ve-Wmaybe-uninitialized-warning-in-t.patch | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 package/libnss/0004-Bug-1590678-Remove-Wmaybe-uninitialized-warning-in-t.patchpackage/libnss/0004-Bug-1590678-Remove-Wmaybe-uninitialized-warning-in-t.patch new file +11
-0@@ -0,0 +1,27 @@ +From 24bcc8860310149da1524dbf25f3bc77f6476b11 Mon Sep 17 00:00:00 2001 +From: Giulio Benetti <[email protected]> +Date: Wed, 23 Oct 2019 11:58:12 +0200 +Subject: [PATCH] Bug 1590678 - Remove -Wmaybe-uninitialized warning in + tls13esni.c + +Signed-off-by: Giulio Benetti <[email protected]> +--- + nss/lib/ssl/tls13esni.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) +
package/libnss/0004-Bug-1590678-Remove-Wmaybe-uninitialized-warning-in-t.patch line 21
Quoted 10 lines
package/libnss/0004-Bug-1590678-Remove-Wmaybe-uninitialized-warning-in-t.patch new file +10
-0+diff --git a/nss/lib/ssl/tls13esni.c b/nss/lib/ssl/tls13esni.c +index 4d2e12d62..a7ce6f568 100644 +--- a/nss/lib/ssl/tls13esni.c ++++ b/nss/lib/ssl/tls13esni.c +@@ -728,7 +728,7 @@ tls13_ServerDecryptEsniXtn(const sslSocket *ss, const PRUint8 *in, unsigned int + { + sslReader rdr = SSL_READER(in, inLen); + PRUint64 suite; +- const ssl3CipherSuiteDef *suiteDef; ++ const ssl3CipherSuiteDef *suiteDef = NULL;
Although this looks OK at first sight, it's something that might be dangerous
(i.e. the wrong fix). Since this is a security package, I don't want to apply it until upstream gives feedback.
Regards,
Arnout
Quoted 7 lines
package/libnss/0004-Bug-1590678-Remove-Wmaybe-uninitialized-warning-in-t.patch new file +6
-0+ SSLAEADCipher aead = NULL; + TLSExtension *keyShareExtension; + TLS13KeyShareEntry *entry = NULL; +-- +2.20.1 +
PATCH 2/4 package/libnss: fix build warning
Quoted 36 lines · Arnout Vandecappelle
Quoted 33 lines · Giulio Benetti
Add patch to fix build warning due to uninitialized variable.
Signed-off-by Giulio Benetti <[email protected]>---
https://bugzilla.mozilla.org/show_bug.cgi?id=1590678--- ...ve-Wmaybe-uninitialized-warning-in-t.patch | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 package/libnss/0004-Bug-1590678-Remove-Wmaybe-uninitialized-warning-in-t.patchpackage/libnss/0004-Bug-1590678-Remove-Wmaybe-uninitialized-warning-in-t.patch new file +17
-0@@ -0,0 +1,27 @@ +From 24bcc8860310149da1524dbf25f3bc77f6476b11 Mon Sep 17 00:00:00 2001 +From: Giulio Benetti <[email protected]> +Date: Wed, 23 Oct 2019 11:58:12 +0200 +Subject: [PATCH] Bug 1590678 - Remove -Wmaybe-uninitialized warning in + tls13esni.c + +Signed-off-by: Giulio Benetti <[email protected]> +--- + nss/lib/ssl/tls13esni.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/nss/lib/ssl/tls13esni.c b/nss/lib/ssl/tls13esni.c +index 4d2e12d62..a7ce6f568 100644 +--- a/nss/lib/ssl/tls13esni.c ++++ b/nss/lib/ssl/tls13esni.c +@@ -728,7 +728,7 @@ tls13_ServerDecryptEsniXtn(const sslSocket *ss, const PRUint8 *in, unsigned int + {
Quoted 8 lines
package/libnss/0004-Bug-1590678-Remove-Wmaybe-uninitialized-warning-in-t.patch line 21
Quoted 4 lines
package/libnss/0004-Bug-1590678-Remove-Wmaybe-uninitialized-warning-in-t.patch new file +4
-0+ sslReader rdr = SSL_READER(in, inLen); + PRUint64 suite; +- const ssl3CipherSuiteDef *suiteDef; ++ const ssl3CipherSuiteDef *suiteDef = NULL;Although this looks OK at first sight, it's something that might be dangerous
(i.e. the wrong fix). Since this is a security package, I don't want to apply it until upstream gives feedback.
On second thought, since we don't enable -Werror in Buildroot, we don't need
this patch AFAICS. So it's good that you reported it upstream, but we're not going to apply this patch. I've marked it as Rejected.
Regards,
Arnout
PATCH 2/4 package/libnss: fix build warning
One more :-)
Quoted 48 lines · Arnout Vandecappelle
Quoted 36 lines · Arnout Vandecappelle
Quoted 33 lines · Giulio Benetti
Add patch to fix build warning due to uninitialized variable.
Signed-off-by Giulio Benetti <[email protected]>---
https://bugzilla.mozilla.org/show_bug.cgi?id=1590678--- ...ve-Wmaybe-uninitialized-warning-in-t.patch | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 package/libnss/0004-Bug-1590678-Remove-Wmaybe-uninitialized-warning-in-t.patchpackage/libnss/0004-Bug-1590678-Remove-Wmaybe-uninitialized-warning-in-t.patch new file +17
-0@@ -0,0 +1,27 @@ +From 24bcc8860310149da1524dbf25f3bc77f6476b11 Mon Sep 17 00:00:00 2001 +From: Giulio Benetti <[email protected]> +Date: Wed, 23 Oct 2019 11:58:12 +0200 +Subject: [PATCH] Bug 1590678 - Remove -Wmaybe-uninitialized warning in + tls13esni.c + +Signed-off-by: Giulio Benetti <[email protected]> +--- + nss/lib/ssl/tls13esni.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/nss/lib/ssl/tls13esni.c b/nss/lib/ssl/tls13esni.c +index 4d2e12d62..a7ce6f568 100644 +--- a/nss/lib/ssl/tls13esni.c ++++ b/nss/lib/ssl/tls13esni.c +@@ -728,7 +728,7 @@ tls13_ServerDecryptEsniXtn(const sslSocket *ss, const PRUint8 *in, unsigned int + {Quoted 8 lines
package/libnss/0004-Bug-1590678-Remove-Wmaybe-uninitialized-warning-in-t.patch line 21
Quoted 4 lines
package/libnss/0004-Bug-1590678-Remove-Wmaybe-uninitialized-warning-in-t.patch new file +4
-0+ sslReader rdr = SSL_READER(in, inLen); + PRUint64 suite; +- const ssl3CipherSuiteDef *suiteDef; ++ const ssl3CipherSuiteDef *suiteDef = NULL;Although this looks OK at first sight, it's something that might be dangerous
(i.e. the wrong fix). Since this is a security package, I don't want to apply it until upstream gives feedback.
Quoted 3 lines
On second thought, since we don't enable -Werror in Buildroot, we don't need
this patch AFAICS. So it's good that you reported it upstream, but we're not going to apply this patch. I've marked it as Rejected.
If upstream decides that this really *is* an uninitialized variable reference
and not just a limitation of the compiler's analysis, it's a potential security issue, so in that case please resubmit.
Regards,
Arnout
PATCH 2/4 package/libnss: fix build warning
Hi Arnout,
Quoted 51 lines · Arnout Vandecappelle
One more :-)
Quoted 48 lines · Arnout Vandecappelle
Quoted 44 lines · Arnout Vandecappelle
Quoted 27 lines · Giulio Benetti
Add patch to fix build warning due to uninitialized variable.
Signed-off-by Giulio Benetti <[email protected]>---
https://bugzilla.mozilla.org/show_bug.cgi?id=1590678--- ...ve-Wmaybe-uninitialized-warning-in-t.patch | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+)create mode 100644
package/libnss/0004-Bug-1590678-Remove-Wmaybe-uninitialized-warning-in-t.patchpackage/libnss/0004-Bug-1590678-Remove-Wmaybe-uninitialized-warning-in-t.patch new file +11
-0@@ -0,0 +1,27 @@ +From 24bcc8860310149da1524dbf25f3bc77f6476b11 Mon Sep 17 00:00:00 2001 +From: Giulio Benetti <[email protected]> +Date: Wed, 23 Oct 2019 11:58:12 +0200 +Subject: [PATCH] Bug 1590678 - Remove -Wmaybe-uninitialized warning in + tls13esni.c + +Signed-off-by: Giulio Benetti <[email protected]> +--- + nss/lib/ssl/tls13esni.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) +package/libnss/0004-Bug-1590678-Remove-Wmaybe-uninitialized-warning-in-t.patch line 21
Quoted 10 lines
package/libnss/0004-Bug-1590678-Remove-Wmaybe-uninitialized-warning-in-t.patch new file +10
-0+diff --git a/nss/lib/ssl/tls13esni.c b/nss/lib/ssl/tls13esni.c +index 4d2e12d62..a7ce6f568 100644 +--- a/nss/lib/ssl/tls13esni.c ++++ b/nss/lib/ssl/tls13esni.c +@@ -728,7 +728,7 @@ tls13_ServerDecryptEsniXtn(const sslSocket *ss, const PRUint8 *in, unsigned int + { + sslReader rdr = SSL_READER(in, inLen); + PRUint64 suite; +- const ssl3CipherSuiteDef *suiteDef; ++ const ssl3CipherSuiteDef *suiteDef = NULL;Although this looks OK at first sight, it's something that might be dangerous
(i.e. the wrong fix). Since this is a security package, I don't want to apply it until upstream gives feedback.
Quoted 7 lines
Quoted 3 lines
On second thought, since we don't enable -Werror in Buildroot, we don't need
this patch AFAICS. So it's good that you reported it upstream, but we're not going to apply this patch. I've marked it as Rejected.If upstream decides that this really *is* an uninitialized variable reference
and not just a limitation of the compiler's analysis, it's a potential security issue, so in that case please resubmit.
Ok then,
thanks for reviewing!
Best regards
Signature · 2 lines
Giulio Benetti Benetti Engineering sas
PATCH 3/4 package/libnss: remove useless NSS_ENABLE_ECC variable
In reply to Giulio BenettiNSS_ENABLE_ECC is not supported anymore, then remove it from our libnss.mk file.
--- package/libnss/libnss.mk | 2 -- 1 file changed, 2 deletions(-)
package/libnss/libnss.mk +0 -2
@@ -50,7 +50,6 @@ LIBNSS_BUILD_VARS = \ NS_USE_GCC=1 \ NSS_DISABLE_GTESTS=1 \ NSS_USE_SYSTEM_SQLITE=1 \ - NSS_ENABLE_ECC=1 \ NATIVE_CC="$(HOSTCC)" \ OS_ARCH="Linux" \ OS_RELEASE="2.6" \
@@ -121,7 +120,6 @@ HOST_LIBNSS_BUILD_VARS = \ NSS_USE_SYSTEM_SQLITE=1 \ SQLITE_INCLUDE_DIR=$(HOST_DIR)/include \ ZLIB_INCLUDE_DIR=$(HOST_DIR)/include \ - NSS_ENABLE_ECC=1 \ NSS_ENABLE_WERROR=0 HOST_LIBNSS_DEPENDENCIES = host-libnspr host-sqlite host-zlib
Signature · 1 line
2.20.1
Arnout Vandecappelle
AppliedPATCH 3/4 package/libnss: remove useless NSS_ENABLE_ECC variable
Quoted 4 lines · Giulio Benetti
NSS_ENABLE_ECCis not supported anymore, then remove it from our libnss.mk file.Signed-off-by Giulio Benetti <[email protected]>
Applied to master, thanks.
Regards,
Arnout
Quoted 25 lines
--- package/libnss/libnss.mk | 2 -- 1 file changed, 2 deletions(-)package/libnss/libnss.mk +0
-2@@ -50,7 +50,6 @@ LIBNSS_BUILD_VARS = \ NS_USE_GCC=1 \ NSS_DISABLE_GTESTS=1 \ NSS_USE_SYSTEM_SQLITE=1 \ - NSS_ENABLE_ECC=1 \ NATIVE_CC="$(HOSTCC)" \ OS_ARCH="Linux" \ OS_RELEASE="2.6" \@@ -121,7 +120,6 @@ HOST_LIBNSS_BUILD_VARS = \ NSS_USE_SYSTEM_SQLITE=1 \ SQLITE_INCLUDE_DIR=$(HOST_DIR)/include \ ZLIB_INCLUDE_DIR=$(HOST_DIR)/include \ - NSS_ENABLE_ECC=1 \ NSS_ENABLE_WERROR=0 HOST_LIBNSS_DEPENDENCIES = host-libnspr host-sqlite host-zlib
PATCH 4/4 package/libnss: remove NSS_ENABLE_WERROR=0
In reply to Giulio BenettiAll warnings have been fixed now, so let's remove NSS_ENABLE_WERROR and leave any warning to show up.
--- package/libnss/libnss.mk | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
package/libnss/libnss.mk +2 -4
@@ -53,8 +53,7 @@ LIBNSS_BUILD_VARS = \ NATIVE_CC="$(HOSTCC)" \ OS_ARCH="Linux" \ OS_RELEASE="2.6" \ - OS_TEST="$(LIBNSS_ARCH)" \ - NSS_ENABLE_WERROR=0 + OS_TEST="$(LIBNSS_ARCH)" # #pragma usage needs gcc >= 4.8 # See https://bugzilla.mozilla.org/show_bug.cgi?id=1226179
@@ -119,8 +118,7 @@ HOST_LIBNSS_BUILD_VARS = \ NSS_DISABLE_GTESTS=1 \ NSS_USE_SYSTEM_SQLITE=1 \ SQLITE_INCLUDE_DIR=$(HOST_DIR)/include \ - ZLIB_INCLUDE_DIR=$(HOST_DIR)/include \ - NSS_ENABLE_WERROR=0 + ZLIB_INCLUDE_DIR=$(HOST_DIR)/include HOST_LIBNSS_DEPENDENCIES = host-libnspr host-sqlite host-zlib
Signature · 1 line
2.20.1
PATCH 4/4 package/libnss: remove NSS_ENABLE_WERROR=0
Quoted 4 lines · On Wed, 23 Oct 2019 12:23:30 +0200 Giulio Benetti…
All warnings have been fixed now, so let's remove
NSS_ENABLE_WERRORand leave any warning to show up.Signed-off-by Giulio Benetti <[email protected]>
No, we generally don't want to enable -Werror in Buildroot builds, as warnings keep popping up when upgrading gcc versions.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 4/4 package/libnss: remove NSS_ENABLE_WERROR=0
Hello Thomas,
Quoted 10 lines · Thomas Petazzoni
Quoted 4 lines · On Wed, 23 Oct 2019 12:23:30 +0200 Giulio Benetti…
All warnings have been fixed now, so let's remove
NSS_ENABLE_WERRORand leave any warning to show up.Signed-off-by Giulio Benetti <[email protected]>No, we generally don't want to enable -Werror in Buildroot builds, as warnings keep popping up when upgrading gcc versions.
Ok, then I'll fix warnings upstream and keep -Werror disabled.
Thanks for reviewing
Best regards
Signature · 2 lines
Giulio Benetti Benetti Engineering sas
PATCH 1/4 package/libnss: fix build failure with ARM without NEON extension
In reply to Giulio BenettiQuoted 5 lines · Giulio Benetti
At the moment libnss assumes that every ARM has NEON extension but it's not that way. So add a patch to make it aware of it and use native functions in place of NEON optimized ones.
Signed-off-by Giulio Benetti <[email protected]>
You forgot:
Fixes:
http://autobuild.buildroot.net/results/1342d305d1aeebef7af54a83afc094fda12421e2
Quoted 24 lines
---
Already sent upstream:
https://bugzilla.mozilla.org/show_bug.cgi?id=1590676--- ...ix-build-if-arm-doesn-t-support-NEON.patch | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 package/libnss/0003-Bug-1590676-Fix-build-if-arm-doesn-t-support-NEON.patchpackage/libnss/0003-Bug-1590676-Fix-build-if-arm-doesn-t-support-NEON.patch new file +10
-0@@ -0,0 +1,47 @@ +From 946bc2864b0de7b63a4ec415e42e622d591a8753 Mon Sep 17 00:00:00 2001 +From: Giulio Benetti <[email protected]> +Date: Wed, 23 Oct 2019 11:47:03 +0200 +Subject: [PATCH] Bug 1590676 - Fix build if arm doesn't support NEON + +At the moment NSS assumes that ARM supports NEON extension but this is +not true and leads to build failure on ARM without NEON extension. +Add check to assure USE_HW_AES is not defined if ARM without NEON +extension is used. +
package/libnss/0003-Bug-1590676-Fix-build-if-arm-doesn-t-support-NEON.patch line 20
Quoted 10 lines
package/libnss/0003-Bug-1590676-Fix-build-if-arm-doesn-t-support-NEON.patch new file +10
-0+Signed-off-by: Giulio Benetti <[email protected]> +--- + nss/lib/freebl/aes-armv8.c | 3 ++- + nss/lib/freebl/rijndael.c | 3 ++- + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/nss/lib/freebl/aes-armv8.c b/nss/lib/freebl/aes-armv8.c +index 40d5e2d34..a5df53891 100644 +--- a/nss/lib/freebl/aes-armv8.c ++++ b/nss/lib/freebl/aes-armv8.c
That looks as if it is something that should be built only on armv8... Since
the build failure is in fact for an armv4, don't we have a bigger issue here?
I believe 32-bit armv8 always has neon.
package/libnss/0003-Bug-1590676-Fix-build-if-arm-doesn-t-support-NEON.patch line 27
Quoted 7 lines
package/libnss/0003-Bug-1590676-Fix-build-if-arm-doesn-t-support-NEON.patch new file +7
-0+@@ -7,7 +7,8 @@ + + #if (defined(__clang__) || \ + (defined(__GNUC__) && defined(__GNUC_MINOR__) && \ +- (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 8)))) ++ (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 8))) && \ ++ (defined(__ARM_NEON) || defined(__ARM_NEON__)))
That parenthesis matching doesn't look right... I suppose with clang it doesn't
magically support neon, right? So there should be an additional set of parenthesis around the defined(__clang__) ... > 8 part.
Regards,
Arnout
Quoted 21 lines
package/libnss/0003-Bug-1590676-Fix-build-if-arm-doesn-t-support-NEON.patch new file +20
-0+ + #ifndef __ARM_FEATURE_CRYPTO + #error "Compiler option is invalid" +diff --git a/nss/lib/freebl/rijndael.c b/nss/lib/freebl/rijndael.c +index 26bd58ee0..23893f419 100644 +--- a/nss/lib/freebl/rijndael.c ++++ b/nss/lib/freebl/rijndael.c +@@ -20,7 +20,8 @@ + #include "gcm.h" + #include "mpi.h" + +-#if !defined(IS_LITTLE_ENDIAN) && !defined(NSS_X86_OR_X64) ++#if (!defined(IS_LITTLE_ENDIAN) && !defined(NSS_X86_OR_X64)) || \ ++ (!defined(__ARM_NEON) && !defined(__ARM_NEON__)) + // not test yet on big endian platform of arm + #undef USE_HW_AES + #endif +-- +2.20.1 +
PATCH 1/4 package/libnss: fix build failure with ARM without NEON extension
Hi Arnout,
Quoted 7 lines · Arnout Vandecappelle
Quoted 4 lines · Giulio Benetti
At the moment libnss assumes that every ARM has NEON extension but it's not that way. So add a patch to make it aware of it and use native functions in place of NEON optimized ones.
Quoted 6 lines
Quoted 1 line
Signed-off-by Giulio Benetti <[email protected]>You forgot:
Fixes:
http://autobuild.buildroot.net/results/1342d305d1aeebef7af54a83afc094fda12421e2
Oops, yes.
Quoted 38 lines
Quoted 24 lines
---
Already sent upstream:
https://bugzilla.mozilla.org/show_bug.cgi?id=1590676--- ...ix-build-if-arm-doesn-t-support-NEON.patch | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+)create mode 100644
package/libnss/0003-Bug-1590676-Fix-build-if-arm-doesn-t-support-NEON.patchpackage/libnss/0003-Bug-1590676-Fix-build-if-arm-doesn-t-support-NEON.patch new file +10
-0@@ -0,0 +1,47 @@ +From 946bc2864b0de7b63a4ec415e42e622d591a8753 Mon Sep 17 00:00:00 2001 +From: Giulio Benetti <[email protected]> +Date: Wed, 23 Oct 2019 11:47:03 +0200 +Subject: [PATCH] Bug 1590676 - Fix build if arm doesn't support NEON + +At the moment NSS assumes that ARM supports NEON extension but this is +not true and leads to build failure on ARM without NEON extension. +Add check to assure USE_HW_AES is not defined if ARM without NEON +extension is used. +package/libnss/0003-Bug-1590676-Fix-build-if-arm-doesn-t-support-NEON.patch line 20
Quoted 10 lines
package/libnss/0003-Bug-1590676-Fix-build-if-arm-doesn-t-support-NEON.patch new file +10
-0+Signed-off-by: Giulio Benetti <[email protected]> +--- + nss/lib/freebl/aes-armv8.c | 3 ++- + nss/lib/freebl/rijndael.c | 3 ++- + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/nss/lib/freebl/aes-armv8.c b/nss/lib/freebl/aes-armv8.c +index 40d5e2d34..a5df53891 100644 +--- a/nss/lib/freebl/aes-armv8.c ++++ b/nss/lib/freebl/aes-armv8.cThat looks as if it is something that should be built only on armv8... Since
the build failure is in fact for an armv4, don't we have a bigger issue here?
Quoted 1 line
I believe 32-bit armv8 always has neon.
Would it be a good idea to provide a variable to enable or not building aes-armv8 and define or not USE_HW_AES? I mean, this is a Makefile and I don't know how to make libnss capable of understand if there is NEON support or not, do you have any suggestions?
Quoted 11 lines
package/libnss/0003-Bug-1590676-Fix-build-if-arm-doesn-t-support-NEON.patch line 27
Quoted 7 lines
package/libnss/0003-Bug-1590676-Fix-build-if-arm-doesn-t-support-NEON.patch new file +7
-0+@@ -7,7 +7,8 @@ + + #if (defined(__clang__) || \ + (defined(__GNUC__) && defined(__GNUC_MINOR__) && \ +- (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 8)))) ++ (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 8))) && \ ++ (defined(__ARM_NEON) || defined(__ARM_NEON__)))That parenthesis matching doesn't look right... I suppose with clang it doesn't
magically support neon, right? So there should be an additional set of parenthesis around thedefined(__clang__)... > 8 part.
Oops again, you're right.
Thanks for reviewing
Best regards
Signature · 2 lines
Giulio Benetti Benetti Engineering sas
PATCH v2 1/1 package/libnss: fix build failure with ARM without NEON extension
In reply to Arnout VandecappelleAt the moment libnss assumes that every ARM has NEON extension but it's not that way. So add a patch to make it aware of it and use native functions in place of NEON optimized ones.
Fixes:
http://autobuild.buildroot.net/results/1342d305d1aeebef7af54a83afc094fda12421e2/
---V1->V2:
* added Fixes to commit log
* fixed #ifdef statement in patch
--- ...ix-build-if-arm-doesn-t-support-NEON.patch | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 package/libnss/0003-Bug-1590676-Fix-build-if-arm-doesn-t-support-NEON.patch
package/libnss/0003-Bug-1590676-Fix-build-if-arm-doesn-t-support-NEON.patch new file +50 -0
@@ -0,0 +1,50 @@ +From 76f35f9acd6c6b34318438bef30b0bdfdfd13f16 Mon Sep 17 00:00:00 2001 +From: Giulio Benetti <[email protected]> +Date: Wed, 23 Oct 2019 11:47:03 +0200 +Subject: [PATCH] Bug 1590676 - Fix build if arm doesn't support NEON + +At the moment NSS assumes that ARM supports NEON extension but this is +not true and leads to build failure on ARM without NEON extension. +Add check to assure USE_HW_AES is not defined if ARM without NEON +extension is used. + +Signed-off-by: Giulio Benetti <[email protected]> +--- + nss/lib/freebl/aes-armv8.c | 5 +++-- + nss/lib/freebl/rijndael.c | 3 ++- + 2 files changed, 5 insertions(+), 3 deletions(-) + +diff --git a/nss/lib/freebl/aes-armv8.c b/nss/lib/freebl/aes-armv8.c +index 40d5e2d34..d1504e6fb 100644 +--- a/nss/lib/freebl/aes-armv8.c ++++ b/nss/lib/freebl/aes-armv8.c +@@ -5,9 +5,10 @@ + #include "secerr.h" + #include "rijndael.h" + +-#if (defined(__clang__) || \ ++#if ((defined(__clang__) || \ + (defined(__GNUC__) && defined(__GNUC_MINOR__) && \ +- (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 8)))) ++ (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 8)))) && \ ++ (defined(__ARM_NEON) || defined(__ARM_NEON__))) + + #ifndef __ARM_FEATURE_CRYPTO + #error "Compiler option is invalid" +diff --git a/nss/lib/freebl/rijndael.c b/nss/lib/freebl/rijndael.c +index 26bd58ee0..23893f419 100644 +--- a/nss/lib/freebl/rijndael.c ++++ b/nss/lib/freebl/rijndael.c +@@ -20,7 +20,8 @@ + #include "gcm.h" + #include "mpi.h" + +-#if !defined(IS_LITTLE_ENDIAN) && !defined(NSS_X86_OR_X64) ++#if (!defined(IS_LITTLE_ENDIAN) && !defined(NSS_X86_OR_X64)) || \ ++ (!defined(__ARM_NEON) && !defined(__ARM_NEON__)) + // not test yet on big endian platform of arm + #undef USE_HW_AES + #endif +-- +2.20.1 +
Signature · 1 line
2.20.1
PATCH v2 1/1 package/libnss: fix build failure with ARM without NEON extension
Quoted 57 lines · Giulio Benetti
At the moment libnss assumes that every ARM has NEON extension but it's not that way. So add a patch to make it aware of it and use native functions in place of NEON optimized ones.
Fixes:
http://autobuild.buildroot.net/results/1342d305d1aeebef7af54a83afc094fda12421e2/Signed-off-by Giulio Benetti <[email protected]>---
V1->V2:
* added Fixes to commit log
* fixed #ifdef statement in patch--- ...ix-build-if-arm-doesn-t-support-NEON.patch | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+)create mode 100644
package/libnss/0003-Bug-1590676-Fix-build-if-arm-doesn-t-support-NEON.patchpackage/libnss/0003-Bug-1590676-Fix-build-if-arm-doesn-t-support-NEON.patch new file +34
-0@@ -0,0 +1,50 @@ +From 76f35f9acd6c6b34318438bef30b0bdfdfd13f16 Mon Sep 17 00:00:00 2001 +From: Giulio Benetti <[email protected]> +Date: Wed, 23 Oct 2019 11:47:03 +0200 +Subject: [PATCH] Bug 1590676 - Fix build if arm doesn't support NEON + +At the moment NSS assumes that ARM supports NEON extension but this is +not true and leads to build failure on ARM without NEON extension. +Add check to assure USE_HW_AES is not defined if ARM without NEON +extension is used. + +Signed-off-by: Giulio Benetti <[email protected]> +--- + nss/lib/freebl/aes-armv8.c | 5 +++-- + nss/lib/freebl/rijndael.c | 3 ++- + 2 files changed, 5 insertions(+), 3 deletions(-) + +diff --git a/nss/lib/freebl/aes-armv8.c b/nss/lib/freebl/aes-armv8.c +index 40d5e2d34..d1504e6fb 100644 +--- a/nss/lib/freebl/aes-armv8.c ++++ b/nss/lib/freebl/aes-armv8.c +@@ -5,9 +5,10 @@ + #include "secerr.h" + #include "rijndael.h" + +-#if (defined(__clang__) || \ ++#if ((defined(__clang__) || \ + (defined(__GNUC__) && defined(__GNUC_MINOR__) && \ +- (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 8)))) ++ (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 8)))) && \ ++ (defined(__ARM_NEON) || defined(__ARM_NEON__))) + + #ifndef __ARM_FEATURE_CRYPTO + #error "Compiler option is invalid" +diff --git a/nss/lib/freebl/rijndael.c b/nss/lib/freebl/rijndael.c
package/libnss/0003-Bug-1590676-Fix-build-if-arm-doesn-t-support-NEON.patch line 44
Quoted 10 lines
package/libnss/0003-Bug-1590676-Fix-build-if-arm-doesn-t-support-NEON.patch new file +10
-0+index 26bd58ee0..23893f419 100644 +--- a/nss/lib/freebl/rijndael.c ++++ b/nss/lib/freebl/rijndael.c +@@ -20,7 +20,8 @@ + #include "gcm.h" + #include "mpi.h" + +-#if !defined(IS_LITTLE_ENDIAN) && !defined(NSS_X86_OR_X64) ++#if (!defined(IS_LITTLE_ENDIAN) && !defined(NSS_X86_OR_X64)) || \ ++ (!defined(__ARM_NEON) && !defined(__ARM_NEON__))
This part is wrong, I've sent upstream corrected patch[1] and I'm going to send v3 patch for buildroot.
Quoted 7 lines
package/libnss/0003-Bug-1590676-Fix-build-if-arm-doesn-t-support-NEON.patch new file +6
-0+ // not test yet on big endian platform of arm + #undef USE_HW_AES + #endif +-- +2.20.1 +
Signature · 2 lines
Giulio Benetti Benetti Engineering sas