Clang and GCC now offer sanitizers. Uri and I have been testing Crypto++
under the Undefined Behavior Sanitizer (UBsan) and Address Sanitizer (Asan)
for some time now.
Using them usually requires us to modify the makefile. The patch below adds
proper support for them so we can do things like:
make ubsan
./cryptest.exe v | grep error
Are there any comments or objections?
**********
diff --git a/GNUmakefile b/GNUmakefile
index 1f7185a..82327c5 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -4,7 +4,7 @@ CXXFLAGS ?= -DNDEBUG -g2 -O3
# CXXFLAGS += -ffunction-sections -fdata-sections
# LDFLAGS += -Wl,--gc-sections
ARFLAGS = -cr # ar needs the dash on OpenBSD
-RANLIB = ranlib
+RANLIB ?= ranlib
CP = cp
MKDIR = mkdir
EGREP = egrep
@@ -38,6 +38,16 @@ ifneq ($(IS_X86_64),0)
CXXFLAGS += -fPIC
endif # PIC for x86_64 targets
+# Undefined Behavior Sanitzier (Clang and G++)
+ifeq ($(findstring ubsan,$(MAKECMDGOALS)),ubsan)
+CXXFLAGS += -fsanitize=undefined
+endif # UBsan
+
+# Address Sanitzier (Clang and G++)
+ifeq ($(findstring asan,$(MAKECMDGOALS)),asan)
+CXXFLAGS += -fsanitize=address
+endif # Asan
+
# Cygwin work arounds
ifneq ($(IS_CYGWIN),0)
@@ -168,6 +178,8 @@ all: cryptest.exe
static: libcryptopp.a
dynamic: libcryptopp.so
+asan ubsan: libcryptopp.a cryptest.exe
+
test: cryptest.exe
./cryptest.exe v
--
--
You received this message because you are subscribed to the "Crypto++ Users"
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at
http://www.cryptopp.com.
---
You received this message because you are subscribed to the Google Groups
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.