Source-Changes-HG archive

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

[src/trunk]: src/sys/conf Add -fstack-usage to kernel builds. Produces .su fi...



details:   https://anonhg.NetBSD.org/src/rev/3d6ab1c4701f
branches:  trunk
changeset: 934720:3d6ab1c4701f
user:      simonb <simonb%NetBSD.org@localhost>
date:      Wed Jun 17 02:40:43 2020 +0000

description:
Add -fstack-usage to kernel builds. Produces .su files that can be
analysed to find large stack users.

diffstat:

 sys/conf/Makefile.kern.inc |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r 7a08cf72894b -r 3d6ab1c4701f sys/conf/Makefile.kern.inc
--- a/sys/conf/Makefile.kern.inc        Wed Jun 17 00:16:21 2020 +0000
+++ b/sys/conf/Makefile.kern.inc        Wed Jun 17 02:40:43 2020 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.kern.inc,v 1.270 2020/05/21 18:44:19 christos Exp $
+#      $NetBSD: Makefile.kern.inc,v 1.271 2020/06/17 02:40:43 simonb Exp $
 #
 # This file contains common `MI' targets and definitions and it is included
 # at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}.
@@ -104,6 +104,9 @@
 CFLAGS+=       ${${ACTIVE_CC} == "gcc":? -fno-delete-null-pointer-checks :}
 CFLAGS+=       ${DEBUG} ${COPTS}
 AFLAGS+=       -D_LOCORE -Wa,--fatal-warnings
+# example usage to find largest stack users in kernel compile directory:
+#    find . -name \*.su | xargs awk '{ printf "%6d %s\n", $2, $1 }' | sort -n
+CFLAGS+=       -fstack-usage
 
 # XXX
 .if defined(HAVE_GCC) || defined(HAVE_LLVM)
@@ -338,8 +341,8 @@
 .if !target(__CLEANKERNEL)
 __CLEANKERNEL: .USE
        ${_MKMSG} "${.TARGET}ing the kernel objects"
-       rm -f ${KERNELS} *.map eddep tags *.[io] *.ko *.ln [a-z]*.s vers.c \
-           [Ee]rrs linterrs makelinks assym.h.tmp assym.h \
+       rm -f ${KERNELS} *.map *.[io] *.ko *.ln [a-z]*.s *.su vers.c \
+           eddep tags [Ee]rrs linterrs makelinks assym.h.tmp assym.h \
            ${EXTRA_KERNELS} ${EXTRA_CLEAN}
 .endif
 



Home | Main Index | Thread Index | Old Index