Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Cc: Joseph Kogut <joseph.kogut@gmail.com>,
	Giulio Benetti <giulio.benetti@benettiengineering.com>,
	buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH 1/1] package/libnss: fix build on ARM big endian
Date: Sun, 8 Aug 2021 22:22:52 +0200	[thread overview]
Message-ID: <20210808222252.622b4470@windsurf> (raw)
In-Reply-To: <20210807213254.2103314-1-fontaine.fabrice@gmail.com>

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

  parent reply	other threads:[~2021-08-08 20:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2021-08-08 21:59   ` Giulio Benetti
2021-08-10 16:37     ` Giulio Benetti

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210808222252.622b4470@windsurf \
    --to=thomas.petazzoni@bootlin.com \
    --cc=buildroot@buildroot.org \
    --cc=fontaine.fabrice@gmail.com \
    --cc=giulio.benetti@benettiengineering.com \
    --cc=joseph.kogut@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox