All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/libnss: fix build on ARM big endian
@ 2021-08-07 21:32 Fabrice Fontaine
  2021-08-07 21:47 ` Giulio Benetti
  2021-08-08 20:22 ` Thomas Petazzoni
  0 siblings, 2 replies; 6+ messages in thread
From: Fabrice Fontaine @ 2021-08-07 21:32 UTC (permalink / raw)
  To: buildroot; +Cc: Joseph Kogut, Giulio Benetti, Fabrice Fontaine

Fix the follownig build failure on ARM big endian raised since bump to
version 3.68 in commit 0a73b9b962421ce7a72c88e5f5bbd8849f21b041:

Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha256-armv8.o: In function `SHA256_Compress_Native':
sha256-armv8.c:(.text.SHA256_Compress_Native+0x0): multiple definition of `SHA256_Compress_Native'
Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha512.o:sha512.c:(.text.SHA256_Compress_Native+0x0): first defined here
Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha256-armv8.o: In function `SHA256_Update_Native':
sha256-armv8.c:(.text.SHA256_Update_Native+0x0): multiple definition of `SHA256_Update_Native'
Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha512.o:sha512.c:(.text.SHA256_Update_Native+0x0): first defined here

Fixes:
 - http://autobuild.buildroot.org/results/237aba0c16a34fec1b0fe50fe08cace438eda1bf

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 ...2.c-fix-SHA256-redefinition-on-ARM-b.patch | 47 +++++++++++++++++++
 1 file changed, 47 insertions(+)
 create mode 100644 package/libnss/0001-lib-freebl-sha512.c-fix-SHA256-redefinition-on-ARM-b.patch

diff --git a/package/libnss/0001-lib-freebl-sha512.c-fix-SHA256-redefinition-on-ARM-b.patch b/package/libnss/0001-lib-freebl-sha512.c-fix-SHA256-redefinition-on-ARM-b.patch
new file mode 100644
index 0000000000..f925f20051
--- /dev/null
+++ b/package/libnss/0001-lib-freebl-sha512.c-fix-SHA256-redefinition-on-ARM-b.patch
@@ -0,0 +1,47 @@
+From 434d79c52db5b680accc531572319bd7094fa470 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+Date: Sat, 7 Aug 2021 23:19:01 +0200
+Subject: [PATCH] lib/freebl/sha512.c: fix SHA256 redefinition on ARM big
+ endian
+
+For an unknown reason, SHA256_{Compress,Update}_Native are defined in
+lib/freebl/sha512.c if IS_LITTLE_ENDIAN is undefined since version 3.68
+and
+https://github.com/nss-dev/nss/commit/e1e00f21f2d73e0d5d27651ad5606efa5714abe4
+
+This raises the following build failure on ARM big endian:
+
+Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha256-armv8.o: In function `SHA256_Compress_Native':
+sha256-armv8.c:(.text.SHA256_Compress_Native+0x0): multiple definition of `SHA256_Compress_Native'
+Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha512.o:sha512.c:(.text.SHA256_Compress_Native+0x0): first defined here
+Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha256-armv8.o: In function `SHA256_Update_Native':
+sha256-armv8.c:(.text.SHA256_Update_Native+0x0): multiple definition of `SHA256_Update_Native'
+Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha512.o:sha512.c:(.text.SHA256_Update_Native+0x0): first defined here
+
+Revert this change as it seems completely unrelated to the commit title
+"Bug 1655493 - Support SHA2 HW acceleration using Intel SHA Extension"
+
+Fixes:
+ - http://autobuild.buildroot.org/results/237aba0c16a34fec1b0fe50fe08cace438eda1bf
+
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+---
+ nss/lib/freebl/sha512.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/nss/lib/freebl/sha512.c b/nss/lib/freebl/sha512.c
+index 946ab9f7f..3ec414b52 100644
+--- a/nss/lib/freebl/sha512.c
++++ b/nss/lib/freebl/sha512.c
+@@ -164,7 +164,7 @@ static void SHA256_Compress_Generic(SHA256Context *ctx);
+ static void SHA256_Update_Generic(SHA256Context *ctx, const unsigned char *input,
+                                   unsigned int inputLen);
+ 
+-#if !defined(USE_HW_SHA2) || !defined(IS_LITTLE_ENDIAN)
++#if !defined(USE_HW_SHA2)
+ void
+ SHA256_Compress_Native(SHA256Context *ctx)
+ {
+-- 
+2.30.2
+
-- 
2.30.2

_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/1] package/libnss: fix build on ARM big endian
  2021-08-07 21:32 [Buildroot] [PATCH 1/1] package/libnss: fix build on ARM big endian Fabrice Fontaine
@ 2021-08-07 21:47 ` Giulio Benetti
  2021-08-08 12:30   ` Giulio Benetti
  2021-08-08 20:22 ` Thomas Petazzoni
  1 sibling, 1 reply; 6+ messages in thread
From: Giulio Benetti @ 2021-08-07 21:47 UTC (permalink / raw)
  To: Fabrice Fontaine, buildroot; +Cc: Joseph Kogut

Hi Fabrice,

On 8/7/21 11:32 PM, Fabrice Fontaine wrote:
> Fix the follownig build failure on ARM big endian raised since bump to
> version 3.68 in commit 0a73b9b962421ce7a72c88e5f5bbd8849f21b041:
> 
> Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha256-armv8.o: In function `SHA256_Compress_Native':
> sha256-armv8.c:(.text.SHA256_Compress_Native+0x0): multiple definition of `SHA256_Compress_Native'
> Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha512.o:sha512.c:(.text.SHA256_Compress_Native+0x0): first defined here
> Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha256-armv8.o: In function `SHA256_Update_Native':
> sha256-armv8.c:(.text.SHA256_Update_Native+0x0): multiple definition of `SHA256_Update_Native'
> Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha512.o:sha512.c:(.text.SHA256_Update_Native+0x0): first defined here
> 
> Fixes:
>   - http://autobuild.buildroot.org/results/237aba0c16a34fec1b0fe50fe08cace438eda1bf
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> ---
>   ...2.c-fix-SHA256-redefinition-on-ARM-b.patch | 47 +++++++++++++++++++
>   1 file changed, 47 insertions(+)
>   create mode 100644 package/libnss/0001-lib-freebl-sha512.c-fix-SHA256-redefinition-on-ARM-b.patch
> 
> diff --git a/package/libnss/0001-lib-freebl-sha512.c-fix-SHA256-redefinition-on-ARM-b.patch b/package/libnss/0001-lib-freebl-sha512.c-fix-SHA256-redefinition-on-ARM-b.patch
> new file mode 100644
> index 0000000000..f925f20051
> --- /dev/null
> +++ b/package/libnss/0001-lib-freebl-sha512.c-fix-SHA256-redefinition-on-ARM-b.patch
> @@ -0,0 +1,47 @@
> +From 434d79c52db5b680accc531572319bd7094fa470 Mon Sep 17 00:00:00 2001
> +From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> +Date: Sat, 7 Aug 2021 23:19:01 +0200
> +Subject: [PATCH] lib/freebl/sha512.c: fix SHA256 redefinition on ARM big
> + endian
> +
> +For an unknown reason, SHA256_{Compress,Update}_Native are defined in
> +lib/freebl/sha512.c if IS_LITTLE_ENDIAN is undefined since version 3.68
> +and
> +https://github.com/nss-dev/nss/commit/e1e00f21f2d73e0d5d27651ad5606efa5714abe4
> +
> +This raises the following build failure on ARM big endian:
> +
> +Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha256-armv8.o: In function `SHA256_Compress_Native':
> +sha256-armv8.c:(.text.SHA256_Compress_Native+0x0): multiple definition of `SHA256_Compress_Native'
> +Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha512.o:sha512.c:(.text.SHA256_Compress_Native+0x0): first defined here
> +Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha256-armv8.o: In function `SHA256_Update_Native':
> +sha256-armv8.c:(.text.SHA256_Update_Native+0x0): multiple definition of `SHA256_Update_Native'
> +Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha512.o:sha512.c:(.text.SHA256_Update_Native+0x0): first defined here
> +
> +Revert this change as it seems completely unrelated to the commit title
> +"Bug 1655493 - Support SHA2 HW acceleration using Intel SHA Extension"

I'm not completely sure about this, since I remember most of armv8 
accelerations only work for LITTLE_ENDIAN. But I can't login to the 
Mozilla Bugzilla because of two factor authentication I've never enabled 
and I've asked help to fix this days ago with no answer. Do you have 
access to it?

Can you please clarify if that acceleration is valid on BIG_ENDIAN too?
It's not written anywhere, but more than one lib/freebl/ lib 
acceleration has been done only for LITTLE_ENDIAN. What worries me is 
the hash table at the top that *maybe* is only suitable for LITTLE_ENDIAN:
https://hg.mozilla.org/projects/nss/file/tip/lib/freebl/sha256-armv8.c#l24

For example check this patch I've sent time ago:
https://hg.mozilla.org/projects/nss/rev/fa0d958de0c3cf99a7ec66e819b128c7bc88ff9f
and the related bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=1580126

That makes me believe that is only LITTLE_ENDIAN compatible also due to 
this:
https://hg.mozilla.org/projects/nss/file/tip/lib/freebl/sha512.c#l167

BUT I can't reach anyone, and they don't sign off the commits, so no 
e-mail to CC. Maybe you can through Mozilla Bugzilla?

Thanks in advance
Best regards
-- 
Giulio Benetti
Benetti Engineering sas

> +Fixes:
> + - http://autobuild.buildroot.org/results/237aba0c16a34fec1b0fe50fe08cace438eda1bf
> +
> +Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> +---
> + nss/lib/freebl/sha512.c | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/nss/lib/freebl/sha512.c b/nss/lib/freebl/sha512.c
> +index 946ab9f7f..3ec414b52 100644
> +--- a/nss/lib/freebl/sha512.c
> ++++ b/nss/lib/freebl/sha512.c
> +@@ -164,7 +164,7 @@ static void SHA256_Compress_Generic(SHA256Context *ctx);
> + static void SHA256_Update_Generic(SHA256Context *ctx, const unsigned char *input,
> +                                   unsigned int inputLen);
> +
> +-#if !defined(USE_HW_SHA2) || !defined(IS_LITTLE_ENDIAN)
> ++#if !defined(USE_HW_SHA2)
> + void
> + SHA256_Compress_Native(SHA256Context *ctx)
> + {
> +--
> +2.30.2
> +
> 

_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/1] package/libnss: fix build on ARM big endian
  2021-08-07 21:47 ` Giulio Benetti
