Skip to content

[boringssl] Simplify BoringSSL assembly build#33700

Merged
jtattermusch merged 2 commits intogrpc:masterfrom
davidben:bssl-asm-simpler
Aug 2, 2023
Merged

[boringssl] Simplify BoringSSL assembly build#33700
jtattermusch merged 2 commits intogrpc:masterfrom
davidben:bssl-asm-simpler

Conversation

@davidben
Copy link
Copy Markdown
Contributor

@davidben davidben commented Jul 13, 2023

NB: I haven't tested this at all and am hoping the CI will tell me where I've (undoubtedly) messed something up. Edit: looks like CI is now clear!

BoringSSL's gas-compatible assembly files, like its C files, are now wrapped with preprocessor ifdefs to capture which platforms each file should be enabled on. This means that, provided the platform can process .S files it all (i.e. not Windows), we no longer need to detect the exact CPU architecture in the build.

Switch gRPC's build to take advantage of this. I've retained BUILD_OVERRIDE_BORING_SSL_ASM_PLATFORM, on the off chance anyone is using it to cross-compile between Windows and non-Windows, though I doubt that works particularly well.

As part of this, restore assembly optimizations in a few places where they were seemingly disabled for issues relating to this:

  • Build native MacOS arm64 artifacts (universal2) #31747 had to disable the assembly, because at the time assembly required the library be built differently for each architecture and then stitched back together. This should now work.

  • tools/run_tests/run_tests.py disabled x86 assembly due to some issues with CMAKE_SYSTEM_PROCESSOR in a Docker image. This too should now be moot.

BoringSSL's gas-compatible assembly files, like its C files, are now
wrapped with preprocessor ifdefs to capture which platforms each file
should be enabled on. This means that, provided the platform can process
.S files it all (i.e. not Windows), we no longer need to detect the
exact CPU architecture in the build.

Switch gRPC's build to take advantage of this. I've retained
BUILD_OVERRIDE_BORING_SSL_ASM_PLATFORM, on the off chance anyone is
using it to cross-compile between Windows and non-Windows, though I
doubt that works particularly well.

As part of this, restore assembly optimizations in a few places where
they were seemingly disabled for issues relating to this:

- grpc#31747 had to disable the assembly,
  because at the time assembly required the library be built differently
  for each architecture and then stitched back together. This should now
  work.

- tools/run_tests/run_tests.py disabled x86 assembly due to some issues
  with CMAKE_SYSTEM_PROCESSOR in a Docker image. This too should now be
  moot.
@drfloob drfloob assigned drfloob and unassigned eugeneo Jul 14, 2023
@davidben davidben changed the title Simplify BoringSSL assembly build [boringssl] Simplify BoringSSL assembly build Jul 15, 2023
@davidben
Copy link
Copy Markdown
Contributor Author

Okay, ready for another attempt through CI.

@davidben
Copy link
Copy Markdown
Contributor Author

Looks like CI is clear now!

@drfloob
Copy link
Copy Markdown
Member

drfloob commented Jul 25, 2023

CC @jtattermusch @veblush

@eugeneo eugeneo requested a review from jtattermusch July 25, 2023 16:45
@drfloob drfloob assigned gnossen and XuanWang-Amos and unassigned drfloob Aug 1, 2023
Copy link
Copy Markdown
Contributor

@gnossen gnossen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really happy Apple silicon users will be able to take advantage of assembly optimizations now. Thanks!

@jtattermusch jtattermusch added the release notes: no Indicates if PR should not be in release notes label Aug 2, 2023
Copy link
Copy Markdown
Contributor

@jtattermusch jtattermusch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the improvement!

@jtattermusch jtattermusch merged commit 113b092 into grpc:master Aug 2, 2023
@copybara-service copybara-service bot added the imported Specifies if the PR has been imported to the internal repository label Aug 2, 2023
davidben added a commit to google/boringssl that referenced this pull request Aug 8, 2023
The android-cmake one should no longer be needed as of aosp/2673299, and
the JSON one as of grpc/grpc#33700

Bug: 542
Change-Id: I3c7b752806d82a5a01b5ad9180771e88d2810b70
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/62185
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: Adam Langley <agl@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/build bloat/none imported Specifies if the PR has been imported to the internal repository lang/Python per-call-memory/neutral per-channel-memory/neutral release notes: no Indicates if PR should not be in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants