Commit Graph

8 Commits

Author SHA1 Message Date
Masahiro Yamada 7fa0e6db3c scripts: objdiff: support directories for the augument of record command
For example,

  $ scripts/objdiff record init drivers/usb

disassembles all the objects under init and drivers/usb directories.

This feature would be useful when we change various files under the
specific directory.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Jason Cooper <jason@lakedaemon.net>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2014-06-10 14:59:33 +02:00
Masahiro Yamada 8ac28bee76 scripts: objdiff: fix a comment
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Jason Cooper <jason@lakedaemon.net>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2014-06-10 14:59:33 +02:00
Masahiro Yamada 8b5d0f20d6 scripts: objdiff: change the extension of disassembly from .o to .dis
Prior to this commit, the command "scripts/objdiff record path/to/*.o"
disassembled the given object into ".tmp_objdiff/path/to/*.o" file.

The problem here is that recorded disassemblies are lost if we run
"make clean" because it removes all the *.o files.
Disassembled code should be dumped into *.dis instead of *.o files.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Jason Cooper <jason@lakedaemon.net>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2014-06-10 14:59:33 +02:00
Masahiro Yamada 18165efa82 scripts: objdiff: improve path flexibility for record command
Prior to this commit, scripts/objdiff expected to be run at the top
directory and only the relative path of objects.

This commit provides more flexibility in terms of object path:

[1] scripts/objdiff can be run in any directory

For example,

  $ scripts/objdiff record init/main.o

and

  $ cd init; ../scripts/objdiff record main.o

produce the same result.

[2] Support absolute path for objects

  $ scripts/objdiff record /home/foo/bar/linux/init/main.o

work as well.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Jason Cooper <jason@lakedaemon.net>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2014-06-10 14:59:33 +02:00
Masahiro Yamada 1ecc8e489a scripts: objdiff: remove unnecessary code
The directories for objdump is created by the code
a few lines below:

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

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Jason Cooper <jason@lakedaemon.net>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2014-06-10 14:59:33 +02:00
Masahiro Yamada 5ab370e91a scripts: objdiff: direct error messages to stderr
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Jason Cooper <jason@lakedaemon.net>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2014-06-10 14:59:33 +02:00
Masahiro Yamada fd6e124233 scripts: objdiff: get the path to .tmp_objdiff more simply
This commit is a minor refactoring.

Temporary files for objdiff are stored in .tmp_objdiff directory
which is located at the top directory.

To get the path to this directory,

  SRCTREE=`git rev-parse --show-toplevel`
  TMPD=$SRCTREE/.tmp_objdiff

seems easier to understand than

  GIT_DIR=`git rev-parse --git-dir`
  TMPD=${GIT_DIR%git}tmp_objdiff

Besides, it is not always necessary to create .tmp_objdiff dicrectory.
It should be created only for "record" command.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Jason Cooper <jason@lakedaemon.net>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2014-06-10 14:59:33 +02:00
Jason Cooper 79192ca8eb scripts: objdiff: detect object code changes between two commits
objdiff is useful when doing large code cleanups.  For example, when
removing checkpatch warnings and errors from new drivers in the staging
tree.

objdiff can be used in conjunction with a git rebase to confirm that
each commit made no changes to the resulting object code.  It has the
same return values as diff(1).

This was written specifically to support adding the skein and threefish
cryto drivers to the staging tree.  I needed a programmatic way to
confirm that commits changing >90% of the lines didn't inadvertently
change the code.

Temporary files (objdump output) are stored in

  /path/to/linux/.tmp_objdiff

'make mrproper' will remove this directory.

Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Signed-off-by: Michal Marek <mmarek@suse.cz>
2014-04-08 16:41:44 +02:00