Skip to content

Commit

Permalink
Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/…
Browse files Browse the repository at this point in the history
…mmarek/kbuild

Pull misc kbuild changes from Michal Marek:
 "Here is the non-critical part of kbuild:
   - One bogus coccinelle check removed, one check fixed not to suggest
     the obsolete PTR_RET macro
   - scripts/tags.sh does not index the generated *.mod.c files
   - new objdiff tool to list differences between two versions of an
     object file
   - A fix for scripts/bootgraph.pl"

* 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
  scripts/coccinelle: Use PTR_ERR_OR_ZERO
  scripts/bootgraph.pl: Add graphic header
  scripts: objdiff: detect object code changes between two commits
  Coccicheck: Remove memcpy to struct assignment test
  scripts/tags.sh: Ignore *.mod.c
  • Loading branch information
torvalds committed Apr 13, 2014
2 parents fd1232b + f23a9fa commit 321d03c
Show file tree
Hide file tree
Showing 6 changed files with 196 additions and 120 deletions.
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -428,8 +428,9 @@ export MODVERDIR := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_ve

# Files to ignore in find ... statements

RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS \
-o -name .pc -o -name .hg -o -name .git \) -prune -o
export RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o \
-name CVS -o -name .pc -o -name .hg -o -name .git \) \
-prune -o
export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn \
--exclude CVS --exclude .pc --exclude .hg --exclude .git

Expand Down Expand Up @@ -1103,7 +1104,7 @@ CLEAN_DIRS += $(MODVERDIR)

# Directories & files removed with 'make mrproper'
MRPROPER_DIRS += include/config usr/include include/generated \
arch/*/include/generated
arch/*/include/generated .tmp_objdiff
MRPROPER_FILES += .config .config.old .version .old_version $(version_h) \
Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS \
signing_key.priv signing_key.x509 x509.genkey \
Expand Down
42 changes: 40 additions & 2 deletions scripts/bootgraph.pl
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,31 @@
#

use strict;
use Getopt::Long;
my $header = 0;

sub help {
my $text = << "EOM";
Usage:
1) dmesg | perl scripts/bootgraph.pl [OPTION] > output.svg
2) perl scripts/bootgraph.pl -h
Options:
-header Insert kernel version and date
EOM
my $std=shift;
if ($std == 1) {
print STDERR $text;
} else {
print $text;
}
exit;
}

GetOptions(
'h|help' =>\&help,
'header' =>\$header
);

my %start;
my %end;
Expand All @@ -49,6 +74,11 @@
my %pids;
my %pidctr;

my $headerstep = 20;
my $xheader = 15;
my $yheader = 25;
my $cyheader = 0;

while (<>) {
my $line = $_;
if ($line =~ /([0-9\.]+)\] calling ([a-zA-Z0-9\_\.]+)\+/) {
Expand Down Expand Up @@ -112,15 +142,23 @@
print STDERR <<END;
No data found in the dmesg. Make sure that 'printk.time=1' and
'initcall_debug' are passed on the kernel command line.
Usage:
dmesg | perl scripts/bootgraph.pl > output.svg
END
help(1);
exit 1;
}

print "<?xml version=\"1.0\" standalone=\"no\"?> \n";
print "<svg width=\"2000\" height=\"100%\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n";


if ($header) {
my $version = `uname -a`;
my $date = `date`;
print "<text transform=\"translate($xheader,$yheader)\">Kernel version: $version</text>\n";
$cyheader = $yheader+$headerstep;
print "<text transform=\"translate($xheader,$cyheader)\">Date: $date</text>\n";
}

my @styles;

$styles[0] = "fill:rgb(0,0,255);fill-opacity:0.5;stroke-width:1;stroke:rgb(0,0,0)";
Expand Down
14 changes: 7 additions & 7 deletions scripts/coccinelle/api/ptr_ret.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// URL: http://coccinelle.lip6.fr/
// Options: --no-includes --include-headers
//
// Keywords: ERR_PTR, PTR_ERR, PTR_RET, PTR_ERR_OR_ZERO
// Keywords: ERR_PTR, PTR_ERR, PTR_ERR_OR_ZERO
// Version min: 2.6.39
//

Expand Down Expand Up @@ -62,35 +62,35 @@ position p3;
p << r1.p1;
@@
coccilib.org.print_todo(p[0], "WARNING: PTR_RET can be used")
coccilib.org.print_todo(p[0], "WARNING: PTR_ERR_OR_ZERO can be used")
@script:python depends on org@
p << r2.p2;
@@
coccilib.org.print_todo(p[0], "WARNING: PTR_RET can be used")
coccilib.org.print_todo(p[0], "WARNING: PTR_ERR_OR_ZERO can be used")
@script:python depends on org@
p << r3.p3;
@@
coccilib.org.print_todo(p[0], "WARNING: PTR_RET can be used")
coccilib.org.print_todo(p[0], "WARNING: PTR_ERR_OR_ZERO can be used")
@script:python depends on report@
p << r1.p1;
@@
coccilib.report.print_report(p[0], "WARNING: PTR_RET can be used")
coccilib.report.print_report(p[0], "WARNING: PTR_ERR_OR_ZERO can be used")
@script:python depends on report@
p << r2.p2;
@@
coccilib.report.print_report(p[0], "WARNING: PTR_RET can be used")
coccilib.report.print_report(p[0], "WARNING: PTR_ERR_OR_ZERO can be used")
@script:python depends on report@
p << r3.p3;
@@
coccilib.report.print_report(p[0], "WARNING: PTR_RET can be used")
coccilib.report.print_report(p[0], "WARNING: PTR_ERR_OR_ZERO can be used")
103 changes: 0 additions & 103 deletions scripts/coccinelle/misc/memcpy-assign.cocci

This file was deleted.

141 changes: 141 additions & 0 deletions scripts/objdiff
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
#!/bin/bash

# objdiff - a small script for validating that a commit or series of commits
# didn't change object code.
#
# Copyright 2014, Jason Cooper <jason@lakedaemon.net>
#
# Licensed under the terms of the GNU GPL version 2

# usage example:
#
# $ git checkout COMMIT_A
# $ <your fancy build command here>
# $ ./scripts/objdiff record path/to/*.o
#
# $ git checkout COMMIT_B
# $ <your fancy build command here>
# $ ./scripts/objdiff record path/to/*.o
#
# $ ./scripts/objdiff diff COMMIT_A COMMIT_B
# $

# And to clean up (everything is in .tmp_objdiff/*)
# $ ./scripts/objdiff clean all
#
# Note: 'make mrproper' will also remove .tmp_objdiff

GIT_DIR="`git rev-parse --git-dir`"

if [ -d "$GIT_DIR" ]; then
TMPD="${GIT_DIR%git}tmp_objdiff"

[ -d "$TMPD" ] || mkdir "$TMPD"
else
echo "ERROR: git directory not found."
exit 1
fi

usage() {
echo "Usage: $0 <command> <args>"
echo " record <list of object files>"
echo " diff <commitA> <commitB>"
echo " clean all | <commit>"
exit 1
}

dorecord() {
[ $# -eq 0 ] && usage

FILES="$*"

CMT="`git rev-parse --short HEAD`"

OBJDUMP="${CROSS_COMPILE}objdump"
OBJDIFFD="$TMPD/$CMT"

[ ! -d "$OBJDIFFD" ] && mkdir -p "$OBJDIFFD"

for f in $FILES; do
dn="${f%/*}"
bn="${f##*/}"

[ ! -d "$OBJDIFFD/$dn" ] && mkdir -p "$OBJDIFFD/$dn"

# remove addresses for a more clear diff
# http://dummdida.tumblr.com/post/60924060451/binary-diff-between-libc-from-scientificlinux-and
$OBJDUMP -D "$f" | sed "s/^[[:space:]]\+[0-9a-f]\+//" \
>"$OBJDIFFD/$dn/$bn"
done
}

dodiff() {
[ $# -ne 2 ] && [ $# -ne 0 ] && usage

if [ $# -eq 0 ]; then
SRC="`git rev-parse --short HEAD^`"
DST="`git rev-parse --short HEAD`"
else
SRC="`git rev-parse --short $1`"
DST="`git rev-parse --short $2`"
fi

DIFF="`which colordiff`"

if [ ${#DIFF} -eq 0 ] || [ ! -x "$DIFF" ]; then
DIFF="`which diff`"
fi

SRCD="$TMPD/$SRC"
DSTD="$TMPD/$DST"

if [ ! -d "$SRCD" ]; then
echo "ERROR: $SRCD doesn't exist"
exit 1
fi

if [ ! -d "$DSTD" ]; then
echo "ERROR: $DSTD doesn't exist"
exit 1
fi

$DIFF -Nurd $SRCD $DSTD
}

doclean() {
[ $# -eq 0 ] && usage
[ $# -gt 1 ] && usage

if [ "x$1" = "xall" ]; then
rm -rf $TMPD/*
else
CMT="`git rev-parse --short $1`"

if [ -d "$TMPD/$CMT" ]; then
rm -rf $TMPD/$CMT
else
echo "$CMT not found"
fi
fi
}

[ $# -eq 0 ] && usage

case "$1" in
record)
shift
dorecord $*
;;
diff)
shift
dodiff $*
;;
clean)
shift
doclean $*
;;
*)
echo "Unrecognized command '$1'"
exit 1
;;
esac
Loading

0 comments on commit 321d03c

Please sign in to comment.