Gitweb links:
...log
http://git.netsurf-browser.org/buildsystem.git/shortlog/f2720449b3ede0299da61dfaff9fce6b8db78f75
...commit
http://git.netsurf-browser.org/buildsystem.git/commit/f2720449b3ede0299da61dfaff9fce6b8db78f75
...tree
http://git.netsurf-browser.org/buildsystem.git/tree/f2720449b3ede0299da61dfaff9fce6b8db78f75
The branch, master has been updated
via f2720449b3ede0299da61dfaff9fce6b8db78f75 (commit)
from 0d348add42028c233efead8ea6ce45503fe29c35 (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/buildsystem.git/commit/?id=f2720449b3ede0299da61dfaff9fce6b8db78f75
commit f2720449b3ede0299da61dfaff9fce6b8db78f75
Author: Daniel Silverstone <[email protected]>
Commit: Daniel Silverstone <[email protected]>
Enable sanitize target for new gccs and clang
diff --git a/makefiles/Makefile.clang b/makefiles/Makefile.clang
index 4006a92..2a11a5b 100644
--- a/makefiles/Makefile.clang
+++ b/makefiles/Makefile.clang
@@ -28,6 +28,17 @@ ARFLG := cru
# Definitions of various attributes
CFLAGS := $(CFLAGS) -D_ALIGNED="__attribute__((aligned))"
+# Extensions for sanitize target
+ifeq ($(MAKECMDGOALS),sanitize)
+ SANCFLAGS ?= -fsanitize=address -fsanitize=undefined -fno-sanitize-recover
+ SANCXXFLAGS ?= -fsanitize=address -fsanitize=undefined -fno-sanitize-recover
+ SANLDFLAGS ?= -fsanitize=address -fsanitize=undefined -fno-sanitize-recover
+
+ CFLAGS := $(CFLAGS) $(SANCFLAGS)
+ CXXFLAGS := $(CXXFLAGS) $(SANCXXFLAGS)
+ LDFLAGS := $(LDFLAGS) $(SANLDFLAGS)
+endif
+
###############################################################################
# Mac OS X Universal Binaries
###############################################################################
diff --git a/makefiles/Makefile.gcc b/makefiles/Makefile.gcc
index 5f2bd4d..6ca7ba1 100644
--- a/makefiles/Makefile.gcc
+++ b/makefiles/Makefile.gcc
@@ -49,6 +49,17 @@ ifeq ($(MAKECMDGOALS),profile)
LDFLAGS := $(LDFLAGS) $(PROFLDFLAGS)
endif
+# Extensions for sanitize target
+ifeq ($(MAKECMDGOALS),sanitize)
+ SANCFLAGS ?= -fsanitize=address -fsanitize=undefined -fno-sanitize-recover
+ SANCXXFLAGS ?= -fsanitize=address -fsanitize=undefined -fno-sanitize-recover
+ SANLDFLAGS ?= -fsanitize=address -fsanitize=undefined -fno-sanitize-recover
+
+ CFLAGS := $(CFLAGS) $(SANCFLAGS)
+ CXXFLAGS := $(CXXFLAGS) $(SANCXXFLAGS)
+ LDFLAGS := $(LDFLAGS) $(SANLDFLAGS)
+endif
+
# RISC OS module extensions
ifeq ($(COMPONENT_TYPE),riscos-module)
ifneq ($(HOST),arm-unknown-riscos)
diff --git a/makefiles/Makefile.tools b/makefiles/Makefile.tools
index 86fac4c..33d6add 100644
--- a/makefiles/Makefile.tools
+++ b/makefiles/Makefile.tools
@@ -399,6 +399,25 @@ ifeq ($(toolchain),)
$(error Unable to detect toolchain)
endif
+# Detect if the toolchain ought to support sanitizers
+SANITIZE_OK=no
+ifeq ($(toolchain),gcc)
+ GCC_VERSION := $(shell $(CC) -dumpversion)
+ GCC_MAJOR := $(word 1,$(subst ., ,$(GCC_VERSION)))
+ ifeq ($(shell expr $(GCC_MAJOR) \>= 6),1)
+ SANITIZE_OK=yes
+ endif
+else ifeq ($(toolchain),clang)
+ SANITIZE_OK=yes
+endif
+
+# And fail if we can't sanitize and yet the user asked for it
+ifeq ($(MAKECMDGOALS),sanitize)
+ ifeq ($(SANITIZE_OK),no)
+ $(error Unable to build with sanitizers enabled, compiler not compatible
+ endif
+endif
+
# TODO: It would be nice to avoid this hard-coded path
include $(NSBUILD)/Makefile.$(toolchain)
diff --git a/makefiles/Makefile.top b/makefiles/Makefile.top
index 9d3c680..caac166 100644
--- a/makefiles/Makefile.top
+++ b/makefiles/Makefile.top
@@ -48,6 +48,7 @@
# test Build and run test suite, using current settings.
# coverage Determine test suite coverage (requires lcov)
# profile Build with profiling support enabled (requires gprof)
+# sanitize Build and run test suite, using ASAN and UBSAN
# docs Produce documentation (requires doxygen)
# dist Produce release tarball from latest git tag
# clean Clean the build
@@ -123,6 +124,8 @@ else ifeq ($(MAKECMDGOALS),profile)
WANT_TEST := yes
else ifeq ($(MAKECMDGOALS),coverage)
WANT_TEST := yes
+else ifeq ($(MAKECMDGOALS),sanitize)
+ WANT_TEST := yes
else
WANT_TEST := no
endif
@@ -231,6 +234,9 @@ coverage: __precov test
$(Q)$(GENHTML) -o $(COVERAGEDIR) --num-spaces 2 \
$(COVERAGEDIR)/$(COMPONENT).info
+# Build and test sanitizers
+sanitize: test
+
# Build for profiling
profile: __partial_clean test
-----------------------------------------------------------------------
Summary of changes:
makefiles/Makefile.clang | 11 +++++++++++
makefiles/Makefile.gcc | 11 +++++++++++
makefiles/Makefile.tools | 19 +++++++++++++++++++
makefiles/Makefile.top | 6 ++++++
4 files changed, 47 insertions(+)
diff --git a/makefiles/Makefile.clang b/makefiles/Makefile.clang
index 4006a92..2a11a5b 100644
--- a/makefiles/Makefile.clang
+++ b/makefiles/Makefile.clang
@@ -28,6 +28,17 @@ ARFLG := cru
# Definitions of various attributes
CFLAGS := $(CFLAGS) -D_ALIGNED="__attribute__((aligned))"
+# Extensions for sanitize target
+ifeq ($(MAKECMDGOALS),sanitize)
+ SANCFLAGS ?= -fsanitize=address -fsanitize=undefined -fno-sanitize-recover
+ SANCXXFLAGS ?= -fsanitize=address -fsanitize=undefined -fno-sanitize-recover
+ SANLDFLAGS ?= -fsanitize=address -fsanitize=undefined -fno-sanitize-recover
+
+ CFLAGS := $(CFLAGS) $(SANCFLAGS)
+ CXXFLAGS := $(CXXFLAGS) $(SANCXXFLAGS)
+ LDFLAGS := $(LDFLAGS) $(SANLDFLAGS)
+endif
+
###############################################################################
# Mac OS X Universal Binaries
###############################################################################
diff --git a/makefiles/Makefile.gcc b/makefiles/Makefile.gcc
index 5f2bd4d..6ca7ba1 100644
--- a/makefiles/Makefile.gcc
+++ b/makefiles/Makefile.gcc
@@ -49,6 +49,17 @@ ifeq ($(MAKECMDGOALS),profile)
LDFLAGS := $(LDFLAGS) $(PROFLDFLAGS)
endif
+# Extensions for sanitize target
+ifeq ($(MAKECMDGOALS),sanitize)
+ SANCFLAGS ?= -fsanitize=address -fsanitize=undefined -fno-sanitize-recover
+ SANCXXFLAGS ?= -fsanitize=address -fsanitize=undefined -fno-sanitize-recover
+ SANLDFLAGS ?= -fsanitize=address -fsanitize=undefined -fno-sanitize-recover
+
+ CFLAGS := $(CFLAGS) $(SANCFLAGS)
+ CXXFLAGS := $(CXXFLAGS) $(SANCXXFLAGS)
+ LDFLAGS := $(LDFLAGS) $(SANLDFLAGS)
+endif
+
# RISC OS module extensions
ifeq ($(COMPONENT_TYPE),riscos-module)
ifneq ($(HOST),arm-unknown-riscos)
diff --git a/makefiles/Makefile.tools b/makefiles/Makefile.tools
index 86fac4c..33d6add 100644
--- a/makefiles/Makefile.tools
+++ b/makefiles/Makefile.tools
@@ -399,6 +399,25 @@ ifeq ($(toolchain),)
$(error Unable to detect toolchain)
endif
+# Detect if the toolchain ought to support sanitizers
+SANITIZE_OK=no
+ifeq ($(toolchain),gcc)
+ GCC_VERSION := $(shell $(CC) -dumpversion)
+ GCC_MAJOR := $(word 1,$(subst ., ,$(GCC_VERSION)))
+ ifeq ($(shell expr $(GCC_MAJOR) \>= 6),1)
+ SANITIZE_OK=yes
+ endif
+else ifeq ($(toolchain),clang)
+ SANITIZE_OK=yes
+endif
+
+# And fail if we can't sanitize and yet the user asked for it
+ifeq ($(MAKECMDGOALS),sanitize)
+ ifeq ($(SANITIZE_OK),no)
+ $(error Unable to build with sanitizers enabled, compiler not compatible
+ endif
+endif
+
# TODO: It would be nice to avoid this hard-coded path
include $(NSBUILD)/Makefile.$(toolchain)
diff --git a/makefiles/Makefile.top b/makefiles/Makefile.top
index 9d3c680..caac166 100644
--- a/makefiles/Makefile.top
+++ b/makefiles/Makefile.top
@@ -48,6 +48,7 @@
# test Build and run test suite, using current settings.
# coverage Determine test suite coverage (requires lcov)
# profile Build with profiling support enabled (requires gprof)
+# sanitize Build and run test suite, using ASAN and UBSAN
# docs Produce documentation (requires doxygen)
# dist Produce release tarball from latest git tag
# clean Clean the build
@@ -123,6 +124,8 @@ else ifeq ($(MAKECMDGOALS),profile)
WANT_TEST := yes
else ifeq ($(MAKECMDGOALS),coverage)
WANT_TEST := yes
+else ifeq ($(MAKECMDGOALS),sanitize)
+ WANT_TEST := yes
else
WANT_TEST := no
endif
@@ -231,6 +234,9 @@ coverage: __precov test
$(Q)$(GENHTML) -o $(COVERAGEDIR) --num-spaces 2 \
$(COVERAGEDIR)/$(COMPONENT).info
+# Build and test sanitizers
+sanitize: test
+
# Build for profiling
profile: __partial_clean test
--
NetSurf Project build system
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org