Closed Bug 1590676 Opened 5 years ago Closed 5 years ago

Fix build if arm doesn't support NEON

Categories

(NSS :: Build, defect, P1)

3.47
ARM
Unspecified
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: giulio.benetti, Assigned: giulio.benetti)

References

Details

Attachments

(1 file, 4 obsolete files)

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36

Steps to reproduce:

Here is the build log using Buildroot:
http://autobuild.buildroot.net/results/1342d305d1aeebef7af54a83afc094fda12421e2/build-end.log
on ARM architecture without NEON support.

Actual results:

Not every ARM architecture support NEON extension so need to take care about it.

Attachment #9103470 - Flags: review?(kjacobs.bugzilla)

Sorry but this patch is buggy.
I submit the corrected one.

Attachment #9103470 - Attachment is obsolete: true
Attachment #9103470 - Flags: review?(kjacobs.bugzilla)

Sorry again, previous patch lack a paranthesis.
Now it builds correctly.

Attachment #9104674 - Attachment is obsolete: true
Comment on attachment 9104677 [details] [diff] [review]
v3-0001-Bug-1590676-Fix-build-if-arm-doesn-t-support-NEON.patch

Review of attachment 9104677 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks for the patch. There's one issue here that needs to be resolved before this can land.

::: lib/freebl/rijndael.c
@@ +20,5 @@
>  #include "gcm.h"
>  #include "mpi.h"
>  
> +#if (!defined(IS_LITTLE_ENDIAN) && !defined(NSS_X86_OR_X64)) || \
> +    (!defined(__ARM_NEON) && !defined(__ARM_NEON__))

The new OR condition here will evaluate to true on anything except ARM (NEON). This disables native AES on Linux x86_64, among others.

I'd recommend conditioning it on `defined(__arm__)`. It wouldn't hurt to add its negation to the first line, either.
Attachment #9104677 - Flags: review-

(In reply to Kevin Jacobs [:kjacobs] from comment #5)

Comment on attachment 9104677 [details] [diff] [review]
v3-0001-Bug-1590676-Fix-build-if-arm-doesn-t-support-NEON.patch

Review of attachment 9104677 [details] [diff] [review]:

Thanks for the patch. There's one issue here that needs to be resolved
before this can land.

::: lib/freebl/rijndael.c
@@ +20,5 @@

#include "gcm.h"
#include "mpi.h"

+#if (!defined(IS_LITTLE_ENDIAN) && !defined(NSS_X86_OR_X64)) || \

  • (!defined(__ARM_NEON) && !defined(ARM_NEON))

The new OR condition here will evaluate to true on anything except ARM
(NEON). This disables native AES on Linux x86_64, among others.

Oops that's right.

I'd recommend conditioning it on defined(__arm__).

Ok

It wouldn't hurt to add its negation to the first line, either.

This would (In reply to Kevin Jacobs [:kjacobs] from comment #5)

Comment on attachment 9104677 [details] [diff] [review]
v3-0001-Bug-1590676-Fix-build-if-arm-doesn-t-support-NEON.patch

Review of attachment 9104677 [details] [diff] [review]:

Thanks for the patch. There's one issue here that needs to be resolved
before this can land.

::: lib/freebl/rijndael.c
@@ +20,5 @@

#include "gcm.h"
#include "mpi.h"

+#if (!defined(IS_LITTLE_ENDIAN) && !defined(NSS_X86_OR_X64)) || \

  • (!defined(__ARM_NEON) && !defined(ARM_NEON))

The new OR condition here will evaluate to true on anything except ARM
(NEON). This disables native AES on Linux x86_64, among others.

Oops, you're right.

I'd recommend conditioning it on defined(__arm__). It wouldn't hurt to add
its negation to the first line, either.

Something like this?

#if (!defined(arm) && !defined(IS_LITTLE_ENDIAN) && !defined(NSS_X86_OR_X64)) ||
(defined(arm) && !defined(__ARM_NEON) && !defined(ARM_NEON))

Actually, we need to leave the first line as-is (we rely on it to disable ARM HW AES if big-endian. I was mistaken in thinking that check was done elsewhere).

The second line is exactly what I had in mind, just note it's __arm__.

Here is the patch with correct #ifdef condition.

Best regards

Attachment #9104677 - Attachment is obsolete: true
Assignee: nobody → giulio.benetti
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Priority: -- → P1
Hardware: Unspecified → ARM

Looks good to me. Attaching a clang-formatted version of the same patch. Thanks again.

https://treeherder.mozilla.org/#/jobs?repo=nss-try&revision=6cf6eaf951143e00528e3e9ef3682b3c55266c63

Attachment #9104869 - Attachment is obsolete: true
Attachment #9105290 - Flags: review+
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → 3.48
Regressions: 1608327
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: