File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -115,6 +115,11 @@ if(USE_STATIC_TF_PSA_CRYPTO_LIBRARY)
115115 ${target_objects} )
116116 tf_psa_crypto_set_base_compile_options (${tfpsacrypto_static_target} )
117117 tf_psa_crypto_set_extra_compile_options (${tfpsacrypto_static_target} )
118+ if (CMAKE_COMPILER_IS_GNU OR CMAKE_COMPILER_IS_CLANG)
119+ target_compile_options (${tfpsacrypto_static_target} PRIVATE
120+ -ffunction-sections
121+ -fdata-sections )
122+ endif ()
118123 set_target_properties (${tfpsacrypto_static_target} PROPERTIES OUTPUT_NAME tfpsacrypto )
119124 target_link_libraries (${tfpsacrypto_static_target} PUBLIC ${libs} )
120125
@@ -138,6 +143,11 @@ if(USE_SHARED_TF_PSA_CRYPTO_LIBRARY)
138143 ${target_objects} )
139144 tf_psa_crypto_set_base_compile_options (${tfpsacrypto_target} )
140145 tf_psa_crypto_set_extra_compile_options (${tfpsacrypto_target} )
146+ if (CMAKE_COMPILER_IS_GNU OR CMAKE_COMPILER_IS_CLANG)
147+ target_compile_options (${tfpsacrypto_target} PRIVATE
148+ -ffunction-sections
149+ -fdata-sections )
150+ endif ()
141151 set_target_properties (${tfpsacrypto_target} PROPERTIES VERSION ${TF_PSA_CRYPTO_VERSION} SOVERSION ${TF_PSA_CRYPTO_SOVERSION} )
142152 target_link_libraries (${tfpsacrypto_target} PUBLIC ${libs} )
143153
Original file line number Diff line number Diff line change @@ -11,4 +11,9 @@ foreach (target IN LISTS target_libraries)
1111 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} /src
1212 PRIVATE mldsa-native/mldsa
1313 )
14+ if (CMAKE_COMPILER_IS_GNU OR CMAKE_COMPILER_IS_CLANG)
15+ target_compile_options (${target} PRIVATE
16+ -ffunction-sections
17+ -fdata-sections )
18+ endif ()
1419endforeach (target )
Original file line number Diff line number Diff line change 1+ function (tfpsacrypto_mldsa_enable_dead_code_elimination exe )
2+ if (CMAKE_COMPILER_IS_GNU OR CMAKE_COMPILER_IS_CLANG)
3+ set_property (TARGET ${exe} APPEND_STRING PROPERTY
4+ LINK_FLAGS " -Wl,--gc-sections" )
5+ endif ()
6+ endfunction ()
7+
18# mldsa_export_pubkey
29tfpsacrypto_build_program_common (mldsa_export_public mldsa_export_public.c asn1_file_io.c )
310target_include_directories (mldsa_export_public PRIVATE
411 ${PROJECT_SOURCE_DIR} /drivers/pqcp/src
512 ${PROJECT_SOURCE_DIR} /drivers/pqcp/mldsa-native/mldsa/
613)
714
15+ tfpsacrypto_mldsa_enable_dead_code_elimination (mldsa_export_public )
816target_link_libraries (mldsa_export_public PRIVATE ${tfpsacrypto_static_target} ${CMAKE_THREAD_LIBS_INIT} )
917
1018# mldsa_sign
@@ -14,6 +22,7 @@ target_include_directories(mldsa_sign PRIVATE
1422 ${PROJECT_SOURCE_DIR} /drivers/pqcp/mldsa-native/mldsa/
1523)
1624
25+ tfpsacrypto_mldsa_enable_dead_code_elimination (mldsa_sign )
1726target_link_libraries (mldsa_sign PRIVATE ${tfpsacrypto_static_target} ${CMAKE_THREAD_LIBS_INIT} )
1827
1928# mldsa_verify
@@ -23,4 +32,5 @@ target_include_directories(mldsa_verify PRIVATE
2332 ${PROJECT_SOURCE_DIR} /drivers/pqcp/mldsa-native/mldsa/
2433)
2534
35+ tfpsacrypto_mldsa_enable_dead_code_elimination (mldsa_verify )
2636target_link_libraries (mldsa_verify PRIVATE ${tfpsacrypto_static_target} ${CMAKE_THREAD_LIBS_INIT} )
Original file line number Diff line number Diff line change @@ -515,6 +515,13 @@ component_test_pqcp_own_shake_no_builtin () {
515515 ctest
516516}
517517
518+ support_build_mldsa_program_symbol_partition () {
519+ case " $OSTYPE " in
520+ msys* |cygwin* |win32* ) false ;;
521+ * ) type nm > /dev/null 2> /dev/null ;;
522+ esac
523+ }
524+
518525component_build_mldsa_program_symbol_partition () {
519526 msg " build: ML-DSA program symbol partition"
520527
@@ -524,7 +531,9 @@ component_build_mldsa_program_symbol_partition () {
524531
525532 cd " $OUT_OF_SOURCE_DIR "
526533 cmake -DENABLE_PROGRAMS=ON -DENABLE_TESTING=OFF " $TF_PSA_CRYPTO_ROOT_DIR "
527- cmake --build . --target mldsa_export_public mldsa_sign mldsa_verify
534+ cmake --build . --target mldsa_export_public
535+ cmake --build . --target mldsa_sign
536+ cmake --build . --target mldsa_verify
528537
529538 nm -C --defined-only programs/mldsa/mldsa_sign > mldsa_sign.syms
530539 nm -C --defined-only programs/mldsa/mldsa_verify > mldsa_verify.syms
You can’t perform that action at this time.
0 commit comments