-
Notifications
You must be signed in to change notification settings - Fork 130
Add LOONGARCH64_GNU toolchain #3282
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
Add LOONGARCH64_GNU toolchain for loongarch64 architecture. Signed-off-by: Qihang Gao <[email protected]> Cc: Chao Li <[email protected]> CC: Dongyan Qian <[email protected]>
|
||
set(CMAKE_C_LINK_EXECUTABLE "") | ||
elseif(TOOLCHAIN STREQUAL "LOONGARCH64_GNU") | ||
set(CMAKE_C_COMPILER loongarch64-unknown-linux-gnu-gcc) |
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.
find_program(LOONGARCH_GXX NAMES unknown-loongarch-linux-gnu-gcc)
if (LOONGARCH_GXX)
set(CMAKE_C_COMPILER loongarch64-unknown-linux-gnu-gcc)
else()
set(CMAKE_C_COMPILER gcc)
endif()
set(OPENSSL_FLAGS -std=c11 -include base.h -Wno-error=maybe-uninitialized -Wno-error=format -Wno-format -Wno-error=unused-but-set-variable -Wno-cast-qual) | ||
set(CMOCKA_FLAGS -std=gnu99 -Wpedantic -Wall -Wshadow -Wmissing-prototypes -Wcast-align -Werror=address -Wstrict-prototypes -Werror=strict-prototypes -Wwrite-strings -Werror=write-strings -Werror-implicit-function-declaration -Wpointer-arith -Werror=pointer-arith -Wdeclaration-after-statement -Werror=declaration-after-statement -Wreturn-type -Werror=return-type -Wuninitialized -Werror=uninitialized -Werror=strict-overflow -Wstrict-overflow=2 -Wno-format-zero-length -Wmissing-field-initializers -Wformat-security -Werror=format-security -fno-common -Wformat -fno-common -fstack-protector-strong -Wno-cast-qual) | ||
|
||
set(CMAKE_AR loongarch64-unknown-linux-gnu-gcc-ar) |
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.
if (LOONGARCH_GXX)
set(CMAKE_AR loongarch64-unknown-linux-gnu-gcc-ar)
else()
set(CMAKE_AR ar)
endif()
|
||
set(CMAKE_AR loongarch64-unknown-linux-gnu-gcc-ar) | ||
|
||
set(CMAKE_LINKER loongarch64-unknown-linux-gnu-gcc) |
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.
if (LOONGARCH_GXX)
set(CMAKE_LINKER loongarch64-unknown-linux-gnu-gcc)
else()
set(CMAKE_LINKER gcc)
endif()
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.
qiandongyan@aosc-qdy ~/github/libspdm/build/bin $ uname -a
Linux aosc-qdy 6.15.0-aosc-rc #1 SMP PREEMPT_DYNAMIC Tue May 20 16:35:17 UTC 2025 loongarch64 GNU/Linux
qiandongyan@aosc-qdy ~/github/libspdm/build/bin $ ./test_spdm_common
[==========] spdm_common_context_data_tests: Running 22 test(s).
[ RUN ] libspdm_test_common_context_data_case1
[ OK ] libspdm_test_common_context_data_case1
[ RUN ] libspdm_test_common_context_data_case2
[ OK ] libspdm_test_common_context_data_case2
[ RUN ] libspdm_test_common_context_data_case3
[ OK ] libspdm_test_common_context_data_case3
[ RUN ] libspdm_test_common_context_data_case4
[ OK ] libspdm_test_common_context_data_case4
[ RUN ] libspdm_test_verify_peer_cert_chain_buffer_case5
[ OK ] libspdm_test_verify_peer_cert_chain_buffer_case5
[ RUN ] libspdm_test_verify_peer_cert_chain_buffer_case6
[ OK ] libspdm_test_verify_peer_cert_chain_buffer_case6
[ RUN ] libspdm_test_verify_peer_cert_chain_buffer_case7
[ OK ] libspdm_test_verify_peer_cert_chain_buffer_case7
[ RUN ] libspdm_test_verify_peer_cert_chain_buffer_case8
[ OK ] libspdm_test_verify_peer_cert_chain_buffer_case8
[ RUN ] libspdm_test_set_data_case9
[ OK ] libspdm_test_set_data_case9
[ RUN ] libspdm_test_process_opaque_data_supported_version_data_case10
[ OK ] libspdm_test_process_opaque_data_supported_version_data_case10
[ RUN ] libspdm_test_process_opaque_data_supported_version_data_case11
[ OK ] libspdm_test_process_opaque_data_supported_version_data_case11
[ RUN ] libspdm_test_process_opaque_data_supported_version_data_case12
[ OK ] libspdm_test_process_opaque_data_supported_version_data_case12
[ RUN ] libspdm_test_process_opaque_data_supported_version_data_case13
[ OK ] libspdm_test_process_opaque_data_supported_version_data_case13
[ RUN ] libspdm_test_process_opaque_data_selection_version_data_case14
[ OK ] libspdm_test_process_opaque_data_selection_version_data_case14
[ RUN ] libspdm_test_process_opaque_data_selection_version_data_case15
[ OK ] libspdm_test_process_opaque_data_selection_version_data_case15
[ RUN ] libspdm_test_process_opaque_data_selection_version_data_case16
[ OK ] libspdm_test_process_opaque_data_selection_version_data_case16
[ RUN ] libspdm_test_process_opaque_data_selection_version_data_case17
[ OK ] libspdm_test_process_opaque_data_selection_version_data_case17
[ RUN ] libspdm_test_secured_message_context_location_selection_case18
[ OK ] libspdm_test_secured_message_context_location_selection_case18
[ RUN ] libspdm_test_export_master_secret_case19
[ OK ] libspdm_test_export_master_secret_case19
[ RUN ] libspdm_test_check_context_case20
[ OK ] libspdm_test_check_context_case20
[ RUN ] libspdm_test_max_session_count_case21
[ OK ] libspdm_test_max_session_count_case21
[ RUN ] libspdm_test_process_opaque_data_case22
[ OK ] libspdm_test_process_opaque_data_case22
[==========] spdm_common_context_data_tests: 22 test(s) run.
[ PASSED ] 22 test(s).
[==========] spdm_common_context_data_tests: Running 1 test(s).
[ RUN ] libspdm_test_common_context_data_case1
[ OK ] libspdm_test_common_context_data_case1
[==========] spdm_common_context_data_tests: 1 test(s) run.
[ PASSED ] 1 test(s).
For compatibility, it is recommended to roll back the compiler so that it can support non-cross compilation environments. I can already build it normally.
For example: The distribution's gcc points to loongarch64-aosc-linux-gnu-gcc.
Add LOONGARCH64_GNU toolchain for loongarch64 architecture.
Cc: Chao Li [email protected]
CC: Dongyan Qian [email protected]