@ 2021-08-08 12:30   ` Giulio Benetti
  0 siblings, 0 replies; 6+ messages in thread
From: Giulio Benetti @ 2021-08-08 12:30 UTC (permalink / raw)
  To: Fabrice Fontaine, buildroot; +Cc: Joseph Kogut

Hi Fabrice,

On 8/7/21 11:47 PM, Giulio Benetti wrote:
> Hi Fabrice,
> 
> On 8/7/21 11:32 PM, Fabrice Fontaine wrote:
>> Fix the follownig build failure on ARM big endian raised since bump to
>> version 3.68 in commit 0a73b9b962421ce7a72c88e5f5bbd8849f21b041:
>>
>> Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha256-armv8.o: In function `SHA256_Compress_Native':
>> sha256-armv8.c:(.text.SHA256_Compress_Native+0x0): multiple definition of `SHA256_Compress_Native'
>> Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha512.o:sha512.c:(.text.SHA256_Compress_Native+0x0): first defined here
>> Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha256-armv8.o: In function `SHA256_Update_Native':
>> sha256-armv8.c:(.text.SHA256_Update_Native+0x0): multiple definition of `SHA256_Update_Native'
>> Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha512.o:sha512.c:(.text.SHA256_Update_Native+0x0): first defined here
>>
>> Fixes:
>>    - http://autobuild.buildroot.org/results/237aba0c16a34fec1b0fe50fe08cace438eda1bf
>>
>> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
>> ---
>>    ...2.c-fix-SHA256-redefinition-on-ARM-b.patch | 47 +++++++++++++++++++
>>    1 file changed, 47 insertions(+)
>>    create mode 100644 package/libnss/0001-lib-freebl-sha512.c-fix-SHA256-redefinition-on-ARM-b.patch
>>
>> diff --git a/package/libnss/0001-lib-freebl-sha512.c-fix-SHA256-redefinition-on-ARM-b.patch b/package/libnss/0001-lib-freebl-sha512.c-fix-SHA256-redefinition-on-ARM-b.patch
>> new file mode 100644
>> index 0000000000..f925f20051
>> --- /dev/null
>> +++ b/package/libnss/0001-lib-freebl-sha512.c-fix-SHA256-redefinition-on-ARM-b.patch
>> @@ -0,0 +1,47 @@
>> +From 434d79c52db5b680accc531572319bd7094fa470 Mon Sep 17 00:00:00 2001
>> +From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
>> +Date: Sat, 7 Aug 2021 23:19:01 +0200
>> +Subject: [PATCH] lib/freebl/sha512.c: fix SHA256 redefinition on ARM big
>> + endian
>> +
>> +For an unknown reason, SHA256_{Compress,Update}_Native are defined in
>> +lib/freebl/sha512.c if IS_LITTLE_ENDIAN is undefined since version 3.68
>> +and
>> +https://github.com/nss-dev/nss/commit/e1e00f21f2d73e0d5d27651ad5606efa5714abe4
>> +
>> +This raises the following build failure on ARM big endian:
>> +
>> +Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha256-armv8.o: In function `SHA256_Compress_Native':
>> +sha256-armv8.c:(.text.SHA256_Compress_Native+0x0): multiple definition of `SHA256_Compress_Native'
>> +Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha512.o:sha512.c:(.text.SHA256_Compress_Native+0x0): first defined here
>> +Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha256-armv8.o: In function `SHA256_Update_Native':
>> +sha256-armv8.c:(.text.SHA256_Update_Native+0x0): multiple definition of `SHA256_Update_Native'
>> +Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha512.o:sha512.c:(.text.SHA256_Update_Native+0x0): first defined here
>> +
>> +Revert this change as it seems completely unrelated to the commit title
>> +"Bug 1655493 - Support SHA2 HW acceleration using Intel SHA Extension"
> 
> I'm not completely sure about this, since I remember most of armv8
> accelerations only work for LITTLE_ENDIAN. But I can't login to the
> Mozilla Bugzilla because of two factor authentication I've never enabled
> and I've asked help to fix this days ago with no answer. Do you have
> access to it?
> 
> Can you please clarify if that acceleration is valid on BIG_ENDIAN too?
> It's not written anywhere, but more than one lib/freebl/ lib
> acceleration has been done only for LITTLE_ENDIAN. What worries me is
> the hash table at the top that *maybe* is only suitable for LITTLE_ENDIAN:
> https://hg.mozilla.org/projects/nss/file/tip/lib/freebl/sha256-armv8.c#l24
> 
> For example check this patch I've sent time ago:
> https://hg.mozilla.org/projects/nss/rev/fa0d958de0c3cf99a7ec66e819b128c7bc88ff9f
> and the related bug:
> https://bugzilla.mozilla.org/show_bug.cgi?id=1580126
> 
> That makes me believe that is only LITTLE_ENDIAN compatible also due to
> this:
> https://hg.mozilla.org/projects/nss/file/tip/lib/freebl/sha512.c#l167
> 
> BUT I can't reach anyone, and they don't sign off the commits, so no
> e-mail to CC. Maybe you can through Mozilla Bugzilla?

Finally I have access to Mozilla Bugzilla and i've filed the bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=1724629

So I'd wait for their response and fix according to it.

Kind regards
-- 
Giulio Benetti
Benetti Engineering sas
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/1] package/libnss: fix build on ARM big endian
  2021-08-07 21:32 [Buildroot] [PATCH 1/1] package/libnss: fix build on ARM big endian Fabrice Fontaine
  2021-08-07 21:47 ` Giulio Benetti
