-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
[OpenSSL] Enabling Arm64 assembly on Windows by using clang #34711
[OpenSSL] Enabling Arm64 assembly on Windows by using clang #34711
Conversation
ports/openssl/windows/portfile.cmake
Outdated
vcpkg_add_to_path("${clang_path}") | ||
|
||
set(as clang-cl) | ||
set(cc clang-cl) |
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.
AFAICT the vcpkg owners do not want to use clang as a C compiler in triplet which are meant to use MSVC as a C compiler.
(However, using clang as an assembler is accepted.)
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.
You also need to check that the toolchain has not a valid ASM_COMPILER being set.
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.
OpenSSL provides two options to build Arm64 assembly with clang-cl, VC-WIN64-CLANGASM-ARM and VC-CLANG-WIN64-CLANGASM-ARM.
https://github.com/openssl/openssl/blob/master/NOTES-WINDOWS.md
In this PR, VC-CLANG-WIN64-CLANGASM-ARM is used. It provides better performance and uses clang-cl as both compiler and assembler.
@Neumann-A could you please clarify how valid ASM_COMPILER should be used if we need clang-cl for AS in any case?
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.
In this PR, VC-CLANG-WIN64-CLANGASM-ARM is used. It provides better performance and uses clang-cl as both compiler and assembler.
The compiler must follow the toolchain. The port must not make own decisions, no matter if crypto or video.
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.
could you please clarify how valid ASM_COMPILER should be used if we need clang-cl for AS in any case?
If my toolchain specifies a valid CMAKE_ASM_COMPILER
(which is not cl) i expect it to be used together with CMAKE_ASM_FLAGS(_<CONFIG>)
. The toolchain is the king deciding what to use.
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.
It looks like NASM was used earlier without CMAKE_ASM_COMPILER check, should it be also improved?
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.
OpenSSL uses a proprietary configuration/build system. Feeding in our precise toolchain settings might be a different task.
But selecting the best-matching configuration identifier is a fair request. VC-CLANG-WIN64-CLANGASM-ARM
is for clang triplets. VC-WIN64-CLANGASM-ARM
seems to be an acceptable option for the standard windows triplets.
This means you need to detect the C compiler, and you need to find/acquire the suitable clang as an assembler.
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.
It has been changed as it was suggested
Don't forget modify the
|
elseif(VCPKG_DETECTED_CMAKE_C_COMPILER_ID MATCHES "Clang") | ||
set(OPENSSL_ARCH VC-CLANG-WIN64-CLANGASM-ARM) | ||
else() | ||
set(OPENSSL_ARCH VC-WIN64-CLANGASM-ARM) |
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.
Does this mean if the C compiler does not match clang we are still assuming Clang is the compiler? Since Clang is in both variable names
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.
clang-cl is used as the assembler in both cases, with clang as the C compiler or with some other C compiler.
Improving OpenSSL performance on Windows by using Arm64 assembly with clang-cl
Extra Arm64 assembly will be enabled in the next stable OpenSSL build
openssl/openssl@636ee1d