Skip to content

Commit cecedaa

Browse files
committed
fix(libsodium): disable GCC static analyzer for libsodium
GCC's -fanalyzer flag, enabled by CONFIG_COMPILER_STATIC_ANALYZER=y, causes the compiler to hang indefinitely when analyzing libsodium's elliptic curve code (crypto_core/ed25519/ref10/ed25519_ref10.c). The -fanalyzer pass performs deep interprocedural static analysis, tracking symbolic state across all function calls within a translation unit. The complex field element arithmetic in ed25519_ref10.c (multiply, square, carry propagation) with many static helper functions visible in the same translation unit causes combinatorial state explosion in the analyzer, making GCC's cc1 process run at 100% CPU indefinitely. In a parallel build, this blocks all dependent steps (linking, binary generation) while independent steps finish normally, making the build appear stuck at "Completed 'bootloader'" — the last independent ninja target to complete. This is the same approach already used by ESP-IDF for mbedtls, wpa_supplicant, freertos, and other components with complex code that triggers pathological behavior in GCC's static analyzer. Closes espressif/esp-idf#18373 Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
1 parent 78a1615 commit cecedaa

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

libsodium/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,3 +187,7 @@ if(CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE)
187187
# some libsodium variables are only used for asserts
188188
target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-unused-but-set-variable)
189189
endif()
190+
191+
if(CONFIG_COMPILER_STATIC_ANALYZER AND CMAKE_C_COMPILER_ID STREQUAL "GNU")
192+
target_compile_options(${COMPONENT_LIB} PRIVATE "-fno-analyzer")
193+
endif()

0 commit comments

Comments
 (0)