* [Buildroot] [PATCH] package/libnss: fix build failure on powerpc without <sys/auxv.h>
@ 2019-12-10 12:13 Giulio Benetti
2019-12-10 12:14 ` Giulio Benetti
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Giulio Benetti @ 2019-12-10 12:13 UTC (permalink / raw)
To: buildroot
Add patch to fix build failure on PowerPc without <sys/auxv.h>. The patch
inserts #if statements to include or note <sys/auxv.h> prior it exists.
Fixes:
http://autobuild.buildroot.net/results/8bf95bd8a0aec8c53889308ab1e00d0a94f53d57/
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
...Fix-PowerPc-build-sys-auxv.h-failure.patch | 40 +++++++++++++++++++
1 file changed, 40 insertions(+)
create mode 100644 package/libnss/0004-Bug-1602743-Fix-PowerPc-build-sys-auxv.h-failure.patch
diff --git a/package/libnss/0004-Bug-1602743-Fix-PowerPc-build-sys-auxv.h-failure.patch b/package/libnss/0004-Bug-1602743-Fix-PowerPc-build-sys-auxv.h-failure.patch
new file mode 100644
index 0000000000..c8f12d777a
--- /dev/null
+++ b/package/libnss/0004-Bug-1602743-Fix-PowerPc-build-sys-auxv.h-failure.patch
@@ -0,0 +1,40 @@
+From efe0fd875c80ff6e3a05db6c5e15b07c173530a6 Mon Sep 17 00:00:00 2001
+From: Giulio Benetti <giulio.benetti@benettiengineering.com>
+Date: Tue, 10 Dec 2019 13:06:01 +0100
+Subject: [PATCH] Bug 1602743 - Fix PowerPc build sys/auxv.h failure
+
+Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
+---
+ nss/lib/freebl/blinit.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/nss/lib/freebl/blinit.c b/nss/lib/freebl/blinit.c
+index 959109b60..f0654595d 100644
+--- a/nss/lib/freebl/blinit.c
++++ b/nss/lib/freebl/blinit.c
+@@ -357,7 +357,9 @@ ppc_crypto_support()
+
+ #if defined(__powerpc__)
+
++#if (__has_include(<sys/auxv.h>))
+ #include <sys/auxv.h>
++#endif
+
+ // Defines from cputable.h in Linux kernel - PPC, letting us build on older kernels
+ #ifndef PPC_FEATURE2_VEC_CRYPTO
+@@ -368,8 +370,11 @@ static void
+ CheckPPCSupport()
+ {
+ char *disable_hw_crypto = PR_GetEnvSecure("NSS_DISABLE_PPC_GHASH");
++ long hwcaps = 0;
+
+- long hwcaps = getauxval(AT_HWCAP2);
++#if (__has_include(<sys/auxv.h>))
++ hwcaps = getauxval(AT_HWCAP2);
++#endif
+
+ ppc_crypto_support_ = hwcaps & PPC_FEATURE2_VEC_CRYPTO && disable_hw_crypto == NULL;
+ }
+--
+2.20.1
+
--
2.20.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH] package/libnss: fix build failure on powerpc without <sys/auxv.h>
2019-12-10 12:13 [Buildroot] [PATCH] package/libnss: fix build failure on powerpc without <sys/auxv.h> Giulio Benetti
@ 2019-12-10 12:14 ` Giulio Benetti
2019-12-10 13:09 ` Thomas Petazzoni
2019-12-23 22:46 ` Thomas Petazzoni
2 siblings, 0 replies; 6+ messages in thread
From: Giulio Benetti @ 2019-12-10 12:14 UTC (permalink / raw)
To: buildroot
On 12/10/19 1:13 PM, Giulio Benetti wrote:
> Add patch to fix build failure on PowerPc without <sys/auxv.h>. The patch
> inserts #if statements to include or note <sys/auxv.h> prior it exists.
>
> Fixes:
> http://autobuild.buildroot.net/results/8bf95bd8a0aec8c53889308ab1e00d0a94f53d57/
>
> Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
It's already pending upstream:
https://bugzilla.mozilla.org/show_bug.cgi?id=1602743
> ---
> ...Fix-PowerPc-build-sys-auxv.h-failure.patch | 40 +++++++++++++++++++
> 1 file changed, 40 insertions(+)
> create mode 100644 package/libnss/0004-Bug-1602743-Fix-PowerPc-build-sys-auxv.h-failure.patch
>
> diff --git a/package/libnss/0004-Bug-1602743-Fix-PowerPc-build-sys-auxv.h-failure.patch b/package/libnss/0004-Bug-1602743-Fix-PowerPc-build-sys-auxv.h-failure.patch
> new file mode 100644
> index 0000000000..c8f12d777a
> --- /dev/null
> +++ b/package/libnss/0004-Bug-1602743-Fix-PowerPc-build-sys-auxv.h-failure.patch
> @@ -0,0 +1,40 @@
> +From efe0fd875c80ff6e3a05db6c5e15b07c173530a6 Mon Sep 17 00:00:00 2001
> +From: Giulio Benetti <giulio.benetti@benettiengineering.com>
> +Date: Tue, 10 Dec 2019 13:06:01 +0100
> +Subject: [PATCH] Bug 1602743 - Fix PowerPc build sys/auxv.h failure
> +
> +Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
> +---
> + nss/lib/freebl/blinit.c | 7 ++++++-
> + 1 file changed, 6 insertions(+), 1 deletion(-)
> +
> +diff --git a/nss/lib/freebl/blinit.c b/nss/lib/freebl/blinit.c
> +index 959109b60..f0654595d 100644
> +--- a/nss/lib/freebl/blinit.c
> ++++ b/nss/lib/freebl/blinit.c
> +@@ -357,7 +357,9 @@ ppc_crypto_support()
> +
> + #if defined(__powerpc__)
> +
> ++#if (__has_include(<sys/auxv.h>))
> + #include <sys/auxv.h>
> ++#endif
> +
> + // Defines from cputable.h in Linux kernel - PPC, letting us build on older kernels
> + #ifndef PPC_FEATURE2_VEC_CRYPTO
> +@@ -368,8 +370,11 @@ static void
> + CheckPPCSupport()
> + {
> + char *disable_hw_crypto = PR_GetEnvSecure("NSS_DISABLE_PPC_GHASH");
> ++ long hwcaps = 0;
> +
> +- long hwcaps = getauxval(AT_HWCAP2);
> ++#if (__has_include(<sys/auxv.h>))
> ++ hwcaps = getauxval(AT_HWCAP2);
> ++#endif
> +
> + ppc_crypto_support_ = hwcaps & PPC_FEATURE2_VEC_CRYPTO && disable_hw_crypto == NULL;
> + }
> +--
> +2.20.1
> +
>
--
Giulio Benetti
Benetti Engineering sas
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH] package/libnss: fix build failure on powerpc without <sys/auxv.h>
2019-12-10 12:13 [Buildroot] [PATCH] package/libnss: fix build failure on powerpc without <sys/auxv.h> Giulio Benetti
2019-12-10 12:14 ` Giulio Benetti
@ 2019-12-10 13:09 ` Thomas Petazzoni
2019-12-10 13:23 ` Giulio Benetti
2019-12-23 22:46 ` Thomas Petazzoni
2 siblings, 1 reply; 6+ messages in thread
From: Thomas Petazzoni @ 2019-12-10 13:09 UTC (permalink / raw)
To: buildroot
On Tue, 10 Dec 2019 13:13:22 +0100
Giulio Benetti <giulio.benetti@benettiengineering.com> wrote:
> Add patch to fix build failure on PowerPc without <sys/auxv.h>. The patch
> inserts #if statements to include or note <sys/auxv.h> prior it exists.
>
> Fixes:
> http://autobuild.buildroot.net/results/8bf95bd8a0aec8c53889308ab1e00d0a94f53d57/
When is this header file available/not available? Is it a glibc vs.
musl vs. uClibc thing? Something else?
I'm not really a big fan of solutions that simply consist in "it wants
this file, this file is not available, so let's make it ignore it",
without a deeper investigation.
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH] package/libnss: fix build failure on powerpc without <sys/auxv.h>
2019-12-10 13:09 ` Thomas Petazzoni
@ 2019-12-10 13:23 ` Giulio Benetti
2019-12-10 13:31 ` Thomas Petazzoni
0 siblings, 1 reply; 6+ messages in thread
From: Giulio Benetti @ 2019-12-10 13:23 UTC (permalink / raw)
To: buildroot
Hi Thomas,
On 12/10/19 2:09 PM, Thomas Petazzoni wrote:
> On Tue, 10 Dec 2019 13:13:22 +0100
> Giulio Benetti <giulio.benetti@benettiengineering.com> wrote:
>
>> Add patch to fix build failure on PowerPc without <sys/auxv.h>. The patch
>> inserts #if statements to include or note <sys/auxv.h> prior it exists.
>>
>> Fixes:
>> http://autobuild.buildroot.net/results/8bf95bd8a0aec8c53889308ab1e00d0a94f53d57/
>
> When is this header file available/not available? Is it a glibc vs.
> musl vs. uClibc thing? Something else?
>
> I'm not really a big fan of solutions that simply consist in "it wants
> this file, this file is not available, so let's make it ignore it",
> without a deeper investigation.
Upstream already use this solution in the same file, i.e. arm/aarch64:
https://hg.mozilla.org/projects/nss/file/tip/lib/freebl/blinit.c#l100
and only if <sys/auxv.h> is present then they probe with getauxval() to
check which HWCAP_ is present, otherwise they consider(i.e.)
arm_neon_support not present, that is not true in any case. But at the
time of this writing they seem to consider this enough, probably they
will improve it later.
Best regards
--
Giulio Benetti
Benetti Engineering sas
> Thomas
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH] package/libnss: fix build failure on powerpc without <sys/auxv.h>
2019-12-10 13:23 ` Giulio Benetti
@ 2019-12-10 13:31 ` Thomas Petazzoni
0 siblings, 0 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2019-12-10 13:31 UTC (permalink / raw)
To: buildroot
Hello,
On Tue, 10 Dec 2019 14:23:02 +0100
Giulio Benetti <giulio.benetti@benettiengineering.com> wrote:
> > I'm not really a big fan of solutions that simply consist in "it wants
> > this file, this file is not available, so let's make it ignore it",
> > without a deeper investigation.
>
> Upstream already use this solution in the same file, i.e. arm/aarch64:
> https://hg.mozilla.org/projects/nss/file/tip/lib/freebl/blinit.c#l100
>
> and only if <sys/auxv.h> is present then they probe with getauxval() to
> check which HWCAP_ is present, otherwise they consider(i.e.)
> arm_neon_support not present, that is not true in any case. But at the
> time of this writing they seem to consider this enough, probably they
> will improve it later.
OK, if this is indeed used on other architectures, then I guess doing
the same on PowerPC doesn't hurt. Thanks for the additional explanation!
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH] package/libnss: fix build failure on powerpc without <sys/auxv.h>
2019-12-10 12:13 [Buildroot] [PATCH] package/libnss: fix build failure on powerpc without <sys/auxv.h> Giulio Benetti
2019-12-10 12:14 ` Giulio Benetti
2019-12-10 13:09 ` Thomas Petazzoni
@ 2019-12-23 22:46 ` Thomas Petazzoni
2 siblings, 0 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2019-12-23 22:46 UTC (permalink / raw)
To: buildroot
On Tue, 10 Dec 2019 13:13:22 +0100
Giulio Benetti <giulio.benetti@benettiengineering.com> wrote:
> Add patch to fix build failure on PowerPc without <sys/auxv.h>. The patch
> inserts #if statements to include or note <sys/auxv.h> prior it exists.
>
> Fixes:
> http://autobuild.buildroot.net/results/8bf95bd8a0aec8c53889308ab1e00d0a94f53d57/
>
> Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
> ---
> ...Fix-PowerPc-build-sys-auxv.h-failure.patch | 40 +++++++++++++++++++
> 1 file changed, 40 insertions(+)
> create mode 100644 package/libnss/0004-Bug-1602743-Fix-PowerPc-build-sys-auxv.h-failure.patch
Applied to master, thanks.
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-12-23 22:46 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-10 12:13 [Buildroot] [PATCH] package/libnss: fix build failure on powerpc without <sys/auxv.h> Giulio Benetti
2019-12-10 12:14 ` Giulio Benetti
2019-12-10 13:09 ` Thomas Petazzoni
2019-12-10 13:23 ` Giulio Benetti
2019-12-10 13:31 ` Thomas Petazzoni
2019-12-23 22:46 ` Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox