-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Support cpuid for win32 #8339
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
Merged
tom-cosgrove-arm
merged 9 commits into
Mbed-TLS:development
from
lpy4105:issue/support-cpuid-for-win32
Oct 23, 2023
Merged
Support cpuid for win32 #8339
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
308cb23
aesni: support cpuid on WIN32
lpy4105 e8c4bf1
aesni: declare cpuinfo as int
lpy4105 0ecb635
aesni: select `__cpuid` impl based on compiler type
lpy4105 64cca2f
all.sh: Re-enable MBEDTLS_AESNI_C in some components
lpy4105 1322613
all.sh: revert changes in test_m32*
lpy4105 bb4f63c
all.sh: build_mingw: test default config without MBEDTLS_AESNI_C
lpy4105 158eead
all.sh: build_mingw: only test build lib without MBEDTLS_AESNI_C
lpy4105 74f2c15
Add a changelog entry
lpy4105 d2d3d63
Reword the changelog entry
lpy4105 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4626,7 +4626,7 @@ component_test_m32_o0 () { | |
# build) and not the i386-specific inline assembly. | ||
msg "build: i386, make, gcc -O0 (ASan build)" # ~ 30s | ||
scripts/config.py full | ||
scripts/config.py unset MBEDTLS_AESNI_C # AESNI depends on cpu modifiers | ||
scripts/config.py unset MBEDTLS_AESNI_C # AESNI for 32-bit is tested in test_aesni_m32 | ||
make CC=gcc CFLAGS="$ASAN_CFLAGS -m32 -O0" LDFLAGS="-m32 $ASAN_CFLAGS" | ||
|
||
msg "test: i386, make, gcc -O0 (ASan build)" | ||
|
@@ -4644,7 +4644,7 @@ component_test_m32_o2 () { | |
# and go faster for tests. | ||
msg "build: i386, make, gcc -O2 (ASan build)" # ~ 30s | ||
scripts/config.py full | ||
scripts/config.py unset MBEDTLS_AESNI_C # AESNI depends on cpu modifiers | ||
scripts/config.py unset MBEDTLS_AESNI_C # AESNI for 32-bit is tested in test_aesni_m32 | ||
make CC=gcc CFLAGS="$ASAN_CFLAGS -m32 -O2" LDFLAGS="-m32 $ASAN_CFLAGS" | ||
|
||
msg "test: i386, make, gcc -O2 (ASan build)" | ||
|
@@ -4660,7 +4660,7 @@ support_test_m32_o2 () { | |
component_test_m32_everest () { | ||
msg "build: i386, Everest ECDH context (ASan build)" # ~ 6 min | ||
scripts/config.py set MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED | ||
scripts/config.py unset MBEDTLS_AESNI_C # AESNI depends on cpu modifiers | ||
scripts/config.py unset MBEDTLS_AESNI_C # AESNI for 32-bit is tested in test_aesni_m32 | ||
make CC=gcc CFLAGS="$ASAN_CFLAGS -m32 -O2" LDFLAGS="-m32 $ASAN_CFLAGS" | ||
|
||
msg "test: i386, Everest ECDH context - main suites (inc. selftests) (ASan build)" # ~ 50s | ||
|
@@ -5114,16 +5114,15 @@ component_test_tls13_only_record_size_limit () { | |
|
||
component_build_mingw () { | ||
msg "build: Windows cross build - mingw64, make (Link Library)" # ~ 30s | ||
scripts/config.py unset MBEDTLS_AESNI_C # AESNI depends on cpu modifiers | ||
make CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS='-Werror -Wall -Wextra' WINDOWS_BUILD=1 lib programs | ||
make CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS='-Werror -Wall -Wextra -maes -msse2 -mpclmul' WINDOWS_BUILD=1 lib programs | ||
|
||
# note Make tests only builds the tests, but doesn't run them | ||
make CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS='-Werror' WINDOWS_BUILD=1 tests | ||
make CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS='-Werror -maes -msse2 -mpclmul' WINDOWS_BUILD=1 tests | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change should be replace with Pragma or function attribute in future. |
||
make WINDOWS_BUILD=1 clean | ||
|
||
msg "build: Windows cross build - mingw64, make (DLL)" # ~ 30s | ||
make CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS='-Werror -Wall -Wextra' WINDOWS_BUILD=1 SHARED=1 lib programs | ||
make CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS='-Werror -Wall -Wextra' WINDOWS_BUILD=1 SHARED=1 tests | ||
make CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS='-Werror -Wall -Wextra -maes -msse2 -mpclmul' WINDOWS_BUILD=1 SHARED=1 lib programs | ||
make CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar LD=i686-w64-minggw32-ld CFLAGS='-Werror -Wall -Wextra -maes -msse2 -mpclmul' WINDOWS_BUILD=1 SHARED=1 tests | ||
make WINDOWS_BUILD=1 clean | ||
} | ||
support_build_mingw() { | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Do we need to
make lib
withoutMBEDTLS_AESNI_C
to check that it works on mingw?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.
Do you mean to test the build of pure C impl of AES? I think they have been covered because
MBEDTLS_AES_USE_HARDWARE_ONLY
is unset in defaul config.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.
Yes, but I mean to check that the C code builds under mingw, which is quite a "strange" environment - just
lib
, notprograms
, which shouldn't take longThere 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.
Sorry, I didn't get the point. We do build
lib
andprograms
and latertests
for both static and dynamic linked libraries in thismingw
test...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.
So with this PR, under mingw we are now building only with
MBEDTLS_AESNI_C
set, and not without it? So we are no longer checking that we build correctly under mingw withoutMBEDTLS_AESNI_C
. If that's right, I think we should add a build oflib
on its own withoutMBEDTLS_AESNI_C