Commit graph

9 commits

Author SHA1 Message Date
Stephen Boyd
65ba6fa439 scripts: objdiff: Ignore debug info when comparing
If the kernel is configured to be built with debug symbols, or
has bug tables, comparing files may not work if line numbers
change. This makes comparing object files with these options
harder to do. Let's strip out the debug info and drop the
__bug_table here so that we don't see false positives. There may
be other things to drop later, and it may be architecture
specific, but this works for me with my ARM64 build.

Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Reviewed-by: Jason Cooper <jason@lakedaemon.net>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-03-11 11:13:38 +09:00
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