@ -1,15 +1,33 @@
# CLANG_VERSION is empty if the compiler is not clang-based
CLANG_VERSION = $( shell $( CC) --version | grep -Po "clang version \K[\d\.]+" )
CLANG_VERSION_MAJOR = $( shell echo $( CLANG_VERSION) | cut -f1 -d.)
# determine specific version ranges
i f n e q ( $( CLANG_VERSION ) , )
$( if $ ( shell [ $ ( CLANG_VERSION_MAJOR ) -ge 13 ] && echo "OK ") , \
$( eval CLANG_AT_LEAST_13 := true ) , \
$( eval CLANG_AT_LEAST_13 := false ) )
$( if $ ( shell [ $ ( CLANG_VERSION_MAJOR ) -ge 14 ] && echo "OK ") , \
$( eval CLANG_AT_LEAST_14 := true ) , \
$( eval CLANG_AT_LEAST_14 := false ) )
e n d i f
i f e q ( $( FUZZER ) , 1 )
CC ?= clang
LD ?= $( CC)
SANFLAGS += -fsanitize= fuzzer
# TODO gcc as well as older clang versions <= 12 do not support this feature
# only clang versions >= 13 support this feature
i f e q ( $( CLANG_AT_LEAST_ 13) , t r u e )
$(info "info : using -fsanitize -ignorelist ")
SANFLAGS += -fsanitize-ignorelist= fuzzer/sanitizer_ignorelist.txt
SANFLAGS += -fsanitize-ignorelist= fuzzer/sanitizer_ignorelist.txt
e l s e
$(info "info : not using -fsanitize -ignorelist ")
e n d i f
# TODO is there a better solution, for example by disabling a specific optimization technique?
# there is a clang optimization issue in relation with the blake2 code at -fsanitize=undefined
$(warning "warning : disable optimization on blake 2 code as workaround ")
$(warning "warning : disabl ing optimization on blake 2 code as workaround ")
blake2b.o : OPTFLAGS += -O 0
blake2s.o : OPTFLAGS += -O 0
@ -61,8 +79,8 @@ ZKP_PATH = ../vendor/secp256k1-zkp
CFLAGS += -DSECP256K1_CONTEXT_SIZE= 208
# TODO remove this workaround once possible
i f e q ( $( C C) , c l a n g - 1 4 )
$(warning "warning : suppress clang -14 compiler warning for secp 256k 1-zkp code ")
i f e q ( $( C LANG_AT_LEAST_14) , t r u e )
$(warning "warning : suppress ing clang -14 compiler warning for secp 256k 1-zkp code ")
ZKP_CFLAGS += -Wno-bitwise-instead-of-logical
e n d i f