[Buildroot] [PATCH 1/1] package/libnss: fix build on ARM big endian

Giulio Benetti giulio.benetti at benettiengineering.com
Tue Aug 10 16:37:36 UTC 2021


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 at bootlin.com> ha scritto:
>>
>> On Sat,  7 Aug 2021 23:32:54 +0200
>> Fabrice Fontaine <fontaine.fabrice at 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 at 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 at busybox.net
>> http://lists.busybox.net/mailman/listinfo/buildroot
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
> 

-- 
Giulio Benetti
Benetti Engineering sas



More information about the buildroot mailing list