* [Buildroot] [PATCH] package/libnss: fix ppc 32-bit build failure
@ 2020-01-02 18:17 Giulio Benetti
2020-01-02 20:54 ` Vincent Fazio
2020-01-14 18:49 ` [Buildroot] [PATCH] package/libnss: fix ppc 32-bit " Giulio Benetti
0 siblings, 2 replies; 11+ messages in thread
From: Giulio Benetti @ 2020-01-02 18:17 UTC (permalink / raw)
To: buildroot
NSS assumes that Altivec is supported on powerpc64 only, but in
Makefile it tries to build gcm-ppc.c(containing Altivec functions
calls), even if powerpc is not 64-bits. So add a patch to add a check if
architecture is a 64-bit to build gcm-ppc.
Fixes:
http://autobuild.buildroot.net/results/433/433a7db21654d67626c7a3e5f1272d6c3ce4fe6c/
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
Pending upstream:
https://bugzilla.mozilla.org/show_bug.cgi?id=1606689
---
...1606689-Fix-ppc-32-bit-build-failure.patch | 31 +++++++++++++++++++
1 file changed, 31 insertions(+)
create mode 100644 package/libnss/0006-Bug-1606689-Fix-ppc-32-bit-build-failure.patch
diff --git a/package/libnss/0006-Bug-1606689-Fix-ppc-32-bit-build-failure.patch b/package/libnss/0006-Bug-1606689-Fix-ppc-32-bit-build-failure.patch
new file mode 100644
index 0000000000..de30fa7002
--- /dev/null
+++ b/package/libnss/0006-Bug-1606689-Fix-ppc-32-bit-build-failure.patch
@@ -0,0 +1,31 @@
+From fcac43d6a0af59926da7ad4a15a37255887cdfa2 Mon Sep 17 00:00:00 2001
+From: Giulio Benetti <giulio.benetti@benettiengineering.com>
+Date: Thu, 2 Jan 2020 18:55:50 +0100
+Subject: [PATCH] Bug 1606689 - Fix ppc 32-bit build failure
+
+NSS assumes that only 64-bit powerpc support Altivec instructions to be
+used in gcm-ppc.c, so align Makefile condition to build gcm-ppc.c only
+if USE_64 is defined.
+
+Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
+---
+ nss/lib/freebl/Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/nss/lib/freebl/Makefile b/nss/lib/freebl/Makefile
+index 00518d7f8..0e230d8c5 100644
+--- a/nss/lib/freebl/Makefile
++++ b/nss/lib/freebl/Makefile
+@@ -264,8 +264,8 @@ ifeq ($(CPU_ARCH),arm)
+ MPI_SRCS += mpi_arm.c
+ endif
+ ifeq ($(CPU_ARCH),ppc)
+- EXTRA_SRCS += gcm-ppc.c
+ ifdef USE_64
++ EXTRA_SRCS += gcm-ppc.c
+ DEFINES += -DNSS_NO_INIT_SUPPORT
+ endif # USE_64
+ endif # ppc
+--
+2.20.1
+
--
2.20.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH] package/libnss: fix ppc 32-bit build failure
2020-01-02 18:17 [Buildroot] [PATCH] package/libnss: fix ppc 32-bit build failure Giulio Benetti
@ 2020-01-02 20:54 ` Vincent Fazio
2020-01-02 21:41 ` Giulio Benetti
2020-01-14 18:49 ` [Buildroot] [PATCH] package/libnss: fix ppc 32-bit " Giulio Benetti
1 sibling, 1 reply; 11+ messages in thread
From: Vincent Fazio @ 2020-01-02 20:54 UTC (permalink / raw)
To: buildroot
Giulio,
On 1/2/20 12:17 PM, Giulio Benetti wrote:
> NSS assumes that Altivec is supported on powerpc64 only, but in
> Makefile it tries to build gcm-ppc.c(containing Altivec functions
> calls), even if powerpc is not 64-bits. So add a patch to add a check if
> architecture is a 64-bit to build gcm-ppc.
>
> Fixes:
> http://autobuild.buildroot.net/results/433/433a7db21654d67626c7a3e5f1272d6c3ce4fe6c/
>
> Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
> ---
> Pending upstream:
> https://bugzilla.mozilla.org/show_bug.cgi?id=1606689
> ---
> ...1606689-Fix-ppc-32-bit-build-failure.patch | 31 +++++++++++++++++++
> 1 file changed, 31 insertions(+)
> create mode 100644 package/libnss/0006-Bug-1606689-Fix-ppc-32-bit-build-failure.patch
>
> diff --git a/package/libnss/0006-Bug-1606689-Fix-ppc-32-bit-build-failure.patch b/package/libnss/0006-Bug-1606689-Fix-ppc-32-bit-build-failure.patch
> new file mode 100644
> index 0000000000..de30fa7002
> --- /dev/null
> +++ b/package/libnss/0006-Bug-1606689-Fix-ppc-32-bit-build-failure.patch
> @@ -0,0 +1,31 @@
> +From fcac43d6a0af59926da7ad4a15a37255887cdfa2 Mon Sep 17 00:00:00 2001
> +From: Giulio Benetti <giulio.benetti@benettiengineering.com>
> +Date: Thu, 2 Jan 2020 18:55:50 +0100
> +Subject: [PATCH] Bug 1606689 - Fix ppc 32-bit build failure
> +
> +NSS assumes that only 64-bit powerpc support Altivec instructions to be
> +used in gcm-ppc.c, so align Makefile condition to build gcm-ppc.c only
> +if USE_64 is defined.
> +
> +Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
> +---
> + nss/lib/freebl/Makefile | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/nss/lib/freebl/Makefile b/nss/lib/freebl/Makefile
> +index 00518d7f8..0e230d8c5 100644
> +--- a/nss/lib/freebl/Makefile
> ++++ b/nss/lib/freebl/Makefile
> +@@ -264,8 +264,8 @@ ifeq ($(CPU_ARCH),arm)
> + MPI_SRCS += mpi_arm.c
> + endif
> + ifeq ($(CPU_ARCH),ppc)
> +- EXTRA_SRCS += gcm-ppc.c
> + ifdef USE_64
> ++ EXTRA_SRCS += gcm-ppc.c
Are you dropping this file for 32bit builds due to the Altivec
requirements? General Altivec instructions are available on 32bit chips,
such as those from Freescale/NXP. The e600 is a product that comes to
mind. IMO, the Makefile should include the file if the architecture is
'ppc'. I think it makes sense that the source file should determine what
it compiles down to. It's possible the hw acceleration logic for PPC
changes later and this is one more file that would need to be touched.
Unfortunately, this is where it gets a bit more complicated...
The backing instruction for the vec_xl_be compiler intrinsic is lxvd2x
(a VSX instruction). Technically I think this instruction was available
in the Power ISA as early as 2.06, but GCC is only advertising the
intrinsic as of ISA 3.0 (Power 9+).
https://gcc.gnu.org/onlinedocs/gcc-8.3.0/gcc/PowerPC-Built-in-Functions.html#PowerPC-Built-in-Functions
I've always had issues reading the logic behind GCC's instruction
generation and I don't have 8+ handy... I'm not sure if there's a guard
to prevent the lxvd2x instruction from being emitted or not when
resolving vec_xl_be and, say, '-maltivec -mpcu=7450' is specified. If
there isn't, I'd expect either an illegal instruction exception or for
the kernel to emulate it magically. If there is, I'd expect GCC to
either compile a compatible instruction shim or to simply error out.
Regardless, given the way the hardware acceleration is written currently
to require that compiler intrinsic, USE_PPC_CRYPTO may need to be
guarded by __builtin_cpu_supports("arch_3_00")
> + DEFINES += -DNSS_NO_INIT_SUPPORT
> + endif # USE_64
> + endif # ppc
> +--
> +2.20.1
> +
--
Vincent Fazio
Embedded Software Engineer - Linux
Extreme Engineering Solutions, Inc
http://www.xes-inc.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH] package/libnss: fix ppc 32-bit build failure
2020-01-02 20:54 ` Vincent Fazio
@ 2020-01-02 21:41 ` Giulio Benetti
2020-01-03 16:22 ` Vincent Fazio
0 siblings, 1 reply; 11+ messages in thread
From: Giulio Benetti @ 2020-01-02 21:41 UTC (permalink / raw)
To: buildroot
Hi Vincent,
On 1/2/20 9:54 PM, Vincent Fazio wrote:
> Giulio,
>
> On 1/2/20 12:17 PM, Giulio Benetti wrote:
>> NSS assumes that Altivec is supported on powerpc64 only, but in
>> Makefile it tries to build gcm-ppc.c(containing Altivec functions
>> calls), even if powerpc is not 64-bits. So add a patch to add a check if
>> architecture is a 64-bit to build gcm-ppc.
>>
>> Fixes:
>> http://autobuild.buildroot.net/results/433/433a7db21654d67626c7a3e5f1272d6c3ce4fe6c/
>>
>> Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
>> ---
>> Pending upstream:
>> https://bugzilla.mozilla.org/show_bug.cgi?id=1606689
>> ---
>> ...1606689-Fix-ppc-32-bit-build-failure.patch | 31 +++++++++++++++++++
>> 1 file changed, 31 insertions(+)
>> create mode 100644 package/libnss/0006-Bug-1606689-Fix-ppc-32-bit-build-failure.patch
>>
>> diff --git a/package/libnss/0006-Bug-1606689-Fix-ppc-32-bit-build-failure.patch b/package/libnss/0006-Bug-1606689-Fix-ppc-32-bit-build-failure.patch
>> new file mode 100644
>> index 0000000000..de30fa7002
>> --- /dev/null
>> +++ b/package/libnss/0006-Bug-1606689-Fix-ppc-32-bit-build-failure.patch
>> @@ -0,0 +1,31 @@
>> +From fcac43d6a0af59926da7ad4a15a37255887cdfa2 Mon Sep 17 00:00:00 2001
>> +From: Giulio Benetti <giulio.benetti@benettiengineering.com>
>> +Date: Thu, 2 Jan 2020 18:55:50 +0100
>> +Subject: [PATCH] Bug 1606689 - Fix ppc 32-bit build failure
>> +
>> +NSS assumes that only 64-bit powerpc support Altivec instructions to be
>> +used in gcm-ppc.c, so align Makefile condition to build gcm-ppc.c only
>> +if USE_64 is defined.
>> +
>> +Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
>> +---
>> + nss/lib/freebl/Makefile | 2 +-
>> + 1 file changed, 1 insertion(+), 1 deletion(-)
>> +
>> +diff --git a/nss/lib/freebl/Makefile b/nss/lib/freebl/Makefile
>> +index 00518d7f8..0e230d8c5 100644
>> +--- a/nss/lib/freebl/Makefile
>> ++++ b/nss/lib/freebl/Makefile
>> +@@ -264,8 +264,8 @@ ifeq ($(CPU_ARCH),arm)
>> + MPI_SRCS += mpi_arm.c
>> + endif
>> + ifeq ($(CPU_ARCH),ppc)
>> +- EXTRA_SRCS += gcm-ppc.c
>> + ifdef USE_64
>> ++ EXTRA_SRCS += gcm-ppc.c
>
> Are you dropping this file for 32bit builds due to the Altivec
> requirements? General Altivec instructions are available on 32bit chips,
> such as those from Freescale/NXP. The e600 is a product that comes to
> mind. IMO, the Makefile should include the file if the architecture is
> 'ppc'. I think it makes sense that the source file should determine what
> it compiles down to. It's possible the hw acceleration logic for PPC
> changes later and this is one more file that would need to be touched.
>
> Unfortunately, this is where it gets a bit more complicated...
>
> The backing instruction for the vec_xl_be compiler intrinsic is lxvd2x
> (a VSX instruction). Technically I think this instruction was available
> in the Power ISA as early as 2.06, but GCC is only advertising the
> intrinsic as of ISA 3.0 (Power 9+).
> https://gcc.gnu.org/onlinedocs/gcc-8.3.0/gcc/PowerPC-Built-in-Functions.html#PowerPC-Built-in-Functions
>
> I've always had issues reading the logic behind GCC's instruction
> generation and I don't have 8+ handy... I'm not sure if there's a guard
> to prevent the lxvd2x instruction from being emitted or not when
> resolving vec_xl_be and, say, '-maltivec -mpcu=7450' is specified. If
> there isn't, I'd expect either an illegal instruction exception or for
> the kernel to emulate it magically. If there is, I'd expect GCC to
> either compile a compatible instruction shim or to simply error out.
>
> Regardless, given the way the hardware acceleration is written currently
> to require that compiler intrinsic, USE_PPC_CRYPTO may need to be
> guarded by __builtin_cpu_supports("arch_3_00")
They are all good suggestions but I think they are more NSS related than
Buildroot related. What I'm trying to do here is to avoid build failure
in Buildroot and as much as possible to try to contribute upstream. As
you've mentioned above 32-bit supports Altivec, but the problem at the
moment is that USE_PPC_CRYPTO is defined in gcm.h only if __powerpc64__
is defined, this means that they only tested it for that
architecture(ppc64 and ppc64le). So at the moment I'd prefer keep 32-bit
Altivec supported devices without gcm altivec acceleration. But if you
have a patch that takes into account 32-bits Altivec too, please upload
it here:
https://bugzilla.mozilla.org/show_bug.cgi?id=1606689
so we fix this problem once!
Maybe we can live chat on BR IRC if you join it.
Thanks for reviewing so in depth.
Best regards
--
Giulio Benetti
Benetti Engineering sas
>> + DEFINES += -DNSS_NO_INIT_SUPPORT
>> + endif # USE_64
>> + endif # ppc
>> +--
>> +2.20.1
>> +
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH] package/libnss: fix ppc 32-bit build failure
2020-01-02 21:41 ` Giulio Benetti
@ 2020-01-03 16:22 ` Vincent Fazio
2020-01-03 17:24 ` Giulio Benetti
0 siblings, 1 reply; 11+ messages in thread
From: Vincent Fazio @ 2020-01-03 16:22 UTC (permalink / raw)
To: buildroot
Giulio,
On 1/2/20 3:41 PM, Giulio Benetti wrote:
> Hi Vincent,
>
> On 1/2/20 9:54 PM, Vincent Fazio wrote:
>> Giulio,
>>
>> Are you dropping this file for 32bit builds due to the Altivec
>> requirements? General Altivec instructions are available on 32bit chips,
>> such as those from Freescale/NXP. The e600 is a product that comes to
>> mind. IMO, the Makefile should include the file if the architecture is
>> 'ppc'. I think it makes sense that the source file should determine what
>> it compiles down to. It's possible the hw acceleration logic for PPC
>> changes later and this is one more file that would need to be touched.
>>
>> Unfortunately, this is where it gets a bit more complicated...
>>
>> The backing instruction for the vec_xl_be compiler intrinsic is lxvd2x
>> (a VSX instruction). Technically I think this instruction was available
>> in the Power ISA as early as 2.06, but GCC is only advertising the
>> intrinsic as of ISA 3.0 (Power 9+).
>> https://gcc.gnu.org/onlinedocs/gcc-8.3.0/gcc/PowerPC-Built-in-Functions.html#PowerPC-Built-in-Functions
>>
>>
>> I've always had issues reading the logic behind GCC's instruction
>> generation and I don't have 8+ handy... I'm not sure if there's a guard
>> to prevent the lxvd2x instruction from being emitted or not when
>> resolving vec_xl_be and, say, '-maltivec -mpcu=7450' is specified. If
>> there isn't, I'd expect either an illegal instruction exception or for
>> the kernel to emulate it magically. If there is, I'd expect GCC to
>> either compile a compatible instruction shim or to simply error out.
>>
>> Regardless, given the way the hardware acceleration is written currently
>> to require that compiler intrinsic, USE_PPC_CRYPTO may need to be
>> guarded by __builtin_cpu_supports("arch_3_00")
>
> They are all good suggestions but I think they are more NSS related
> than Buildroot related. What I'm trying to do here is to avoid build
> failure in Buildroot and as much as possible to try to contribute
> upstream. As you've mentioned above 32-bit supports Altivec, but the
> problem at the moment is that USE_PPC_CRYPTO is defined in gcm.h only
> if __powerpc64__ is defined, this means that they only tested it for
> that architecture(ppc64 and ppc64le). So at the moment I'd prefer keep
> 32-bit Altivec supported devices without gcm altivec acceleration. But
> if you have a patch that takes into account 32-bits Altivec too,
> please upload it here:
>
For Buildroot, we can likely key off
ifneq($(BR2_POWERPC_CPU_HAS_ALTIVEC),y) and sed delete the '-mcrypto
-maltivec' flags from lib/freebl/Makefile... The -mcrypto enables -mvsx
and causes gcc to emit instructions the target CPU may not support,
that's why it should be removed. Luckily, we can make some assumptions
that if ALTIVEC isn't supported, VSX and Crypto functions arent either
since they're introduced in the same or later ISA revisions.
> https://bugzilla.mozilla.org/show_bug.cgi?id=1606689
>
> so we fix this problem once!
I'm not sure this can be done "cleanly" given how this is currently
structured. I've added a comment in the bug. Not all 64bit PPC
processors have Altivec (e5500 does not). Plus this goes a bit beyond
that since the functions they're using require at least Power ISA 3.0.
The source package should probably inherit CFLAGS instead of assuming it
can define it given the complexities of PPC cpu tuning.
>
> Maybe we can live chat on BR IRC if you join it.
I'm idling there today
>
>
> Thanks for reviewing so in depth.
> Best regards
--
Vincent Fazio
Embedded Software Engineer - Linux
Extreme Engineering Solutions, Inc
http://www.xes-inc.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH] package/libnss: fix ppc 32-bit build failure
2020-01-03 16:22 ` Vincent Fazio
@ 2020-01-03 17:24 ` Giulio Benetti
2020-01-14 20:46 ` [Buildroot] [PATCH] package/libnss: fix powerpc altivec " Giulio Benetti
0 siblings, 1 reply; 11+ messages in thread
From: Giulio Benetti @ 2020-01-03 17:24 UTC (permalink / raw)
To: buildroot
Vincent, Thomas, Yann, All,
On 1/3/20 5:22 PM, Vincent Fazio wrote:
> Giulio,
>
> On 1/2/20 3:41 PM, Giulio Benetti wrote:
>> Hi Vincent,
>>
>> On 1/2/20 9:54 PM, Vincent Fazio wrote:
>>> Giulio,
>>>
>>> Are you dropping this file for 32bit builds due to the Altivec
>>> requirements? General Altivec instructions are available on 32bit chips,
>>> such as those from Freescale/NXP. The e600 is a product that comes to
>>> mind. IMO, the Makefile should include the file if the architecture is
>>> 'ppc'. I think it makes sense that the source file should determine what
>>> it compiles down to. It's possible the hw acceleration logic for PPC
>>> changes later and this is one more file that would need to be touched.
>>>
>>> Unfortunately, this is where it gets a bit more complicated...
>>>
>>> The backing instruction for the vec_xl_be compiler intrinsic is lxvd2x
>>> (a VSX instruction). Technically I think this instruction was available
>>> in the Power ISA as early as 2.06, but GCC is only advertising the
>>> intrinsic as of ISA 3.0 (Power 9+).
>>> https://gcc.gnu.org/onlinedocs/gcc-8.3.0/gcc/PowerPC-Built-in-Functions.html#PowerPC-Built-in-Functions
>>>
>>>
>>> I've always had issues reading the logic behind GCC's instruction
>>> generation and I don't have 8+ handy... I'm not sure if there's a guard
>>> to prevent the lxvd2x instruction from being emitted or not when
>>> resolving vec_xl_be and, say, '-maltivec -mpcu=7450' is specified. If
>>> there isn't, I'd expect either an illegal instruction exception or for
>>> the kernel to emulate it magically. If there is, I'd expect GCC to
>>> either compile a compatible instruction shim or to simply error out.
>>>
>>> Regardless, given the way the hardware acceleration is written currently
>>> to require that compiler intrinsic, USE_PPC_CRYPTO may need to be
>>> guarded by __builtin_cpu_supports("arch_3_00")
>>
>> They are all good suggestions but I think they are more NSS related
>> than Buildroot related. What I'm trying to do here is to avoid build
>> failure in Buildroot and as much as possible to try to contribute
>> upstream. As you've mentioned above 32-bit supports Altivec, but the
>> problem at the moment is that USE_PPC_CRYPTO is defined in gcm.h only
>> if __powerpc64__ is defined, this means that they only tested it for
>> that architecture(ppc64 and ppc64le). So at the moment I'd prefer keep
>> 32-bit Altivec supported devices without gcm altivec acceleration. But
>> if you have a patch that takes into account 32-bits Altivec too,
>> please upload it here:
>>
> For Buildroot, we can likely key off
> ifneq($(BR2_POWERPC_CPU_HAS_ALTIVEC),y)
Yes, this is a good idea.
> and sed delete the '-mcrypto
> -maltivec' flags from lib/freebl/Makefile...
It's better to avoid this kind of blind hack. I'd prefer to introduce a
patch in NSS which adds a NSS_ALTIVEC_DISABLE to avoid building
gcm-ppc.c. So combined with your suggestion above we can do something like:
ifeq($(BR2_POWERPC_CPU_HAS_ALTIVEC),)
NSS_ALTIVEC_DISABLE=1
endif
The -mcrypto enables -mvsx
> and causes gcc to emit instructions the target CPU may not support,
> that's why it should be removed. Luckily, we can make some assumptions
> that if ALTIVEC isn't supported, VSX and Crypto functions arent either
> since they're introduced in the same or later ISA revisions.
So let's assume this.
>> https://bugzilla.mozilla.org/show_bug.cgi?id=1606689
>>
>> so we fix this problem once!
> I'm not sure this can be done "cleanly" given how this is currently
> structured. I've added a comment in the bug. Not all 64bit PPC
> processors have Altivec (e5500 does not).
Yes, I see now.
> Plus this goes a bit beyond
> that since the functions they're using require at least Power ISA 3.0.
> The source package should probably inherit CFLAGS instead of assuming it
> can define it given the complexities of PPC cpu tuning.
From NSS point of view this would be fixed by introducing
NSS_ALTIVEC_DISABLE, but from Buildroot point of view this should be
done by adding a new variable like BR2_POWERPC_AT_LEAST_ISA_X_X
But I don't know if it's worth the effort.
What about above?
--
Giulio Benetti
Benetti Engineering sas
>>
>> Maybe we can live chat on BR IRC if you join it.
> I'm idling there today
>>
>>
>> Thanks for reviewing so in depth.
>> Best regards
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH] package/libnss: fix ppc 32-bit build failure
2020-01-02 18:17 [Buildroot] [PATCH] package/libnss: fix ppc 32-bit build failure Giulio Benetti
2020-01-02 20:54 ` Vincent Fazio
@ 2020-01-14 18:49 ` Giulio Benetti
1 sibling, 0 replies; 11+ messages in thread
From: Giulio Benetti @ 2020-01-14 18:49 UTC (permalink / raw)
To: buildroot
This patch is wrong. I reject it and going to send another one both
upstream and to Buildroot ML.
--
Giulio Benetti
Benetti Engineering sas
On 1/2/20 7:17 PM, Giulio Benetti wrote:
> NSS assumes that Altivec is supported on powerpc64 only, but in
> Makefile it tries to build gcm-ppc.c(containing Altivec functions
> calls), even if powerpc is not 64-bits. So add a patch to add a check if
> architecture is a 64-bit to build gcm-ppc.
>
> Fixes:
> http://autobuild.buildroot.net/results/433/433a7db21654d67626c7a3e5f1272d6c3ce4fe6c/
>
> Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
> ---
> Pending upstream:
> https://bugzilla.mozilla.org/show_bug.cgi?id=1606689
> ---
> ...1606689-Fix-ppc-32-bit-build-failure.patch | 31 +++++++++++++++++++
> 1 file changed, 31 insertions(+)
> create mode 100644 package/libnss/0006-Bug-1606689-Fix-ppc-32-bit-build-failure.patch
>
> diff --git a/package/libnss/0006-Bug-1606689-Fix-ppc-32-bit-build-failure.patch b/package/libnss/0006-Bug-1606689-Fix-ppc-32-bit-build-failure.patch
> new file mode 100644
> index 0000000000..de30fa7002
> --- /dev/null
> +++ b/package/libnss/0006-Bug-1606689-Fix-ppc-32-bit-build-failure.patch
> @@ -0,0 +1,31 @@
> +From fcac43d6a0af59926da7ad4a15a37255887cdfa2 Mon Sep 17 00:00:00 2001
> +From: Giulio Benetti <giulio.benetti@benettiengineering.com>
> +Date: Thu, 2 Jan 2020 18:55:50 +0100
> +Subject: [PATCH] Bug 1606689 - Fix ppc 32-bit build failure
> +
> +NSS assumes that only 64-bit powerpc support Altivec instructions to be
> +used in gcm-ppc.c, so align Makefile condition to build gcm-ppc.c only
> +if USE_64 is defined.
> +
> +Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
> +---
> + nss/lib/freebl/Makefile | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/nss/lib/freebl/Makefile b/nss/lib/freebl/Makefile
> +index 00518d7f8..0e230d8c5 100644
> +--- a/nss/lib/freebl/Makefile
> ++++ b/nss/lib/freebl/Makefile
> +@@ -264,8 +264,8 @@ ifeq ($(CPU_ARCH),arm)
> + MPI_SRCS += mpi_arm.c
> + endif
> + ifeq ($(CPU_ARCH),ppc)
> +- EXTRA_SRCS += gcm-ppc.c
> + ifdef USE_64
> ++ EXTRA_SRCS += gcm-ppc.c
> + DEFINES += -DNSS_NO_INIT_SUPPORT
> + endif # USE_64
> + endif # ppc
> +--
> +2.20.1
> +
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH] package/libnss: fix powerpc altivec build failure
2020-01-03 17:24 ` Giulio Benetti
@ 2020-01-14 20:46 ` Giulio Benetti
2020-01-14 20:58 ` Giulio Benetti
0 siblings, 1 reply; 11+ messages in thread
From: Giulio Benetti @ 2020-01-14 20:46 UTC (permalink / raw)
To: buildroot
NSS doesn't provide a way to understand if PowerPC compiler supports
Altivec, and it would also be difficult to do with a simple Makefile.
So add patch to disable Altivec extension with variable
NSS_DISABLE_ALTIVEC, then pass NSS_DISABLE_ALTIVEC=1 if
BR2_POWERPC_CPU_HAS_ALTIVEC is not 'y'.
Fixes:
http://autobuild.buildroot.net/results/957/957cec911bcd68a18418ad02f13e7e3001521c59/
http://autobuild.buildroot.net/results/6a1/6a1578619a477e1605fe152070f004b662f1d839/
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
Pending upstream:
https://bugzilla.mozilla.org/show_bug.cgi?id=1608151
---
...1608151-Introduce-NSS_ENABLE_ALTIVEC.patch | 95 +++++++++++++++++++
package/libnss/libnss.mk | 5 +
2 files changed, 100 insertions(+)
create mode 100644 package/libnss/0002-Bug-1608151-Introduce-NSS_ENABLE_ALTIVEC.patch
diff --git a/package/libnss/0002-Bug-1608151-Introduce-NSS_ENABLE_ALTIVEC.patch b/package/libnss/0002-Bug-1608151-Introduce-NSS_ENABLE_ALTIVEC.patch
new file mode 100644
index 0000000000..e492a63d6e
--- /dev/null
+++ b/package/libnss/0002-Bug-1608151-Introduce-NSS_ENABLE_ALTIVEC.patch
@@ -0,0 +1,95 @@
+From 7ce53f890e26630d2d9677ab579281b3708c2605 Mon Sep 17 00:00:00 2001
+From: Giulio Benetti <giulio.benetti@benettiengineering.com>
+Date: Tue, 14 Jan 2020 18:55:53 +0100
+Subject: [PATCH] Bug 1608151 - Introduce NSS_ENABLE_ALTIVEC
+
+Add NSS_ENABLE_ALTIVEC environment variable to enable/disable Altivec
+extension on PowerPC build. At the time NSS assumes that every PowerPC64
+architecture supports Altivec but it's not true and this leads to build
+failure.
+
+Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
+---
+ nss/coreconf/config.gypi | 1 +
+ nss/coreconf/config.mk | 5 +++++
+ nss/lib/freebl/Makefile | 2 ++
+ nss/lib/freebl/freebl.gyp | 2 +-
+ nss/lib/freebl/gcm.h | 2 ++
+ 5 files changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/nss/coreconf/config.gypi b/nss/coreconf/config.gypi
+index 2e6cc390e..fc113a6fc 100644
+--- a/nss/coreconf/config.gypi
++++ b/nss/coreconf/config.gypi
+@@ -102,6 +102,7 @@
+ 'disable_dbm%': 1,
+ 'disable_libpkix%': 1,
+ 'disable_werror%': 0,
++ 'disable_altivec': 1,
+ 'mozilla_client%': 0,
+ 'comm_client%': 0,
+ 'moz_fold_libs%': 0,
+diff --git a/nss/coreconf/config.mk b/nss/coreconf/config.mk
+index 60a08411e..704e3fa83 100644
+--- a/nss/coreconf/config.mk
++++ b/nss/coreconf/config.mk
+@@ -196,6 +196,11 @@ DEFINES += -DPKIX_OBJECT_LEAK_TEST
+ endif
+ endif
+
++# Avoid building with PowerPC's Altivec acceleration
++ifdef NSS_DISABLE_ALTIVEC
++DEFINES += -DNSS_DISABLE_ALTIVEC
++endif
++
+ # This allows all library and tools code to use the util function
+ # implementations directly from libnssutil3, rather than the wrappers
+ # in libnss3 which are present for binary compatibility only
+diff --git a/nss/lib/freebl/Makefile b/nss/lib/freebl/Makefile
+index 00518d7f8..fc3e2099e 100644
+--- a/nss/lib/freebl/Makefile
++++ b/nss/lib/freebl/Makefile
+@@ -790,5 +790,7 @@ $(OBJDIR)/$(PROG_PREFIX)gcm-aarch64$(OBJ_SUFFIX): CFLAGS += -march=armv8-a+crypt
+ endif
+
+ ifeq ($(CPU_ARCH),ppc)
++ifndef NSS_DISABLE_ALTIVEC
+ $(OBJDIR)/$(PROG_PREFIX)gcm-ppc$(OBJ_SUFFIX): CFLAGS += -mcrypto -maltivec
+ endif
++endif
+diff --git a/nss/lib/freebl/freebl.gyp b/nss/lib/freebl/freebl.gyp
+index 5d247742d..f968c408a 100644
+--- a/nss/lib/freebl/freebl.gyp
++++ b/nss/lib/freebl/freebl.gyp
+@@ -238,7 +238,7 @@
+ 'gcm-aes-aarch64_c_lib',
+ ],
+ }],
+- [ 'target_arch=="ppc64le"', {
++ [ 'disable_altivec==0 and (target_arch=="ppc" or target_arch=="ppc64" or target_arch=="ppc64le")', {
+ 'dependencies': [
+ 'gcm-aes-ppc_c_lib',
+ ],
+diff --git a/nss/lib/freebl/gcm.h b/nss/lib/freebl/gcm.h
+index aa4dee824..64aac56b2 100644
+--- a/nss/lib/freebl/gcm.h
++++ b/nss/lib/freebl/gcm.h
+@@ -30,6 +30,7 @@
+ #include <arm_neon.h>
+ #endif
+
++#ifndef NSS_DISABLE_ALTIVEC
+ #ifdef __powerpc64__
+ #include "altivec-types.h"
+
+@@ -39,6 +40,7 @@
+ #undef vector
+ #undef bool
+ #endif
++#endif
+
+ /*
+ * PPC CRYPTO requires at least gcc 8 or clang. The LE check is purely
+--
+2.20.1
+
diff --git a/package/libnss/libnss.mk b/package/libnss/libnss.mk
index d7d3cda86b..b9dab44c11 100644
--- a/package/libnss/libnss.mk
+++ b/package/libnss/libnss.mk
@@ -50,6 +50,11 @@ LIBNSS_BUILD_VARS = \
OS_TEST=$(BR2_PACKAGE_LIBNSS_ARCH) \
NSS_ENABLE_WERROR=0
+ifeq ($(BR2_POWERPC_CPU_HAS_ALTIVEC),)
+# Disable Altivec if not supported
+LIBNSS_BUILD_VARS += NSS_DISABLE_ALTIVEC=1
+endif
+
ifeq ($(BR2_ARCH_IS_64),y)
# MIPS64 n32 is treated as a 32-bit architecture by libnss.
# See: https://bugzilla.mozilla.org/show_bug.cgi?id=1010730
--
2.20.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH] package/libnss: fix powerpc altivec build failure
2020-01-14 20:46 ` [Buildroot] [PATCH] package/libnss: fix powerpc altivec " Giulio Benetti
@ 2020-01-14 20:58 ` Giulio Benetti
2020-01-14 21:01 ` [Buildroot] [PATCH v2] " Giulio Benetti
0 siblings, 1 reply; 11+ messages in thread
From: Giulio Benetti @ 2020-01-14 20:58 UTC (permalink / raw)
To: buildroot
Patch must be called: NSS_DISABLE_ALTIVEC, not ENABLE. Going to re-send
corrected.
Sorry for the noise.
Best regards
--
Giulio Benetti
Benetti Engineering sas
On 1/14/20 9:46 PM, Giulio Benetti wrote:
> NSS doesn't provide a way to understand if PowerPC compiler supports
> Altivec, and it would also be difficult to do with a simple Makefile.
> So add patch to disable Altivec extension with variable
> NSS_DISABLE_ALTIVEC, then pass NSS_DISABLE_ALTIVEC=1 if
> BR2_POWERPC_CPU_HAS_ALTIVEC is not 'y'.
>
> Fixes:
> http://autobuild.buildroot.net/results/957/957cec911bcd68a18418ad02f13e7e3001521c59/
> http://autobuild.buildroot.net/results/6a1/6a1578619a477e1605fe152070f004b662f1d839/
>
> Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
> ---
> Pending upstream:
> https://bugzilla.mozilla.org/show_bug.cgi?id=1608151
> ---
> ...1608151-Introduce-NSS_ENABLE_ALTIVEC.patch | 95 +++++++++++++++++++
> package/libnss/libnss.mk | 5 +
> 2 files changed, 100 insertions(+)
> create mode 100644 package/libnss/0002-Bug-1608151-Introduce-NSS_ENABLE_ALTIVEC.patch
>
> diff --git a/package/libnss/0002-Bug-1608151-Introduce-NSS_ENABLE_ALTIVEC.patch b/package/libnss/0002-Bug-1608151-Introduce-NSS_ENABLE_ALTIVEC.patch
> new file mode 100644
> index 0000000000..e492a63d6e
> --- /dev/null
> +++ b/package/libnss/0002-Bug-1608151-Introduce-NSS_ENABLE_ALTIVEC.patch
> @@ -0,0 +1,95 @@
> +From 7ce53f890e26630d2d9677ab579281b3708c2605 Mon Sep 17 00:00:00 2001
> +From: Giulio Benetti <giulio.benetti@benettiengineering.com>
> +Date: Tue, 14 Jan 2020 18:55:53 +0100
> +Subject: [PATCH] Bug 1608151 - Introduce NSS_ENABLE_ALTIVEC
> +
> +Add NSS_ENABLE_ALTIVEC environment variable to enable/disable Altivec
> +extension on PowerPC build. At the time NSS assumes that every PowerPC64
> +architecture supports Altivec but it's not true and this leads to build
> +failure.
> +
> +Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
> +---
> + nss/coreconf/config.gypi | 1 +
> + nss/coreconf/config.mk | 5 +++++
> + nss/lib/freebl/Makefile | 2 ++
> + nss/lib/freebl/freebl.gyp | 2 +-
> + nss/lib/freebl/gcm.h | 2 ++
> + 5 files changed, 11 insertions(+), 1 deletion(-)
> +
> +diff --git a/nss/coreconf/config.gypi b/nss/coreconf/config.gypi
> +index 2e6cc390e..fc113a6fc 100644
> +--- a/nss/coreconf/config.gypi
> ++++ b/nss/coreconf/config.gypi
> +@@ -102,6 +102,7 @@
> + 'disable_dbm%': 1,
> + 'disable_libpkix%': 1,
> + 'disable_werror%': 0,
> ++ 'disable_altivec': 1,
> + 'mozilla_client%': 0,
> + 'comm_client%': 0,
> + 'moz_fold_libs%': 0,
> +diff --git a/nss/coreconf/config.mk b/nss/coreconf/config.mk
> +index 60a08411e..704e3fa83 100644
> +--- a/nss/coreconf/config.mk
> ++++ b/nss/coreconf/config.mk
> +@@ -196,6 +196,11 @@ DEFINES += -DPKIX_OBJECT_LEAK_TEST
> + endif
> + endif
> +
> ++# Avoid building with PowerPC's Altivec acceleration
> ++ifdef NSS_DISABLE_ALTIVEC
> ++DEFINES += -DNSS_DISABLE_ALTIVEC
> ++endif
> ++
> + # This allows all library and tools code to use the util function
> + # implementations directly from libnssutil3, rather than the wrappers
> + # in libnss3 which are present for binary compatibility only
> +diff --git a/nss/lib/freebl/Makefile b/nss/lib/freebl/Makefile
> +index 00518d7f8..fc3e2099e 100644
> +--- a/nss/lib/freebl/Makefile
> ++++ b/nss/lib/freebl/Makefile
> +@@ -790,5 +790,7 @@ $(OBJDIR)/$(PROG_PREFIX)gcm-aarch64$(OBJ_SUFFIX): CFLAGS += -march=armv8-a+crypt
> + endif
> +
> + ifeq ($(CPU_ARCH),ppc)
> ++ifndef NSS_DISABLE_ALTIVEC
> + $(OBJDIR)/$(PROG_PREFIX)gcm-ppc$(OBJ_SUFFIX): CFLAGS += -mcrypto -maltivec
> + endif
> ++endif
> +diff --git a/nss/lib/freebl/freebl.gyp b/nss/lib/freebl/freebl.gyp
> +index 5d247742d..f968c408a 100644
> +--- a/nss/lib/freebl/freebl.gyp
> ++++ b/nss/lib/freebl/freebl.gyp
> +@@ -238,7 +238,7 @@
> + 'gcm-aes-aarch64_c_lib',
> + ],
> + }],
> +- [ 'target_arch=="ppc64le"', {
> ++ [ 'disable_altivec==0 and (target_arch=="ppc" or target_arch=="ppc64" or target_arch=="ppc64le")', {
> + 'dependencies': [
> + 'gcm-aes-ppc_c_lib',
> + ],
> +diff --git a/nss/lib/freebl/gcm.h b/nss/lib/freebl/gcm.h
> +index aa4dee824..64aac56b2 100644
> +--- a/nss/lib/freebl/gcm.h
> ++++ b/nss/lib/freebl/gcm.h
> +@@ -30,6 +30,7 @@
> + #include <arm_neon.h>
> + #endif
> +
> ++#ifndef NSS_DISABLE_ALTIVEC
> + #ifdef __powerpc64__
> + #include "altivec-types.h"
> +
> +@@ -39,6 +40,7 @@
> + #undef vector
> + #undef bool
> + #endif
> ++#endif
> +
> + /*
> + * PPC CRYPTO requires at least gcc 8 or clang. The LE check is purely
> +--
> +2.20.1
> +
> diff --git a/package/libnss/libnss.mk b/package/libnss/libnss.mk
> index d7d3cda86b..b9dab44c11 100644
> --- a/package/libnss/libnss.mk
> +++ b/package/libnss/libnss.mk
> @@ -50,6 +50,11 @@ LIBNSS_BUILD_VARS = \
> OS_TEST=$(BR2_PACKAGE_LIBNSS_ARCH) \
> NSS_ENABLE_WERROR=0
>
> +ifeq ($(BR2_POWERPC_CPU_HAS_ALTIVEC),)
> +# Disable Altivec if not supported
> +LIBNSS_BUILD_VARS += NSS_DISABLE_ALTIVEC=1
> +endif
> +
> ifeq ($(BR2_ARCH_IS_64),y)
> # MIPS64 n32 is treated as a 32-bit architecture by libnss.
> # See: https://bugzilla.mozilla.org/show_bug.cgi?id=1010730
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH v2] package/libnss: fix powerpc altivec build failure
2020-01-14 20:58 ` Giulio Benetti
@ 2020-01-14 21:01 ` Giulio Benetti
2020-01-14 21:03 ` Giulio Benetti
0 siblings, 1 reply; 11+ messages in thread
From: Giulio Benetti @ 2020-01-14 21:01 UTC (permalink / raw)
To: buildroot
NSS doesn't provide a way to understand if PowerPC compiler supports
Altivec, and it would also be difficult to do with a simple Makefile.
So add patch to disable Altivec extension with variable
NSS_DISABLE_ALTIVEC, then pass NSS_DISABLE_ALTIVEC=1 if
BR2_POWERPC_CPU_HAS_ALTIVEC is not 'y'.
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
V1 -> V2:
* changed patch name and commit log with DISABLE instead of ENABLE
---
...608151-Introduce-NSS_DISABLE_ALTIVEC.patch | 95 +++++++++++++++++++
package/libnss/libnss.mk | 5 +
2 files changed, 100 insertions(+)
create mode 100644 package/libnss/0002-Bug-1608151-Introduce-NSS_DISABLE_ALTIVEC.patch
diff --git a/package/libnss/0002-Bug-1608151-Introduce-NSS_DISABLE_ALTIVEC.patch b/package/libnss/0002-Bug-1608151-Introduce-NSS_DISABLE_ALTIVEC.patch
new file mode 100644
index 0000000000..0931f4b961
--- /dev/null
+++ b/package/libnss/0002-Bug-1608151-Introduce-NSS_DISABLE_ALTIVEC.patch
@@ -0,0 +1,95 @@
+From 7ce53f890e26630d2d9677ab579281b3708c2605 Mon Sep 17 00:00:00 2001
+From: Giulio Benetti <giulio.benetti@benettiengineering.com>
+Date: Tue, 14 Jan 2020 18:55:53 +0100
+Subject: [PATCH] Bug 1608151 - Introduce NSS_DISABLE_ALTIVEC
+
+Add NSS_DISABLE_ALTIVEC environment variable to disable Altivec
+extension on PowerPC build. At the time NSS assumes that every PowerPC64
+architecture supports Altivec but it's not true and this leads to build
+failure.
+
+Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
+---
+ nss/coreconf/config.gypi | 1 +
+ nss/coreconf/config.mk | 5 +++++
+ nss/lib/freebl/Makefile | 2 ++
+ nss/lib/freebl/freebl.gyp | 2 +-
+ nss/lib/freebl/gcm.h | 2 ++
+ 5 files changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/nss/coreconf/config.gypi b/nss/coreconf/config.gypi
+index 2e6cc390e..fc113a6fc 100644
+--- a/nss/coreconf/config.gypi
++++ b/nss/coreconf/config.gypi
+@@ -102,6 +102,7 @@
+ 'disable_dbm%': 1,
+ 'disable_libpkix%': 1,
+ 'disable_werror%': 0,
++ 'disable_altivec': 1,
+ 'mozilla_client%': 0,
+ 'comm_client%': 0,
+ 'moz_fold_libs%': 0,
+diff --git a/nss/coreconf/config.mk b/nss/coreconf/config.mk
+index 60a08411e..704e3fa83 100644
+--- a/nss/coreconf/config.mk
++++ b/nss/coreconf/config.mk
+@@ -196,6 +196,11 @@ DEFINES += -DPKIX_OBJECT_LEAK_TEST
+ endif
+ endif
+
++# Avoid building with PowerPC's Altivec acceleration
++ifdef NSS_DISABLE_ALTIVEC
++DEFINES += -DNSS_DISABLE_ALTIVEC
++endif
++
+ # This allows all library and tools code to use the util function
+ # implementations directly from libnssutil3, rather than the wrappers
+ # in libnss3 which are present for binary compatibility only
+diff --git a/nss/lib/freebl/Makefile b/nss/lib/freebl/Makefile
+index 00518d7f8..fc3e2099e 100644
+--- a/nss/lib/freebl/Makefile
++++ b/nss/lib/freebl/Makefile
+@@ -790,5 +790,7 @@ $(OBJDIR)/$(PROG_PREFIX)gcm-aarch64$(OBJ_SUFFIX): CFLAGS += -march=armv8-a+crypt
+ endif
+
+ ifeq ($(CPU_ARCH),ppc)
++ifndef NSS_DISABLE_ALTIVEC
+ $(OBJDIR)/$(PROG_PREFIX)gcm-ppc$(OBJ_SUFFIX): CFLAGS += -mcrypto -maltivec
+ endif
++endif
+diff --git a/nss/lib/freebl/freebl.gyp b/nss/lib/freebl/freebl.gyp
+index 5d247742d..f968c408a 100644
+--- a/nss/lib/freebl/freebl.gyp
++++ b/nss/lib/freebl/freebl.gyp
+@@ -238,7 +238,7 @@
+ 'gcm-aes-aarch64_c_lib',
+ ],
+ }],
+- [ 'target_arch=="ppc64le"', {
++ [ 'disable_altivec==0 and (target_arch=="ppc" or target_arch=="ppc64" or target_arch=="ppc64le")', {
+ 'dependencies': [
+ 'gcm-aes-ppc_c_lib',
+ ],
+diff --git a/nss/lib/freebl/gcm.h b/nss/lib/freebl/gcm.h
+index aa4dee824..64aac56b2 100644
+--- a/nss/lib/freebl/gcm.h
++++ b/nss/lib/freebl/gcm.h
+@@ -30,6 +30,7 @@
+ #include <arm_neon.h>
+ #endif
+
++#ifndef NSS_DISABLE_ALTIVEC
+ #ifdef __powerpc64__
+ #include "altivec-types.h"
+
+@@ -39,6 +40,7 @@
+ #undef vector
+ #undef bool
+ #endif
++#endif
+
+ /*
+ * PPC CRYPTO requires at least gcc 8 or clang. The LE check is purely
+--
+2.20.1
+
diff --git a/package/libnss/libnss.mk b/package/libnss/libnss.mk
index d7d3cda86b..b9dab44c11 100644
--- a/package/libnss/libnss.mk
+++ b/package/libnss/libnss.mk
@@ -50,6 +50,11 @@ LIBNSS_BUILD_VARS = \
OS_TEST=$(BR2_PACKAGE_LIBNSS_ARCH) \
NSS_ENABLE_WERROR=0
+ifeq ($(BR2_POWERPC_CPU_HAS_ALTIVEC),)
+# Disable Altivec if not supported
+LIBNSS_BUILD_VARS += NSS_DISABLE_ALTIVEC=1
+endif
+
ifeq ($(BR2_ARCH_IS_64),y)
# MIPS64 n32 is treated as a 32-bit architecture by libnss.
# See: https://bugzilla.mozilla.org/show_bug.cgi?id=1010730
--
2.20.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH v2] package/libnss: fix powerpc altivec build failure
2020-01-14 21:01 ` [Buildroot] [PATCH v2] " Giulio Benetti
@ 2020-01-14 21:03 ` Giulio Benetti
2020-02-03 12:16 ` Giulio Benetti
0 siblings, 1 reply; 11+ messages in thread
From: Giulio Benetti @ 2020-01-14 21:03 UTC (permalink / raw)
To: buildroot
On 1/14/20 10:01 PM, Giulio Benetti wrote:
> NSS doesn't provide a way to understand if PowerPC compiler supports
> Altivec, and it would also be difficult to do with a simple Makefile.
> So add patch to disable Altivec extension with variable
> NSS_DISABLE_ALTIVEC, then pass NSS_DISABLE_ALTIVEC=1 if
> BR2_POWERPC_CPU_HAS_ALTIVEC is not 'y'.
Fixes:
http://autobuild.buildroot.net/results/957/957cec911bcd68a18418ad02f13e7e3001521c59/
http://autobuild.buildroot.net/results/6a1/6a1578619a477e1605fe152070f004b662f1d839/
> Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
> ---
> V1 -> V2:
> * changed patch name and commit log with DISABLE instead of ENABLE
> ---
> ...608151-Introduce-NSS_DISABLE_ALTIVEC.patch | 95 +++++++++++++++++++
> package/libnss/libnss.mk | 5 +
> 2 files changed, 100 insertions(+)
> create mode 100644 package/libnss/0002-Bug-1608151-Introduce-NSS_DISABLE_ALTIVEC.patch
>
> diff --git a/package/libnss/0002-Bug-1608151-Introduce-NSS_DISABLE_ALTIVEC.patch b/package/libnss/0002-Bug-1608151-Introduce-NSS_DISABLE_ALTIVEC.patch
> new file mode 100644
> index 0000000000..0931f4b961
> --- /dev/null
> +++ b/package/libnss/0002-Bug-1608151-Introduce-NSS_DISABLE_ALTIVEC.patch
> @@ -0,0 +1,95 @@
> +From 7ce53f890e26630d2d9677ab579281b3708c2605 Mon Sep 17 00:00:00 2001
> +From: Giulio Benetti <giulio.benetti@benettiengineering.com>
> +Date: Tue, 14 Jan 2020 18:55:53 +0100
> +Subject: [PATCH] Bug 1608151 - Introduce NSS_DISABLE_ALTIVEC
> +
> +Add NSS_DISABLE_ALTIVEC environment variable to disable Altivec
> +extension on PowerPC build. At the time NSS assumes that every PowerPC64
> +architecture supports Altivec but it's not true and this leads to build
> +failure.
> +
> +Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
> +---
> + nss/coreconf/config.gypi | 1 +
> + nss/coreconf/config.mk | 5 +++++
> + nss/lib/freebl/Makefile | 2 ++
> + nss/lib/freebl/freebl.gyp | 2 +-
> + nss/lib/freebl/gcm.h | 2 ++
> + 5 files changed, 11 insertions(+), 1 deletion(-)
> +
> +diff --git a/nss/coreconf/config.gypi b/nss/coreconf/config.gypi
> +index 2e6cc390e..fc113a6fc 100644
> +--- a/nss/coreconf/config.gypi
> ++++ b/nss/coreconf/config.gypi
> +@@ -102,6 +102,7 @@
> + 'disable_dbm%': 1,
> + 'disable_libpkix%': 1,
> + 'disable_werror%': 0,
> ++ 'disable_altivec': 1,
> + 'mozilla_client%': 0,
> + 'comm_client%': 0,
> + 'moz_fold_libs%': 0,
> +diff --git a/nss/coreconf/config.mk b/nss/coreconf/config.mk
> +index 60a08411e..704e3fa83 100644
> +--- a/nss/coreconf/config.mk
> ++++ b/nss/coreconf/config.mk
> +@@ -196,6 +196,11 @@ DEFINES += -DPKIX_OBJECT_LEAK_TEST
> + endif
> + endif
> +
> ++# Avoid building with PowerPC's Altivec acceleration
> ++ifdef NSS_DISABLE_ALTIVEC
> ++DEFINES += -DNSS_DISABLE_ALTIVEC
> ++endif
> ++
> + # This allows all library and tools code to use the util function
> + # implementations directly from libnssutil3, rather than the wrappers
> + # in libnss3 which are present for binary compatibility only
> +diff --git a/nss/lib/freebl/Makefile b/nss/lib/freebl/Makefile
> +index 00518d7f8..fc3e2099e 100644
> +--- a/nss/lib/freebl/Makefile
> ++++ b/nss/lib/freebl/Makefile
> +@@ -790,5 +790,7 @@ $(OBJDIR)/$(PROG_PREFIX)gcm-aarch64$(OBJ_SUFFIX): CFLAGS += -march=armv8-a+crypt
> + endif
> +
> + ifeq ($(CPU_ARCH),ppc)
> ++ifndef NSS_DISABLE_ALTIVEC
> + $(OBJDIR)/$(PROG_PREFIX)gcm-ppc$(OBJ_SUFFIX): CFLAGS += -mcrypto -maltivec
> + endif
> ++endif
> +diff --git a/nss/lib/freebl/freebl.gyp b/nss/lib/freebl/freebl.gyp
> +index 5d247742d..f968c408a 100644
> +--- a/nss/lib/freebl/freebl.gyp
> ++++ b/nss/lib/freebl/freebl.gyp
> +@@ -238,7 +238,7 @@
> + 'gcm-aes-aarch64_c_lib',
> + ],
> + }],
> +- [ 'target_arch=="ppc64le"', {
> ++ [ 'disable_altivec==0 and (target_arch=="ppc" or target_arch=="ppc64" or target_arch=="ppc64le")', {
> + 'dependencies': [
> + 'gcm-aes-ppc_c_lib',
> + ],
> +diff --git a/nss/lib/freebl/gcm.h b/nss/lib/freebl/gcm.h
> +index aa4dee824..64aac56b2 100644
> +--- a/nss/lib/freebl/gcm.h
> ++++ b/nss/lib/freebl/gcm.h
> +@@ -30,6 +30,7 @@
> + #include <arm_neon.h>
> + #endif
> +
> ++#ifndef NSS_DISABLE_ALTIVEC
> + #ifdef __powerpc64__
> + #include "altivec-types.h"
> +
> +@@ -39,6 +40,7 @@
> + #undef vector
> + #undef bool
> + #endif
> ++#endif
> +
> + /*
> + * PPC CRYPTO requires at least gcc 8 or clang. The LE check is purely
> +--
> +2.20.1
> +
> diff --git a/package/libnss/libnss.mk b/package/libnss/libnss.mk
> index d7d3cda86b..b9dab44c11 100644
> --- a/package/libnss/libnss.mk
> +++ b/package/libnss/libnss.mk
> @@ -50,6 +50,11 @@ LIBNSS_BUILD_VARS = \
> OS_TEST=$(BR2_PACKAGE_LIBNSS_ARCH) \
> NSS_ENABLE_WERROR=0
>
> +ifeq ($(BR2_POWERPC_CPU_HAS_ALTIVEC),)
> +# Disable Altivec if not supported
> +LIBNSS_BUILD_VARS += NSS_DISABLE_ALTIVEC=1
> +endif
> +
> ifeq ($(BR2_ARCH_IS_64),y)
> # MIPS64 n32 is treated as a 32-bit architecture by libnss.
> # See: https://bugzilla.mozilla.org/show_bug.cgi?id=1010730
>
--
Giulio Benetti
Benetti Engineering sas
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH v2] package/libnss: fix powerpc altivec build failure
2020-01-14 21:03 ` Giulio Benetti
@ 2020-02-03 12:16 ` Giulio Benetti
0 siblings, 0 replies; 11+ messages in thread
From: Giulio Benetti @ 2020-02-03 12:16 UTC (permalink / raw)
To: buildroot
Hi All,
The patch contained in this patch has been upstreamed:
https://hg.mozilla.org/projects/nss/rev/f2d9478178505d24da34f2e694bdd05e0e6395c6
Kind regards
--
Giulio Benetti
Benetti Engineering sas
On 1/14/20 10:03 PM, Giulio Benetti wrote:
> On 1/14/20 10:01 PM, Giulio Benetti wrote:
>> NSS doesn't provide a way to understand if PowerPC compiler supports
>> Altivec, and it would also be difficult to do with a simple Makefile.
>> So add patch to disable Altivec extension with variable
>> NSS_DISABLE_ALTIVEC, then pass NSS_DISABLE_ALTIVEC=1 if
>> BR2_POWERPC_CPU_HAS_ALTIVEC is not 'y'.
>
> Fixes:
> http://autobuild.buildroot.net/results/957/957cec911bcd68a18418ad02f13e7e3001521c59/
> http://autobuild.buildroot.net/results/6a1/6a1578619a477e1605fe152070f004b662f1d839/
>
>> Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
>> ---
>> V1 -> V2:
>> * changed patch name and commit log with DISABLE instead of ENABLE
>> ---
>> ...608151-Introduce-NSS_DISABLE_ALTIVEC.patch | 95 +++++++++++++++++++
>> package/libnss/libnss.mk | 5 +
>> 2 files changed, 100 insertions(+)
>> create mode 100644 package/libnss/0002-Bug-1608151-Introduce-NSS_DISABLE_ALTIVEC.patch
>>
>> diff --git a/package/libnss/0002-Bug-1608151-Introduce-NSS_DISABLE_ALTIVEC.patch b/package/libnss/0002-Bug-1608151-Introduce-NSS_DISABLE_ALTIVEC.patch
>> new file mode 100644
>> index 0000000000..0931f4b961
>> --- /dev/null
>> +++ b/package/libnss/0002-Bug-1608151-Introduce-NSS_DISABLE_ALTIVEC.patch
>> @@ -0,0 +1,95 @@
>> +From 7ce53f890e26630d2d9677ab579281b3708c2605 Mon Sep 17 00:00:00 2001
>> +From: Giulio Benetti <giulio.benetti@benettiengineering.com>
>> +Date: Tue, 14 Jan 2020 18:55:53 +0100
>> +Subject: [PATCH] Bug 1608151 - Introduce NSS_DISABLE_ALTIVEC
>> +
>> +Add NSS_DISABLE_ALTIVEC environment variable to disable Altivec
>> +extension on PowerPC build. At the time NSS assumes that every PowerPC64
>> +architecture supports Altivec but it's not true and this leads to build
>> +failure.
>> +
>> +Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
>> +---
>> + nss/coreconf/config.gypi | 1 +
>> + nss/coreconf/config.mk | 5 +++++
>> + nss/lib/freebl/Makefile | 2 ++
>> + nss/lib/freebl/freebl.gyp | 2 +-
>> + nss/lib/freebl/gcm.h | 2 ++
>> + 5 files changed, 11 insertions(+), 1 deletion(-)
>> +
>> +diff --git a/nss/coreconf/config.gypi b/nss/coreconf/config.gypi
>> +index 2e6cc390e..fc113a6fc 100644
>> +--- a/nss/coreconf/config.gypi
>> ++++ b/nss/coreconf/config.gypi
>> +@@ -102,6 +102,7 @@
>> + 'disable_dbm%': 1,
>> + 'disable_libpkix%': 1,
>> + 'disable_werror%': 0,
>> ++ 'disable_altivec': 1,
>> + 'mozilla_client%': 0,
>> + 'comm_client%': 0,
>> + 'moz_fold_libs%': 0,
>> +diff --git a/nss/coreconf/config.mk b/nss/coreconf/config.mk
>> +index 60a08411e..704e3fa83 100644
>> +--- a/nss/coreconf/config.mk
>> ++++ b/nss/coreconf/config.mk
>> +@@ -196,6 +196,11 @@ DEFINES += -DPKIX_OBJECT_LEAK_TEST
>> + endif
>> + endif
>> +
>> ++# Avoid building with PowerPC's Altivec acceleration
>> ++ifdef NSS_DISABLE_ALTIVEC
>> ++DEFINES += -DNSS_DISABLE_ALTIVEC
>> ++endif
>> ++
>> + # This allows all library and tools code to use the util function
>> + # implementations directly from libnssutil3, rather than the wrappers
>> + # in libnss3 which are present for binary compatibility only
>> +diff --git a/nss/lib/freebl/Makefile b/nss/lib/freebl/Makefile
>> +index 00518d7f8..fc3e2099e 100644
>> +--- a/nss/lib/freebl/Makefile
>> ++++ b/nss/lib/freebl/Makefile
>> +@@ -790,5 +790,7 @@ $(OBJDIR)/$(PROG_PREFIX)gcm-aarch64$(OBJ_SUFFIX): CFLAGS += -march=armv8-a+crypt
>> + endif
>> +
>> + ifeq ($(CPU_ARCH),ppc)
>> ++ifndef NSS_DISABLE_ALTIVEC
>> + $(OBJDIR)/$(PROG_PREFIX)gcm-ppc$(OBJ_SUFFIX): CFLAGS += -mcrypto -maltivec
>> + endif
>> ++endif
>> +diff --git a/nss/lib/freebl/freebl.gyp b/nss/lib/freebl/freebl.gyp
>> +index 5d247742d..f968c408a 100644
>> +--- a/nss/lib/freebl/freebl.gyp
>> ++++ b/nss/lib/freebl/freebl.gyp
>> +@@ -238,7 +238,7 @@
>> + 'gcm-aes-aarch64_c_lib',
>> + ],
>> + }],
>> +- [ 'target_arch=="ppc64le"', {
>> ++ [ 'disable_altivec==0 and (target_arch=="ppc" or target_arch=="ppc64" or target_arch=="ppc64le")', {
>> + 'dependencies': [
>> + 'gcm-aes-ppc_c_lib',
>> + ],
>> +diff --git a/nss/lib/freebl/gcm.h b/nss/lib/freebl/gcm.h
>> +index aa4dee824..64aac56b2 100644
>> +--- a/nss/lib/freebl/gcm.h
>> ++++ b/nss/lib/freebl/gcm.h
>> +@@ -30,6 +30,7 @@
>> + #include <arm_neon.h>
>> + #endif
>> +
>> ++#ifndef NSS_DISABLE_ALTIVEC
>> + #ifdef __powerpc64__
>> + #include "altivec-types.h"
>> +
>> +@@ -39,6 +40,7 @@
>> + #undef vector
>> + #undef bool
>> + #endif
>> ++#endif
>> +
>> + /*
>> + * PPC CRYPTO requires at least gcc 8 or clang. The LE check is purely
>> +--
>> +2.20.1
>> +
>> diff --git a/package/libnss/libnss.mk b/package/libnss/libnss.mk
>> index d7d3cda86b..b9dab44c11 100644
>> --- a/package/libnss/libnss.mk
>> +++ b/package/libnss/libnss.mk
>> @@ -50,6 +50,11 @@ LIBNSS_BUILD_VARS = \
>> OS_TEST=$(BR2_PACKAGE_LIBNSS_ARCH) \
>> NSS_ENABLE_WERROR=0
>>
>> +ifeq ($(BR2_POWERPC_CPU_HAS_ALTIVEC),)
>> +# Disable Altivec if not supported
>> +LIBNSS_BUILD_VARS += NSS_DISABLE_ALTIVEC=1
>> +endif
>> +
>> ifeq ($(BR2_ARCH_IS_64),y)
>> # MIPS64 n32 is treated as a 32-bit architecture by libnss.
>> # See: https://bugzilla.mozilla.org/show_bug.cgi?id=1010730
>>
>
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2020-02-03 12:16 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-02 18:17 [Buildroot] [PATCH] package/libnss: fix ppc 32-bit build failure Giulio Benetti
2020-01-02 20:54 ` Vincent Fazio
2020-01-02 21:41 ` Giulio Benetti
2020-01-03 16:22 ` Vincent Fazio
2020-01-03 17:24 ` Giulio Benetti
2020-01-14 20:46 ` [Buildroot] [PATCH] package/libnss: fix powerpc altivec " Giulio Benetti
2020-01-14 20:58 ` Giulio Benetti
2020-01-14 21:01 ` [Buildroot] [PATCH v2] " Giulio Benetti
2020-01-14 21:03 ` Giulio Benetti
2020-02-03 12:16 ` Giulio Benetti
2020-01-14 18:49 ` [Buildroot] [PATCH] package/libnss: fix ppc 32-bit " 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.