-
-
Notifications
You must be signed in to change notification settings - Fork 13.2k
nss: use optimized ARM64 crypto on Mac #252466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
By providing the correct flag overrides. Should speed up some crypto operations considerably.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enables optimized ARM64 cryptography operations for the nss formula on Mac by providing correct compiler flags. Previously, ARM64 optimization was disabled with a workaround comment indicating compilation failures, but this change removes that limitation and configures the build system to properly use ARM64 crypto instructions.
- Removes conditional runtime CPU detection that excluded ARM64 Macs
- Adds architecture-specific compiler flags for ARM64 builds via Darwin.mk configuration
- Increments formula revision to force rebuild with new optimizations
|
Why isn't upstream setting this themselves? |
|
Upstream is building using |
Formula/n/nss.rb
Outdated
| inreplace "coreconf/Darwin.mk", "# Nothing set for arm currently.", | ||
| "CC += -arch aarch64\nCCC += -arch aarch64\noverride CPU_ARCH = aarch64" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this based on a patch that's already been merged on your Phabricator? If not, we'd prefer that this be fixed there first (or, at least, concurrently, with a reference to the upstream fix here in the inreplace).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, can we not just override CPU_ARCH when calling make, given that the Makefile only seems to set this behind an ifndef?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this based on a patch that's already been merged on your Phabricator? If not, we'd prefer that this be fixed there first (or, at least, concurrently, with a reference to the upstream fix here in the
inreplace).
It's not, and since we don't build NSS with make, we wouldn't be able to test this change there. CC'ing @jschanck @dennisjackson @mozkeeler to check is this is something they think should be done.
Also, can we not just override
CPU_ARCHwhen callingmake, given that theMakefileonly seems to set this behind anifndef?
That seems to leave the -arch ppc flags in place, but the compile also succeeds. I mostly went the inreplace way since it shadows how it's done for other architectures. (Again, since we don't build with make, I have no real deep insight into what's best here.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a change we should just make in-tree. Our infra does build/test using make, but interestingly not on macOS, which is probably something we should change as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Glad I CC'ed @mozkeeler; learned something :-) OK, so let's make that change in-tree, and I will revisit this PR when it's landed in a release.
nss on Mac use optimized ARM64 cryptoCo-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
By providing the correct flag overrides. Should speed up some crypto operations considerably.
CC @dennisjackson @martinthomson
HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>, where<formula>is the name of the formula you're submitting?brew test <formula>, where<formula>is the name of the formula you're submitting?brew audit --strict <formula>(after doingHOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>)? If this is a new formula, does it passbrew audit --new <formula>?