@ 2021-08-08 20:22 ` Thomas Petazzoni
  2021-08-08 21:59   ` Giulio Benetti
  1 sibling, 1 reply; 6+ messages in thread
From: Thomas Petazzoni @ 2021-08-08 20:22 UTC (permalink / raw)
  To: Fabrice Fontaine; +Cc: Joseph Kogut, Giulio Benetti, buildroot

On Sat,  7 Aug 2021 23:32:54 +0200
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:

> Fix the follownig build failure on ARM big endian raised since bump to
> version 3.68 in commit 0a73b9b962421ce7a72c88e5f5bbd8849f21b041:
> 
> Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha256-armv8.o: In function `SHA256_Compress_Native':
> sha256-armv8.c:(.text.SHA256_Compress_Native+0x0): multiple definition of `SHA256_Compress_Native'
> Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha512.o:sha512.c:(.text.SHA256_Compress_Native+0x0): first defined here
> Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha256-armv8.o: In function `SHA256_Update_Native':
> sha256-armv8.c:(.text.SHA256_Update_Native+0x0): multiple definition of `SHA256_Update_Native'
> Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha512.o:sha512.c:(.text.SHA256_Update_Native+0x0): first defined here
> 
> Fixes:
>  - http://autobuild.buildroot.org/results/237aba0c16a34fec1b0fe50fe08cace438eda1bf
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> ---
>  ...2.c-fix-SHA256-redefinition-on-ARM-b.patch | 47 +++++++++++++++++++
>  1 file changed, 47 insertions(+)
>  create mode 100644 package/libnss/0001-lib-freebl-sha512.c-fix-SHA256-redefinition-on-ARM-b.patch

I have applied to master. Giulio: I saw your comments, and we will
definitely be interested in hearing upstream's feedback.

However, what happens seems pretty clear: on Aarch64 (little endian or
big endian), sha256-armv8.c gets compiled, and it defines a function
called SHA256_Compress_Native(). This sha256-armv8.c code is included
inside a USE_HW_SHA2 conditional, so it is only compiled in if
USE_HW_SHA2 is defined.

sha512.c, which is architecture-independent generic code, also
implements a function called SHA256_Compress_Native(). It only defines
it when !USE_HW_SHA2, to not conflict with architecture-optimized
variants... but due to the bug it also defines it when !LITTLE_ENDIAN.
This doesn't make sense because there is nothing that prevents the
sha256-armv8.c code from being compiled in big-endian Aarch64, and this
issue was introduced when someone optimized the sha256 code for x86, as
pointed by Fabrice.

So I believe Fabrice's solution is OK, but of course, upstream will
confirm (or not).

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/1] package/libnss: fix build on ARM big endian
  2021-08-08 20:22 ` Thomas Petazzoni
@ 2021-08-08 21:59   ` Giulio Benetti
  2021-08-10 16:37     ` Giulio Benetti
  0 siblings, 1 reply; 6+ messages in thread
From: Giulio Benetti @ 2021-08-08 21:59 UTC (permalink / raw)
  To: Thomas Petazzoni; +Cc: Joseph Kogut, Fabrice Fontaine, buildroot

Hello Thomas, Fabrice,

> Il giorno 8 ago 2021, alle ore 22:23, Thomas Petazzoni <thomas.petazzoni@bootlin.com> ha scritto:
> 
> On Sat,  7 Aug 2021 23:32:54 +0200
> Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:
> 
>> Fix the follownig build failure on ARM big endian raised since bump to
>> version 3.68 in commit 0a73b9b962421ce7a72c88e5f5bbd8849f21b041:
>> 
>> Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha256-armv8.o: In function `SHA256_Compress_Native':
>> sha256-armv8.c:(.text.SHA256_Compress_Native+0x0): multiple definition of `SHA256_Compress_Native'
>> Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha512.o:sha512.c:(.text.SHA256_Compress_Native+0x0): first defined here
>> Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha256-armv8.o: In function `SHA256_Update_Native':
>> sha256-armv8.c:(.text.SHA256_Update_Native+0x0): multiple definition of `SHA256_Update_Native'
>> Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha512.o:sha512.c:(.text.SHA256_Update_Native+0x0): first defined here
>> 
>> Fixes:
>> - http://autobuild.buildroot.org/results/237aba0c16a34fec1b0fe50fe08cace438eda1bf
>> 
>> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
>> ---
>> ...2.c-fix-SHA256-redefinition-on-ARM-b.patch | 47 +++++++++++++++++++
>> 1 file changed, 47 insertions(+)
>> create mode 100644 package/libnss/0001-lib-freebl-sha512.c-fix-SHA256-redefinition-on-ARM-b.patch
> 
> I have applied to master. Giulio: I saw your comments, and we will
> definitely be interested in hearing upstream's feedback.
> 
> However, what happens seems pretty clear: on Aarch64 (little endian or
> big endian), sha256-armv8.c gets compiled, and it defines a function
> called SHA256_Compress_Native(). This sha256-armv8.c code is included
> inside a USE_HW_SHA2 conditional, so it is only compiled in if
> USE_HW_SHA2 is defined.
> 
> sha512.c, which is architecture-independent generic code, also
> implements a function called SHA256_Compress_Native(). It only defines
> it when !USE_HW_SHA2, to not conflict with architecture-optimized
> variants... but due to the bug it also defines it when !LITTLE_ENDIAN.
> This doesn't make sense because there is nothing that prevents the
> sha256-armv8.c code from being compiled in big-endian Aarch64, and this
> issue was introduced when someone optimized the sha256 code for x86, as
> pointed by Fabrice.
> 
> So I believe Fabrice's solution is OK, but of course, upstream will
> confirm (or not).

Ok, so let’s wait for an upstream answer, in the meanwhile it builds fine and eventually if someone gives it a try on Aarch64 BE can file a bug for it or not.

Thank you
Best regards
Giulio

> 
> Thanks!
> 
> Thomas
> -- 
> Thomas Petazzoni, CTO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/1] package/libnss: fix build on ARM big endian
  2021-08-08 21:59   ` Giulio Benetti
@ 2021-08-10 16:37     ` Giulio Benetti
  0 siblings, 0 replies; 6+ messages in thread
From: Giulio Benetti @ 2021-08-10 16:37 UTC (permalink / raw)
  To: Thomas Petazzoni; +Cc: Joseph Kogut, Fabrice Fontaine, buildroot

Hello Thomas and Fabrice,

On 8/8/21 11:59 PM, Giulio Benetti wrote:
> Hello Thomas, Fabrice,
> 
>> Il giorno 8 ago 2021, alle ore 22:23, Thomas Petazzoni <thomas.petazzoni@bootlin.com> ha scritto:
>>
>> On Sat,  7 Aug 2021 23:32:54 +0200
>> Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:
>>
>>> Fix the follownig build failure on ARM big endian raised since bump to
>>> version 3.68 in commit 0a73b9b962421ce7a72c88e5f5bbd8849f21b041:
>>>
>>> Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha256-armv8.o: In function `SHA256_Compress_Native':
>>> sha256-armv8.c:(.text.SHA256_Compress_Native+0x0): multiple definition of `SHA256_Compress_Native'
>>> Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha512.o:sha512.c:(.text.SHA256_Compress_Native+0x0): first defined here
>>> Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha256-armv8.o: In function `SHA256_Update_Native':
>>> sha256-armv8.c:(.text.SHA256_Update_Native+0x0): multiple definition of `SHA256_Update_Native'
>>> Linux2.6_aarch64_aarch64_be-linux-gnu-gcc_glibc_PTH_64_DBG.OBJ/Linux_SINGLE_SHLIB/sha512.o:sha512.c:(.text.SHA256_Update_Native+0x0): first defined here
>>>
>>> Fixes:
>>> - http://autobuild.buildroot.org/results/237aba0c16a34fec1b0fe50fe08cace438eda1bf
>>>
>>> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
>>> ---
>>> ...2.c-fix-SHA256-redefinition-on-ARM-b.patch | 47 +++++++++++++++++++
>>> 1 file changed, 47 insertions(+)
>>> create mode 100644 package/libnss/0001-lib-freebl-sha512.c-fix-SHA256-redefinition-on-ARM-b.patch
>>
>> I have applied to master. Giulio: I saw your comments, and we will
>> definitely be interested in hearing upstream's feedback.
>>
>> However, what happens seems pretty clear: on Aarch64 (little endian or
>> big endian), sha256-armv8.c gets compiled, and it defines a function
>> called SHA256_Compress_Native(). This sha256-armv8.c code is included
>> inside a USE_HW_SHA2 conditional, so it is only compiled in if
>> USE_HW_SHA2 is defined.
>>
>> sha512.c, which is architecture-independent generic code, also
>> implements a function called SHA256_Compress_Native(). It only defines
>> it when !USE_HW_SHA2, to not conflict with architecture-optimized
>> variants... but due to the bug it also defines it when !LITTLE_ENDIAN.
>> This doesn't make sense because there is nothing that prevents the
>> sha256-armv8.c code from being compiled in big-endian Aarch64, and this
>> issue was introduced when someone optimized the sha256 code for x86, as
>> pointed by Fabrice.
>>
>> So I believe Fabrice's solution is OK, but of course, upstream will
>> confirm (or not).
> 
> Ok, so let’s wait for an upstream answer, in the meanwhile it builds fine and eventually if someone gives it a try on Aarch64 BE can file a bug for it or not.

Upstream answered it seems compatible for both BIG and LITTLE Endian:
https://bugzilla.mozilla.org/show_bug.cgi?id=1724629
so I've pointed Fabrice's patch that should be committed soon.

Best regards
Giulio

> Thank you
> Best regards
> Giulio
> 
>>
>> Thanks!
>>
>> Thomas
>> -- 
>> Thomas Petazzoni, CTO, Bootlin
>> Embedded Linux and Kernel engineering
>> https://bootlin.com
>> _______________________________________________
>> buildroot mailing list
>> buildroot@busybox.net
>> http://lists.busybox.net/mailman/listinfo/buildroot
> 
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
> 

-- 
Giulio Benetti
Benetti Engineering sas
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

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

end of thread, other threads:[~2021-08-10 16:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-07 21:32 [Buildroot] [PATCH 1/1] package/libnss: fix build on ARM big endian Fabrice Fontaine
2021-08-07 21:47 ` Giulio Benetti
2021-08-08 12:30   ` Giulio Benetti
2021-08-08 20:22 ` Thomas Petazzoni
2021-08-08 21:59   ` Giulio Benetti
2021-08-10 16:37     ` Giulio Benetti

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.