summaryrefslogtreecommitdiff
path: root/coreconf/Linux.mk
diff options
context:
space:
mode:
authorJed Davis <jld@mozilla.com>2016-02-27 14:05:04 -0800
committerJed Davis <jld@mozilla.com>2016-02-27 14:05:04 -0800
commit811ab1ca4c2ebddf3f79d4c63199e8c9aa44c8d0 (patch)
tree349330006517830f3087968a070c6fba48583fe4 /coreconf/Linux.mk
parentea083b0c8c0d62b88324b76c66c7cda78289843d (diff)
downloadnss-hg-811ab1ca4c2ebddf3f79d4c63199e8c9aa44c8d0.tar.gz
Bug 1233568: Add support for building with Address Sanitizer. r=wtc.
This is controlled by setting USE_ASAN=1 when building. Like the other build flags, it must also be set while testing.
Diffstat (limited to 'coreconf/Linux.mk')
-rw-r--r--coreconf/Linux.mk6
1 files changed, 6 insertions, 0 deletions
diff --git a/coreconf/Linux.mk b/coreconf/Linux.mk
index b61a261d6..c3ae5b651 100644
--- a/coreconf/Linux.mk
+++ b/coreconf/Linux.mk
@@ -153,8 +153,12 @@ DSO_LDOPTS = -shared $(ARCHFLAG) -Wl,--gc-sections
# The linker on Red Hat Linux 7.2 and RHEL 2.1 (GNU ld version 2.11.90.0.8)
# incorrectly reports undefined references in the libraries we link with, so
# we don't use -z defs there.
+# Also, -z defs conflicts with Address Sanitizer, which emits relocations
+# against the libsanitizer runtime built into the main executable.
ZDEFS_FLAG = -Wl,-z,defs
+ifneq ($(USE_ASAN),1)
DSO_LDOPTS += $(if $(findstring 2.11.90.0.8,$(shell ld -v)),,$(ZDEFS_FLAG))
+endif
LDFLAGS += $(ARCHFLAG)
# On Maemo, we need to use the -rpath-link flag for even the standard system
@@ -210,3 +214,5 @@ PROCESS_MAP_FILE = grep -v ';-' $< | \
ifeq ($(OS_RELEASE),2.4)
DEFINES += -DNO_FORK_CHECK
endif
+
+include $(CORE_DEPTH)/coreconf/sanitizers.mk