Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/share/mk Disgusting and evil hack to elide coverity options ...



details:   https://anonhg.NetBSD.org/src/rev/1649c0daddc7
branches:  trunk
changeset: 829223:1649c0daddc7
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Jan 22 17:33:01 2018 +0000

description:
Disgusting and evil hack to elide coverity options that break production
of coverity output when present [userland portion]

    - --sysroot
    - -fstack-protector
    - -std=gnu99
    - --nostdinc
    - -fPIE

The critical one here being --sysroot because this means that we need to
use the actual system headers while building (or chroot/sandbox appropriately)

diffstat:

 share/mk/bsd.own.mk |  23 +++++++++++++++++++----
 share/mk/bsd.sys.mk |   7 ++++++-
 2 files changed, 25 insertions(+), 5 deletions(-)

diffs (107 lines):

diff -r 3f531ef1c7cb -r 1649c0daddc7 share/mk/bsd.own.mk
--- a/share/mk/bsd.own.mk       Mon Jan 22 15:05:27 2018 +0000
+++ b/share/mk/bsd.own.mk       Mon Jan 22 17:33:01 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.own.mk,v 1.1026 2018/01/07 20:59:25 jmcneill Exp $
+#      $NetBSD: bsd.own.mk,v 1.1027 2018/01/22 17:33:01 christos Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -116,7 +116,9 @@
 HAVE_LIBGCC_EH?=       yes
 .endif
 
-.if ${MACHINE} == "alpha" || \
+# Coverity does not like SSP
+.if defined(COVERITY_TOP_CONFIG) || \
+    ${MACHINE} == "alpha" || \
     ${MACHINE} == "hppa" || \
     ${MACHINE} == "ia64" || \
     ${MACHINE_CPU} == "mips"
@@ -310,12 +312,17 @@
 #
 DESTDIR?=
 
+# Coverity does not like --sysroot
 .if !defined(HOSTPROG) && !defined(HOSTLIB)
 .  if ${DESTDIR} != ""
+.      if !defined(COVERITY_TOP_CONFIG)
 CPPFLAGS+=     --sysroot=${DESTDIR}
+.      endif
 LDFLAGS+=      --sysroot=${DESTDIR}
 .  else
+.      if !defined(COVERITY_TOP_CONFIG)
 CPPFLAGS+=     --sysroot=/
+.      endif
 LDFLAGS+=      --sysroot=/
 .  endif
 .endif
@@ -995,13 +1002,15 @@
 #
 # PIE is enabled on many platforms by default.
 #
-.if ${MACHINE_ARCH} == "i386" || \
+# Coverity does not like PIE
+.if !defined(COVERITY_TOP_CONFIG) && \
+    (${MACHINE_ARCH} == "i386" || \
     ${MACHINE_ARCH} == "x86_64" || \
     ${MACHINE_CPU} == "arm" || \
     ${MACHINE_CPU} == "m68k" || \
     ${MACHINE_CPU} == "mips" || \
     ${MACHINE_CPU} == "sh3" || \
-    ${MACHINE} == "sparc64"
+    ${MACHINE} == "sparc64")
 MKPIE?=                yes
 .else
 MKPIE?=                no
@@ -1073,6 +1082,12 @@
 MKRUMP=                no
 .endif
 
+# RUMP uses -nostdinc which coverity does not like
+# It also does not use many new files, so disable it
+.if defined(COVERITY_TOP_CONFIG)
+MKRUMP=                no
+.endif
+
 #
 # Build a dynamically linked /bin and /sbin, with the necessary shared
 # libraries moved from /usr/lib to /lib and the shared linker moved
diff -r 3f531ef1c7cb -r 1649c0daddc7 share/mk/bsd.sys.mk
--- a/share/mk/bsd.sys.mk       Mon Jan 22 15:05:27 2018 +0000
+++ b/share/mk/bsd.sys.mk       Mon Jan 22 17:33:01 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.sys.mk,v 1.272 2017/08/01 21:50:36 mrg Exp $
+#      $NetBSD: bsd.sys.mk,v 1.273 2018/01/22 17:33:01 christos Exp $
 #
 # Build definitions used for NetBSD source tree builds.
 
@@ -38,9 +38,12 @@
 .endif
 
 # NetBSD sources use C99 style, with some GCC extensions.
+# Coverity does not like -std=gnu99
+.if !defined(COVERITY_TOP_CONFIG)
 CFLAGS+=       ${${ACTIVE_CC} == "clang":? -std=gnu99 :}
 CFLAGS+=       ${${ACTIVE_CC} == "gcc":? -std=gnu99 :}
 CFLAGS+=       ${${ACTIVE_CC} == "pcc":? -std=gnu99 :}
+.endif
 
 .if defined(WARNS)
 CFLAGS+=       ${${ACTIVE_CC} == "clang":? -Wno-sign-compare -Wno-pointer-sign :}
@@ -134,6 +137,7 @@
 .if !defined(KERNSRCDIR) && !defined(KERN) # not for kernels nor kern modules
 CPPFLAGS+=     -D_FORTIFY_SOURCE=2
 .endif
+.   if !defined(COVERITY_TOP_CONFIG)
 COPTS+=        -fstack-protector -Wstack-protector 
 
 # GCC 4.8 on m68k erroneously does not protect functions with
@@ -154,6 +158,7 @@
 
 COPTS+=        ${${ACTIVE_CC} == "clang":? --param ssp-buffer-size=1 :}
 COPTS+=        ${${ACTIVE_CC} == "gcc":? --param ssp-buffer-size=1 :}
+.    endif
 .endif
 
 .if ${MKSOFTFLOAT:Uno} != "no"



Home | Main Index | Thread Index | Old Index