Skip to content

OPENSSL_SMALL: imply MY_ASSEMBLER_IS_TOO_OLD_FOR_512AVX on x86_64#3319

Open
justsmth wants to merge 1 commit into
aws:mainfrom
justsmth:reduce-binary-size-OPENSSL_SMALL
Open

OPENSSL_SMALL: imply MY_ASSEMBLER_IS_TOO_OLD_FOR_512AVX on x86_64#3319
justsmth wants to merge 1 commit into
aws:mainfrom
justsmth:reduce-binary-size-OPENSSL_SMALL

Conversation

@justsmth

@justsmth justsmth commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Issues:

Addresses: aws/aws-lc-rs#745, P353434599

Description of changes:

When OPENSSL_SMALL is defined on x86_64, automatically define MY_ASSEMBLER_IS_TOO_OLD_FOR_512AVX. This eliminates ~912 KB of AVX-512 assembly (AES-GCM, AES-XTS, RSAZ) from the binary, which is the single largest contributor to object code size on x86_64. Combined with the existing EC precomputed table gating, this reduces libcrypto.a from 5.6 MB to 3.5 MB under OPENSSL_SMALL.

Call out

  • This enforces the implication MY_ASSEMBLER_IS_TOO_OLD_FOR_AVX -> MY_ASSEMBLER_IS_TOO_OLD_FOR_512AVX in "target.h". Previously this was only enforced by CMakeLists.txt, meaning builds that pass defines directly via CFLAGS (e.g., the aws-lc-sys CcBuilder) did not get the implication.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.

When OPENSSL_SMALL is defined on x86_64, automatically define
MY_ASSEMBLER_IS_TOO_OLD_FOR_512AVX. This eliminates ~912 KB of AVX-512
assembly (AES-GCM, AES-XTS, RSAZ) from the binary, which is the single
largest contributor to object code size on x86_64. Combined with the
existing EC precomputed table gating, this reduces libcrypto.a from
5.6 MB to 3.5 MB under OPENSSL_SMALL.

The performance cost is limited to AVX-512-capable CPUs (Ice Lake+,
Zen 4+) for bulk AES-GCM, AES-XTS, and SHA operations. On CPUs without
AVX-512, behavior is unchanged.

Additionally, enforce the implication MY_ASSEMBLER_IS_TOO_OLD_FOR_AVX ->
MY_ASSEMBLER_IS_TOO_OLD_FOR_512AVX in target.h. Previously this was only
enforced by CMakeLists.txt, meaning builds that pass defines directly via
CFLAGS (e.g., the aws-lc-sys CcBuilder) did not get the implication.
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.39%. Comparing base (0b4e4ea) to head (8b9dc6a).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3319      +/-   ##
==========================================
+ Coverage   78.17%   78.39%   +0.21%     
==========================================
  Files         693      693              
  Lines      123874   123896      +22     
  Branches    17200    17209       +9     
==========================================
+ Hits        96840    97127     +287     
+ Misses      26116    25848     -268     
- Partials      918      921       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@justsmth justsmth requested review from nebeid and torben-hansen June 26, 2026 14:27
justsmth added a commit to justsmth/aws-lc that referenced this pull request Jun 26, 2026
OPENSSL_SMALL implies MY_ASSEMBLER_IS_TOO_OLD_FOR_512AVX on x86_64
(aws#3319), which disables s2n-bignum entirely. Remove the now-unnecessary
x86_64 branches from the OPENSSL_SMALL selector header and CMakeLists,
leaving only the aarch64 variant pinning.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants