Module Name: src Committed By: christos Date: Mon Jan 22 17:33:01 UTC 2018
Modified Files: src/share/mk: bsd.own.mk bsd.sys.mk Log Message: 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) To generate a diff of this commit: cvs rdiff -u -r1.1026 -r1.1027 src/share/mk/bsd.own.mk cvs rdiff -u -r1.272 -r1.273 src/share/mk/bsd.sys.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/share/mk/bsd.own.mk diff -u src/share/mk/bsd.own.mk:1.1026 src/share/mk/bsd.own.mk:1.1027 --- src/share/mk/bsd.own.mk:1.1026 Sun Jan 7 15:59:25 2018 +++ src/share/mk/bsd.own.mk Mon Jan 22 12:33:01 2018 @@ -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?= no 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 @@ TOOL_CXX.pcc= ${TOOLDIR}/bin/${MACHINE_ # 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 @@ MKCTF?= yes # # 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 @@ MKKMOD= no 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 Index: src/share/mk/bsd.sys.mk diff -u src/share/mk/bsd.sys.mk:1.272 src/share/mk/bsd.sys.mk:1.273 --- src/share/mk/bsd.sys.mk:1.272 Tue Aug 1 17:50:36 2017 +++ src/share/mk/bsd.sys.mk Mon Jan 22 12:33:01 2018 @@ -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 @@ CXXFLAGS+= ${REPROFLAGS} .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 @@ LINTFLAGS+= ${DESTDIR:D-d ${DESTDIR}/usr .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+= -Wno-error=stack-protector COPTS+= ${${ACTIVE_CC} == "clang":? --param ssp-buffer-size=1 :} COPTS+= ${${ACTIVE_CC} == "gcc":? --param ssp-buffer-size=1 :} +. endif .endif .if ${MKSOFTFLOAT:Uno} != "no"