linux/scripts
Rasmus Villemoes 56d4a38146 scripts: add stackusage script
The current checkstack.pl script has a few problems, stemming from the
overly simplistic attempt at parsing objdump output with regular
expressions: For example, on x86_64 it doesn't take the push
instruction into account, making it consistently underestimate the
real stack use, and it also doesn't capture stack pointer adjustments
of exactly 128 bytes [1].

Since newer gcc (>= 4.6) knows about -fstack-usage, we might as well
take the information straight from the horse's mouth. This patch
introduces scripts/stackusage, which is a simple wrapper for running
make with KCFLAGS set to -fstack-usage. Example use is

scripts/stackusage -o out.su -j8 lib/

The script understands "-o foo" for writing to 'foo' and -h for a
trivial help text; anything else is passed to make.

Afterwards, we find all newly created .su files, massage them a
little, sort by stack use and write the result to a single output
file.

Note that the function names printed by (at least) gcc 4.7 are
sometimes useless. For example, the first three lines of out.su
generated above are

./lib/decompress_bunzip2.c:155  get_next_block  448     static
./lib/decompress_unlzma.c:537   unlzma  336     static
./lib/vsprintf.c:616    8       304     static

That function '8' is really the static symbol_string(), but it has
been subject to 'interprocedural scalar replacement of aggregates', so
its name in the object file is 'symbol_string.isra.8'. gcc 5.0 doesn't
have this problem; it uses the full name as seen in the object file.

[1] Since gcc encodes that by

48 83 c4 80             add    $0xffffffffffffff80,%rsp

and not

48 81 ec 80 00 00 00    sub    $0x80,%rsp

