Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/3d20a3974c62a284325f8e6f12b7fbb50b4607b7
...commit
http://git.netsurf-browser.org/netsurf.git/commit/3d20a3974c62a284325f8e6f12b7fbb50b4607b7
...tree
http://git.netsurf-browser.org/netsurf.git/tree/3d20a3974c62a284325f8e6f12b7fbb50b4607b7
The branch, master has been updated
via 3d20a3974c62a284325f8e6f12b7fbb50b4607b7 (commit)
from 42459f72c1f0e3dcdc1686447f1522c4fe9e3134 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=3d20a3974c62a284325f8e6f12b7fbb50b4607b7
commit 3d20a3974c62a284325f8e6f12b7fbb50b4607b7
Author: Daniel Silverstone <[email protected]>
Commit: Daniel Silverstone <[email protected]>
Support ASAN and UBSAN in Makefiles
diff --git a/Makefile b/Makefile
index 3109a77..359b89b 100644
--- a/Makefile
+++ b/Makefile
@@ -575,6 +575,25 @@ CXXFLAGS += -DNETSURF_HOMEPAGE=\"$(NETSURF_HOMEPAGE)\"
CFLAGS += -DNETSURF_LOG_LEVEL=$(NETSURF_LOG_LEVEL)
CXXFLAGS += -DNETSURF_LOG_LEVEL=$(NETSURF_LOG_LEVEL)
+# If we're building the sanitizer goal, override things
+ifneq ($(filter-out sanitize,$(MAKECMDGOALS)),$(MAKECMDGOALS))
+override NETSURF_USE_SANITIZER := YES
+override NETSURF_RECOVER_SANITIZERS := NO
+endif
+
+# If we're going to use the sanitizer set it up
+ifeq ($(NETSURF_USE_SANITIZER),YES)
+SAN_FLAGS := -fsanitize=address -fsanitize=undefined
+ifeq ($(NETSURF_RECOVER_SANITIZERS),NO)
+SAN_FLAGS += -fno-sanitize-recover
+endif
+else
+SAN_FLAGS :=
+endif
+CFLAGS += $(SAN_FLAGS)
+CXXFLAGS += $(SAN_FLAGS)
+LDFLAGS += $(SAN_FLAGS)
+
# and the logging filter
CFLAGS += -DNETSURF_BUILTIN_LOG_FILTER=\"$(NETSURF_BUILTIN_LOG_FILTER)\"
CXXFLAGS += -DNETSURF_BUILTIN_LOG_FILTER=\"$(NETSURF_BUILTIN_LOG_FILTER)\"
diff --git a/Makefile.config.example b/Makefile.config.example
index aeddc10..010e89f 100644
--- a/Makefile.config.example
+++ b/Makefile.config.example
@@ -33,3 +33,9 @@
### To change flags to javascript binding generator
# GBFLAGS:=-g
+
+### To enable ASAN and UBSAN support in builds regardless of target
+# override NETSURF_USE_SANITIZERS := YES
+
+### If you're using the sanitizers and you want it to stop on failure...
+# override NETSURF_RECOVER_SANITIZERS := NO
diff --git a/Makefile.defaults b/Makefile.defaults
index 1f9ce5f..5109010 100644
--- a/Makefile.defaults
+++ b/Makefile.defaults
@@ -109,6 +109,11 @@ NETSURF_USE_LIBICONV_PLUG := YES
# Valid options: YES, NO
NETSURF_FS_BACKING_STORE := NO
+# Enable the ASAN and UBSAN flags regardless of targets
+NETSURF_USE_SANITIZERS := NO
+# But recover after sanitizer failure
+NETSURF_RECOVER_SANITIZERS := YES
+
# Initial CFLAGS. Optimisation level etc. tend to be target specific.
CFLAGS :=
diff --git a/test/Makefile b/test/Makefile
index a5f023b..4f9dd22 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -141,6 +141,7 @@ BASE_TESTCFLAGS := -std=c99 -g \
-D_XOPEN_SOURCE=600 \
-Itest -Iinclude -Icontent/handlers -Ifrontends -I. -I.. \
-Dnsgtk \
+ $(SAN_FLAGS) \
$(shell pkg-config --cflags libcurl libparserutils libwapcaplet libdom
libnsutils libutf8proc) \
$(LIB_CFLAGS)
TESTCFLAGS := $(BASE_TESTCFLAGS) \
@@ -149,6 +150,7 @@ TESTCFLAGS := $(BASE_TESTCFLAGS) \
TESTLDFLAGS := -L$(TESTROOT) \
$(shell pkg-config --libs libcurl libparserutils libwapcaplet libdom
libnsutils libutf8proc) -lz \
+ $(SAN_FLAGS) \
$(LIB_LDFLAGS)\
$(COV_LDFLAGS)
@@ -202,11 +204,12 @@ $(eval $(foreach SOURCE,$(sort $(filter
%.c,$(NOCOV_TESTSOURCES))), \
$(call compile_test_nocov_target_c,$(SOURCE),$(subst
/,_,$(SOURCE:.c=.o)),$(subst /,_,$(SOURCE:.c=.d)))))
-.PHONY:test coverage
+.PHONY:test coverage sanitize
test: $(TESTROOT)/created $(TESTROOT)/libmalloc_fig.so $(addsuffix
_test,$(TESTS))
coverage: test
+sanitize: test
$(TESTROOT)/created:
$(VQ)echo " MKDIR: $(TESTROOT)"
-----------------------------------------------------------------------
Summary of changes:
Makefile | 19 +++++++++++++++++++
Makefile.config.example | 6 ++++++
Makefile.defaults | 5 +++++
test/Makefile | 5 ++++-
4 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 3109a77..359b89b 100644
--- a/Makefile
+++ b/Makefile
@@ -575,6 +575,25 @@ CXXFLAGS += -DNETSURF_HOMEPAGE=\"$(NETSURF_HOMEPAGE)\"
CFLAGS += -DNETSURF_LOG_LEVEL=$(NETSURF_LOG_LEVEL)
CXXFLAGS += -DNETSURF_LOG_LEVEL=$(NETSURF_LOG_LEVEL)
+# If we're building the sanitizer goal, override things
+ifneq ($(filter-out sanitize,$(MAKECMDGOALS)),$(MAKECMDGOALS))
+override NETSURF_USE_SANITIZER := YES
+override NETSURF_RECOVER_SANITIZERS := NO
+endif
+
+# If we're going to use the sanitizer set it up
+ifeq ($(NETSURF_USE_SANITIZER),YES)
+SAN_FLAGS := -fsanitize=address -fsanitize=undefined
+ifeq ($(NETSURF_RECOVER_SANITIZERS),NO)
+SAN_FLAGS += -fno-sanitize-recover
+endif
+else
+SAN_FLAGS :=
+endif
+CFLAGS += $(SAN_FLAGS)
+CXXFLAGS += $(SAN_FLAGS)
+LDFLAGS += $(SAN_FLAGS)
+
# and the logging filter
CFLAGS += -DNETSURF_BUILTIN_LOG_FILTER=\"$(NETSURF_BUILTIN_LOG_FILTER)\"
CXXFLAGS += -DNETSURF_BUILTIN_LOG_FILTER=\"$(NETSURF_BUILTIN_LOG_FILTER)\"
diff --git a/Makefile.config.example b/Makefile.config.example
index aeddc10..010e89f 100644
--- a/Makefile.config.example
+++ b/Makefile.config.example
@@ -33,3 +33,9 @@
### To change flags to javascript binding generator
# GBFLAGS:=-g
+
+### To enable ASAN and UBSAN support in builds regardless of target
+# override NETSURF_USE_SANITIZERS := YES
+
+### If you're using the sanitizers and you want it to stop on failure...
+# override NETSURF_RECOVER_SANITIZERS := NO
diff --git a/Makefile.defaults b/Makefile.defaults
index 1f9ce5f..5109010 100644
--- a/Makefile.defaults
+++ b/Makefile.defaults
@@ -109,6 +109,11 @@ NETSURF_USE_LIBICONV_PLUG := YES
# Valid options: YES, NO
NETSURF_FS_BACKING_STORE := NO
+# Enable the ASAN and UBSAN flags regardless of targets
+NETSURF_USE_SANITIZERS := NO
+# But recover after sanitizer failure
+NETSURF_RECOVER_SANITIZERS := YES
+
# Initial CFLAGS. Optimisation level etc. tend to be target specific.
CFLAGS :=
diff --git a/test/Makefile b/test/Makefile
index a5f023b..4f9dd22 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -141,6 +141,7 @@ BASE_TESTCFLAGS := -std=c99 -g \
-D_XOPEN_SOURCE=600 \
-Itest -Iinclude -Icontent/handlers -Ifrontends -I. -I.. \
-Dnsgtk \
+ $(SAN_FLAGS) \
$(shell pkg-config --cflags libcurl libparserutils libwapcaplet libdom
libnsutils libutf8proc) \
$(LIB_CFLAGS)
TESTCFLAGS := $(BASE_TESTCFLAGS) \
@@ -149,6 +150,7 @@ TESTCFLAGS := $(BASE_TESTCFLAGS) \
TESTLDFLAGS := -L$(TESTROOT) \
$(shell pkg-config --libs libcurl libparserutils libwapcaplet libdom
libnsutils libutf8proc) -lz \
+ $(SAN_FLAGS) \
$(LIB_LDFLAGS)\
$(COV_LDFLAGS)
@@ -202,11 +204,12 @@ $(eval $(foreach SOURCE,$(sort $(filter
%.c,$(NOCOV_TESTSOURCES))), \
$(call compile_test_nocov_target_c,$(SOURCE),$(subst
/,_,$(SOURCE:.c=.o)),$(subst /,_,$(SOURCE:.c=.d)))))
-.PHONY:test coverage
+.PHONY:test coverage sanitize
test: $(TESTROOT)/created $(TESTROOT)/libmalloc_fig.so $(addsuffix
_test,$(TESTS))
coverage: test
+sanitize: test
$(TESTROOT)/created:
$(VQ)echo " MKDIR: $(TESTROOT)"
--
NetSurf Browser
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org