@@ -15,11 +15,11 @@ if(ANDROID)
1515 # Clang reports that argument as unused. We remove the flag only for the FIPS build of Android.
1616 string (FIND ${CMAKE_CXX_FLAGS} "noexecstack" CXX_EXTRA_WA)
1717 string (FIND ${CMAKE_C_FLAGS} "noexecstack" C_EXTRA_WA)
18- if (NOT ${ CXX_EXTRA_WA} EQUAL '-1' )
19- string ( REPLACE "-Wa,--noexecstack" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} " )
18+ if (NOT CXX_EXTRA_WA EQUAL -1 )
19+ string (REPLACE "-Wa,--noexecstack" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} " )
2020 endif ()
21- if (NOT ${ C_EXTRA_WA} EQUAL '-1' )
22- string ( REPLACE "-Wa,--noexecstack" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS} " )
21+ if (NOT C_EXTRA_WA EQUAL -1 )
22+ string (REPLACE "-Wa,--noexecstack" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS} " )
2323 endif ()
2424endif ()
2525
@@ -551,6 +551,18 @@ elseif(FIPS_SHARED)
551551 target_compile_definitions (bcm_library PRIVATE BORINGSSL_IMPLEMENTATION S2N_BN_HIDE_SYMBOLS )
552552 target_add_awslc_include_paths (TARGET bcm_library SCOPE PRIVATE )
553553 target_include_directories (bcm_library PRIVATE "${S2N_BIGNUM_INCLUDE_DIR} " )
554+
555+ # On GCC 14+ the Superword Level Parallelism (SLP) vectorizer causes the
556+ # compiler to aggressively store static function pointer addresses in the
557+ # .data.rel.ro.local section which is discarded by our linker script and
558+ # results in undefined references when linking libcrypto.
559+ if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND
560+ CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "14" AND
561+ CMAKE_SYSTEM_NAME STREQUAL "Linux" AND
562+ ARCH STREQUAL "x86_64" )
563+ target_compile_options (bcm_library PRIVATE -fno-tree-slp-vectorize )
564+ endif ()
565+
554566 if (APPLE )
555567 set (BCM_NAME bcm.o)
556568 # The linker on macOS doesn't have the ability to process linker scripts,
0 commit comments