since -128 fits in an imm8.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Michal Marek <mmarek@suse.com>
2015-08-28 17:04:40 +02:00
..
basic kernel: build bin2c based on config option CONFIG_BUILD_BIN2C 2014-08-08 15:57:32 -07:00
coccinelle coccinelle: api: extend spatch for dropping unnecessary owner 2015-08-19 17:23:45 +02:00
dtc kbuild: trivial - remove trailing empty lines 2014-06-10 00:04:06 +02:00
gdb scripts/gdb: add empty package initialization script 2015-02-28 09:57:51 -08:00
genksyms genksyms: fix typeof() handling 2014-04-03 16:20:52 -07:00
kconfig kconfig: Do not print status messages in make -s mode 2015-04-09 17:44:34 +02:00
ksymoops
mod Quentin opened a can of worms by adding extable entry checking to modpost, 2015-04-22 09:49:24 -07:00
package kbuild: avoid listing /lib/modules in kernel spec file 2015-08-26 11:26:35 +02:00
rt-tester kbuild: Make scripts executable 2014-08-20 16:03:45 +02:00
selinux kbuild: Make scripts executable 2014-08-20 16:03:45 +02:00
tracing kbuild: Make scripts executable 2014-08-20 16:03:45 +02:00
.gitignore bin2c: move bin2c in scripts/basic 2014-08-08 15:57:32 -07:00
analyze_suspend.py PM / tools: analyze_suspend.py: update to v3.0 2014-08-09 02:47:58 +02:00
asn1_compiler.c X.509: silence asn1 compiler debug output 2015-01-23 12:10:39 +00:00
bloat-o-meter bloat-o-meter: Ignore syscall aliases SyS_ and compat_SyS_ 2014-08-23 13:08:48 -07:00
bootgraph.pl kbuild: Make scripts executable 2014-08-20 16:03:45 +02:00
check_extable.sh scripts: add check_extable.sh script. 2015-04-13 21:03:02 +09:30
checkincludes.pl
checkkconfigsymbols.py checkkconfigsymbols.py: fix sorted output 2015-03-24 15:18:44 +01:00
checkpatch.pl checkpatch: avoid "spaces required around that ':'" false positive 2015-04-17 09:03:59 -04:00
checkstack.pl Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2014-10-07 21:16:26 -04:00
checksyscalls.sh scripts/checksyscalls.sh: Make renameat optional 2014-05-20 10:59:38 +02:00
checkversion.pl
cleanfile
cleanpatch
coccicheck Coccinelle: Update information about the minimal version required 2013-07-03 22:58:20 +02:00
config kbuild: trivial - remove trailing empty lines 2014-06-10 00:04:06 +02:00
conmakehash.c kbuild: trivial - remove trailing spaces 2014-04-30 17:34:32 +02:00
decode_stacktrace.sh decode_stacktrace: make stack dump output useful again 2014-06-10 15:29:43 -07:00
decodecode scripts/decodecode: make faulting insn ptr more robust 2013-04-29 15:54:27 -07:00
depmod.sh depmod: pass -P $CONFIG_SYMBOL_PREFIX 2013-02-22 11:52:31 +01:00
diffconfig vfs,ext2: remove CONFIG_EXT2_FS_XIP and rename CONFIG_FS_XIP to CONFIG_FS_DAX 2015-02-16 17:56:04 -08:00
docproc.c kbuild: trivial - use tabs for code indent where possible 2014-06-10 14:00:53 +02:00
export_report.pl kbuild: Make scripts executable 2014-08-20 16:03:45 +02:00
extract-ikconfig scripts/extract-ikconfig: Support LZ4-compressed images. 2015-04-15 14:01:12 +02:00
extract-vmlinux
gcc-goto.sh kbuild: Make scripts executable 2014-08-20 16:03:45 +02:00
gcc-ld kbuild: Make scripts executable 2014-08-20 16:03:45 +02:00
gcc-version.sh kbuild: Make scripts executable 2014-08-20 16:03:45 +02:00
gcc-x86_32-has-stack-protector.sh kbuild: Make scripts executable 2014-08-20 16:03:45 +02:00
gcc-x86_64-has-stack-protector.sh kbuild: Make scripts executable 2014-08-20 16:03:45 +02:00
gen_initramfs_list.sh kbuild: Make scripts executable 2014-08-20 16:03:45 +02:00
get_maintainer.pl scripts: Teach get_maintainer.pl about the new "R:" tag 2014-07-08 14:47:17 -07:00
gfp-translate chmod +x scripts/gfp-translate 2012-06-27 12:44:29 -07:00
headerdep.pl
headers_check.pl kbuild: Make scripts executable 2014-08-20 16:03:45 +02:00
headers_install.sh Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild 2014-10-14 09:22:26 +02:00
headers.sh CRIS: Fix headers_install 2014-12-20 00:01:12 +01:00
kallsyms.c Kbuild: kallsyms: drop special handling of pre-3.0 GCC symbols 2015-04-07 13:04:51 +02:00
Kbuild.include kbuild: allow cc-ifversion to have the argument for false condition 2015-01-09 17:25:44 +01:00
kernel-doc scripts/kernel-doc: don't eat struct members with __aligned 2014-12-10 17:41:02 -08:00
ld-version.sh Kbuild, lto: add ld-version and ld-ifversion macros 2014-02-13 20:25:00 -08:00
Lindent
link-vmlinux.sh kbuild: Make scripts executable 2014-08-20 16:03:45 +02:00
Makefile scripts/gdb: add infrastructure 2015-02-17 14:34:53 -08:00
Makefile.asm-generic kbuild: trivial - remove trailing empty lines 2014-06-10 00:04:06 +02:00
Makefile.build ftrace: allow architectures to specify ftrace compile options 2015-01-29 09:19:19 +01:00
Makefile.clean Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild 2015-02-19 10:07:08 -08:00
Makefile.dtbinst kbuild: include $(src)/Makefile rather than $(obj)/Makefile 2015-04-02 16:42:08 +02:00
Makefile.extrawarn kbuild, LLVMLinux: Supress warnings unless W=1-3 2014-08-05 15:40:01 +02:00
Makefile.fwinst kbuild: include $(src)/Makefile rather than $(obj)/Makefile 2015-04-02 16:42:08 +02:00
Makefile.headersinst kbuild: collect shorthands into scripts/Kbuild.include 2014-11-26 14:36:52 +01:00
Makefile.help
Makefile.host kbuild: handle the dependency of multi-objs hostprogs appropriately 2014-08-19 10:26:20 +02:00
Makefile.kasan kasan: Makefile: shut up warnings if CONFIG_COMPILE_TEST=y 2015-04-17 09:03:59 -04:00
Makefile.lib kbuild: Create directory for target DTB 2015-04-03 13:52:28 -07:00
Makefile.modbuiltin
Makefile.modinst kbuild: handle module compression while running 'make modules_install'. 2014-08-27 21:54:12 +09:30
Makefile.modpost modpost: Optionally ignore secondary errors seen if a single module build fails 2013-09-23 15:45:03 +09:30
Makefile.modsign modsign: lookup lines ending in .ko in .mod files 2014-08-27 21:54:11 +09:30
makelst
markup_oops.pl kbuild: Make scripts executable 2014-08-20 16:03:45 +02:00
mkcompile_h kbuild: trivial - remove trailing spaces 2014-04-30 17:34:32 +02:00
mkmakefile kbuild: Make scripts executable 2014-08-20 16:03:45 +02:00
mksysmap kbuild: Make scripts executable 2014-08-20 16:03:45 +02:00
mkuboot.sh
mkversion
module-common.lds kernel: add support for .init_array.* constructors 2015-02-13 21:21:42 -08:00
namespace.pl
objdiff scripts: objdiff: support directories for the augument of record command 2014-06-10 14:59:33 +02:00
patch-kernel kbuild: trivial - remove trailing spaces 2014-04-30 17:34:32 +02:00
pnmtologo.c kbuild: trivial - remove trailing empty lines 2014-06-10 00:04:06 +02:00
profile2linkerlist.pl kbuild: Make scripts executable 2014-08-20 16:03:45 +02:00
recordmcount.c s390/ftrace,kprobes: allow to patch first instruction 2014-10-27 13:27:27 +01:00
recordmcount.h recordmcount/MIPS: Fix possible incorrect mcount_loc table entries in modules 2014-06-26 10:48:19 +01:00
recordmcount.pl Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2015-02-11 17:42:32 -08:00
setlocalversion Fix detectition of kernel git repository in setlocalversion script [take #2] 2014-01-03 14:48:42 +01:00
show_delta kbuild: trivial - remove trailing empty lines 2014-06-10 00:04:06 +02:00
sign-file treewide: fix errors in printk 2014-09-01 11:18:25 +02:00
sortextable.c xtensa: enable sorting extable at build time 2014-04-02 01:35:50 +04:00
sortextable.h scripts/sortextable: suppress warning: `relocs_size' may be used uninitialized 2014-10-14 02:18:23 +02:00
spelling.txt checkpatch: spell check reudce 2015-04-17 09:03:56 -04:00
stackusage scripts: add stackusage script 2015-08-28 17:04:40 +02:00
tags.sh scripts/tags.sh: Include trace_*_rcuidle() in tags 2015-08-19 15:26:30 +02:00
unifdef.c
ver_linux
xen-hypercalls.sh xen: build infrastructure for generating hypercall depending symbols 2015-03-16 14:49:13 +00:00
xz_wrap.sh kbuild: Make scripts executable 2014-08-20 16:03:45 +02:00