add DTRACE_OPTS and HOST_DTRACE_OPTS to allow disabling various optimizations

that interfere with using dtrace.  use them when MKDTRACE=yes.
This commit is contained in:
chs 2018-02-25 18:53:23 +00:00
parent 9f52f2295e
commit 3084abc1e1
2 changed files with 14 additions and 6 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: bsd.host.mk,v 1.3 2016/02/20 15:18:46 christos Exp $
# $NetBSD: bsd.host.mk,v 1.4 2018/02/25 18:53:23 chs Exp $
.if !defined(_BSD_HOST_MK_)
_BSD_HOST_MK_=1
@ -9,11 +9,16 @@ HOST_DBG?= -g
HOST_DBG?= -O
.endif
.if ${MKDTRACE:Uno} != "no"
# disable compiler options that interfere with dtrace
HOST_DTRACE_OPTS?= -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-ipa-sra
.endif
# Helpers for cross-compiling
HOST_CC?= cc
HOST_CFLAGS?= ${HOST_DBG}
HOST_COMPILE.c?=${HOST_CC} ${HOST_CFLAGS} ${HOST_CPPFLAGS} -c
HOST_COMPILE.cc?= ${HOST_CXX} ${HOST_CXXFLAGS} ${HOST_CPPFLAGS} -c
HOST_COMPILE.c?=${HOST_CC} ${HOST_CFLAGS} ${HOST_DTRACE_OPTS} ${HOST_CPPFLAGS} -c
HOST_COMPILE.cc?= ${HOST_CXX} ${HOST_CXXFLAGS} ${HOST_DTRACE_OPTS} ${HOST_CPPFLAGS} -c
HOST_LINK.cc?= ${HOST_CXX} ${HOST_CXXFLAGS} ${HOST_CPPFLAGS} ${HOST_LDFLAGS}
.if defined(HOSTPROG_CXX)
HOST_LINK.c?= ${HOST_LINK.cc}

View File

@ -1,4 +1,4 @@
# $NetBSD: sys.mk,v 1.129 2016/03/30 17:35:43 martin Exp $
# $NetBSD: sys.mk,v 1.130 2018/02/25 18:53:23 chs Exp $
# @(#)sys.mk 8.2 (Berkeley) 3/21/94
#
# This file contains the basic rules for make(1) and is read first
@ -37,9 +37,12 @@ DBG?= -O2 ${"${.TARGET:M*.po}" == "":? -fomit-frame-pointer:}
.else
DBG?= -O2
.endif
.if ${MKDTRACE:Uno} != "no"
DTRACE_OPTS?= -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-ipa-sra -fno-ipa-icf
.endif
CFLAGS?= ${DBG}
LDFLAGS?=
COMPILE.c?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
COMPILE.c?= ${CC} ${CFLAGS} ${DTRACE_OPTS} ${CPPFLAGS} -c
LINK.c?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
# C Type Format data is required for DTrace
@ -55,7 +58,7 @@ __ALLSRC3= ${empty(NETBSDSRCDIR):?${__ALLSRC2}:${__ALLSRC2:S|^${NETBSDSRCDIR}|^s
__BUILDSEED= ${BUILDSEED}/${__ALLSRC3:O}/${.TARGET}
_CXXSEED?= ${BUILDSEED:D-frandom-seed=${__BUILDSEED:hash}}
COMPILE.cc?= ${CXX} ${_CXXSEED} ${CXXFLAGS} ${CPPFLAGS} -c
COMPILE.cc?= ${CXX} ${_CXXSEED} ${CXXFLAGS} ${DTRACE_OPTS} ${CPPFLAGS} -c
LINK.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
OBJC?= ${CC}