print "changed function" notice for all changed functions

A local changed function will not appear with a "changed function"
notice if it is a dependency of another changed function and that
function occurs before it in the symbol table.

Rearrange some logic to print the notice regardless of whether or not
the function symbols has already been selected for inclusion.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
do not proceed with output generation if no changed funcs

If there are no changed functions, print notice and exit.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
Merge pull request #82 from spartacus06/fixes

small fixes
Merge pull request #83 from useidel/master

Reworked version of spec file following the discussion of PR 80
bundle with inclusive logic rather than exclusive

I've created a test designed to exercise the ability
of create-diff-object to parse, compare, and return
"no changed functions" for the entire kernel source
tree one file at a time by passing the same file as
both the original and patched file.

Through this process, I realized that excluding every
special case from being bundled it not feasible.  There
are many sections in the kernel that don't honor
-ffunction|data-sections, not just __ksymtab_strings and
.init.text.

Plus, excluding situations is not the best way.  We are
really only looking for sections that _were_ the result
of -f[function|data]-sections for bundling.

To that end, this commit looks to bundle only symbol/section
pairs that should be bundled ensuringthe .text/.data suffix
and the FUNC/OBJECT symbol name match.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
remove rela twin field, never used

Signed-off-by: Seth Jennings <sjenning@redhat.com>
refactor rela section scanning

Upon realizing that there is no point in correlating rela entries,
I also realized that tracking the status of rela entries is also
not needed.

Additionally, the rela section correlation path (really misnamed
as it is the rela section _comparison path) is VERY hot.  Particularly
on files like fs/ext4/ext4.o (which create-diff-object currently can't
successfully parse entirely):

Samples: 40K of event 'cycles', Event count (approx.): 36516578362
49.49%  create-diff-obj  create-diff-object  [.] rela_equal
31.85%  create-diff-obj  create-diff-object  [.] kpatch_correlate_relas
16.22%  create-diff-obj  create-diff-object  [.] find_symbol_by_index

The refactor does a few things:
- replaces nested for loops with single for loop when comparing rela entries
- removes status field for rela entires
- compares rela and nonrela sections in the same path
- removes unnecessary setting of status fields as the inclusion tree
  will include them even if the section status isn't set to CHANGED. This is
  even better as unchanged sections won't appear as CHANGED just because
  their partner .text or .rela section is CHANGED.

This drastically reduced runtime for larger objects and cooled the rela
comparison path:

87.64%  create-diff-obj  create-diff-object  [.] find_symbol_by_index
6.98%  create-diff-obj  libc-2.18.so        [.] __GI___strcmp_ssse3
1.33%  create-diff-obj  create-diff-object  [.] find_section_by_index
1.16%  create-diff-obj  create-diff-object  [.] kpatch_correlate_symbols
0.61%  create-diff-obj  create-diff-object  [.] kpatch_create_rela_table
0.52%  create-diff-obj  create-diff-object  [.] kpatch_correlate_sections

Signed-off-by: Seth Jennings <sjenning@redhat.com>
change for_each_symbol to start at 1 (avoid ugh)

remove "ughs" by changing macro to start at symbol
index 1.  new for_each_symbol_zero will start at zero
for rare cases that need it.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
improve find_[symbol|section]_by_index

The indexes are in order when being read from the
table.  Just index directly into the table; a benefit
of using an array for this structure instead of a linked
list.

Removes another hot path during the rela table initialization.

Signed-off-by: Seth Jennings <sjenning@redhat.com>
Merge pull request #85 from useidel/master

added man pages and updated SPEC file
always rebuild core module

If the kernel updates, make won't detect that the core module needs
rebuilding.  So always rebuild it.
Merge pull request #88 from jpoimboe/implicit-make-clean

always rebuild core module
fix conditional in find_section_by_index()

Signed-off-by: Seth Jennings <sjenning@redhat.com>
Merge pull request #84 from spartacus06/fixes

Refactoring and perf improvements for create-diff-object
man: don't delete source files when compressing man files

Fix the issue where a "make install" deletes the man source files.
Merge pull request #89 from jpoimboe/man-install-error

man: don't delete source files when compressing man files
add man .gz files to gitignore

Signed-off-by: Seth Jennings <sjenning@redhat.com>
Merge pull request #90 from spartacus06/gitignore

add man .gz files to gitignore
skip scripts/mod files when detecting changed objs

In some environments, some files in scripts/mod (devicetable-offsets.s
and file2alias.o) are always getting rebuilt, and thus get incorrectly
added to the changed_objs file, resulting in the following error:

 strip:/root/.kpatch/3.10.0-115.el7.x86_64/obj2/scripts/mod/devicetable-offsets.s: File format not recognized
check for changed sections that are not included

There are many cases where a section may have
changed due to soure-level change but the inclusion
logic has not selected it for output.  Some of these
cases are real no-go situations like changing data
structures.  Some are just situations that
create-diff-object isn't smart enough to figure out
(yet).

Either way, it should be considered fatal when a
changed section hasn't been selected for output.

Signed-off-by: Seth Jennings <sjenning@redhat.com>