Bug 1419607 Specify -fno-common for ASAN builds r?tsmith,glandium draft
authorTom Ritter <tom@mozilla.com>
Tue, 16 Jan 2018 08:00:31 -0600
changeset 720906 94b46f4cfda11b5d8be2fa32287fbd939d8fe949
parent 720751 685eb99b7deaa7bba4d65a77c237d93e4ddff77a
child 746187 3adea8dcae9ddf4e5d38ca201cc9f0d084ab4d3a
push id95681
push userbmo:tom@mozilla.com
push dateTue, 16 Jan 2018 14:01:57 +0000
reviewerstsmith, glandium
bugs1419607
milestone59.0a1
Bug 1419607 Specify -fno-common for ASAN builds r?tsmith,glandium MozReview-Commit-ID: JCXLNeQkGpq
build/moz.configure/toolchain.configure
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -1339,16 +1339,21 @@ def security_hardening_cflags(hardening_
         js_flags.append("-U_FORTIFY_SOURCE")
 
     # fstack-protector ------------------------------------
     # Enable only if --enable-hardening is passed and ASAN is
     # not on as ASAN will catch the crashes for us
     if hardening_flag and compiler_is_gccish and not asan:
         flags.append("-fstack-protector-strong")
 
+    # fno-common -----------------------------------------
+    # Do not merge variables for ASAN; can detect some subtle bugs
+    if asan:
+        flags.append("-fno-common")
+
     return namespace(
         flags=flags,
         js_flags=js_flags,
     )
 
 
 add_old_configure_assignment('MOZ_HARDENING_CFLAGS', security_hardening_cflags.flags)
 add_old_configure_assignment('MOZ_HARDENING_CFLAGS_JS', security_hardening_cflags.js_flags)