Go to file
Arnaldo Carvalho de Melo 815041d6dc pahole: Improve the type sorting routine to consider multiple types with same name
Out of these different Linux kernel types with the same name (in different object files):

  $ pahole --sizes | sed -r 's/([^\t]+)\t.*/\1/g' | sort | uniq -c | grep -v ' 1 '
        2 chksum_desc_ctx
        2 controller
        2 debug_buffer
        2 dir_entry
        2 disklabel
        2 dma_chan
        2 dma_heap_attachment
        2 d_partition
        2 elf_thread_core_info
        2 intel_community_context
        2 intel_pad_context
        3 irq_info
        2 irte
        2 map_info
        2 mm_slot
        2 netlbl_domhsh_walk_arg
        2 node
        2 pci_root_info
        2 perf_aux_event
        2 pmc_dev
        2 pmc_reg_map
        2 remap_data
        2 slot
        2 sw842_param
        2 syscall_tp_t
        3 urb_priv
        2 walk_control
        3 workspace
  $

Only this one needs a more involved type comparision:

  $ btfdiff vmlinux
  --- /tmp/btfdiff.dwarf.Pksrlr	2021-08-06 16:42:34.823259365 -0300
  +++ /tmp/btfdiff.btf.KOAuwd	2021-08-06 16:42:35.032264038 -0300
  @@ -31035,7 +31035,7 @@ struct elf_note_info {
   	struct memelfnote          auxv;                 /*    56    24 */
   	/* --- cacheline 1 boundary (64 bytes) was 16 bytes ago --- */
   	struct memelfnote          files;                /*    80    24 */
  -	compat_siginfo_t           csigdata;             /*   104   128 */
  +	siginfo_t                  csigdata;             /*   104   128 */
   	/* --- cacheline 3 boundary (192 bytes) was 40 bytes ago --- */
   	size_t                     size;                 /*   232     8 */
   	int                        thread_notes;         /*   240     4 */
  $

It has the same size, number of members.

And this is not always, it all depends on the order in which the btf
encoder gets it from one of the DWARF loading threads:

  $ pahole -j12 --btf_encode vmlinux
  $ btfdiff vmlinux
  $

No changes, but then:

  $ btfdiff vmlinux
  $ perf stat pahole -j12 --btf_encode vmlinux

   Performance counter stats for 'pahole -j12 --btf_encode vmlinux':

           17,920.75 msec task-clock:u              #    2.995 CPUs utilized
                   0      context-switches:u        #    0.000 /sec
                   0      cpu-migrations:u          #    0.000 /sec
              78,004      page-faults:u             #    4.353 K/sec
      42,677,746,170      cycles:u                  #    2.381 GHz                      (83.37%)
         480,920,924      stalled-cycles-frontend:u #    1.13% frontend cycles idle     (83.33%)
       6,470,001,379      stalled-cycles-backend:u  #   15.16% backend cycles idle      (83.39%)
      96,468,468,147      instructions:u            #    2.26  insn per cycle
                                                    #    0.07  stalled cycles per insn  (83.33%)
      19,757,801,968      branches:u                #    1.103 G/sec                    (83.27%)
         143,118,731      branch-misses:u           #    0.72% of all branches          (83.32%)

         5.984348164 seconds time elapsed

        17.234929000 seconds user
         0.398715000 seconds sys

  $ btfdiff vmlinux
  --- /tmp/btfdiff.dwarf.b9FEZI	2021-08-06 16:46:08.810043718 -0300
  +++ /tmp/btfdiff.btf.IawvDY	2021-08-06 16:46:09.026048548 -0300
  @@ -31035,7 +31035,7 @@ struct elf_note_info {
   	struct memelfnote          auxv;                 /*    56    24 */
   	/* --- cacheline 1 boundary (64 bytes) was 16 bytes ago --- */
   	struct memelfnote          files;                /*    80    24 */
  -	compat_siginfo_t           csigdata;             /*   104   128 */
  +	siginfo_t                  csigdata;             /*   104   128 */
   	/* --- cacheline 3 boundary (192 bytes) was 40 bytes ago --- */
   	size_t                     size;                 /*   232     8 */
   	int                        thread_notes;         /*   240     4 */
  $

Next cset will take that into account by traversing both types looking
for differences in the type for a field.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2021-08-20 16:40:27 -03:00
cmake/modules cmake: libebl was merged into libdw 2020-02-03 08:42:13 +01:00
lib libbpf: Fixup patch to allow to use packaged version 2021-06-13 10:22:21 -03:00
man-pages man-pages: Improve the --nr_methods/-m pahole man page entry 2021-08-20 16:40:27 -03:00
ostra ostra: Initial python3 conversion 2019-04-23 12:02:22 -03:00
rpm/SPECS core: Remove strings.c, unused 2021-08-12 09:41:11 -03:00
.gitignore pahole: Add build dir, config.h to .gitignore 2019-02-11 12:55:46 -03:00
.gitmodules pahole: add libbpf as submodule under lib/bpf 2019-02-11 12:56:40 -03:00
CMakeLists.txt core: Remove strings.c, unused 2021-08-12 09:41:11 -03:00
COPYING [LICENSE]: Add COPYING file and add missing license info on some files 2007-12-17 14:15:42 -02:00
MANIFEST btf_encoder: Move libbtf.c to btf_encoder.c, the only user of its functions 2021-06-09 13:34:15 -03:00
NEWS pahole: Prep 1.21 2021-04-09 19:39:15 -03:00
README README: Add documentation for -DBUILD_SHARED_LIBS 2021-06-10 14:31:44 -03:00
README.DEBUG README.DEBUG: Add an extra step to make the instructions cut'n'exec 2017-12-14 14:15:54 -03:00
README.btf v1.13: New release 2019-04-16 16:13:19 -03:00
README.cross README: Add instructions to do a cross build 2020-08-17 09:52:02 -03:00
README.ctracer ctracer: update README.ctracer, f9 has the dwarves 2008-10-29 08:54:53 -02:00
README.tarball docs: Add command line to generate tarball with a prefix 2020-03-12 16:55:15 -03:00
btf_encoder.c btf_encoder: Fix signed/unsigned comparision 2021-08-20 16:40:27 -03:00
btf_encoder.h btf_encoder: Add methods to maintain a list of btf encoders 2021-08-20 16:40:27 -03:00
btf_loader.c btf_loader: Mark the 'level' arg to the libbpf error callback as __maybe_unused 2021-08-20 16:40:27 -03:00
btfdiff btfdiff: Use multithreaded DWARF loading 2021-08-12 09:41:13 -03:00
changes-v1.13 v1.13: New release 2019-04-16 16:13:19 -03:00
changes-v1.16 dwarves: Prep v1.16 2019-12-16 11:43:53 -03:00
changes-v1.17 dwarves: Prep v1.17 2020-03-13 16:36:02 -03:00
changes-v1.18 dwarves: Prep v1.18 2020-10-02 17:29:59 -03:00
changes-v1.19 dwarves: Prep v1.19 2020-11-23 09:52:44 -03:00
changes-v1.20 pahole: Prep 1.20 2021-02-03 21:45:01 -03:00
changes-v1.21 pahole: Prep 1.21 2021-04-09 19:39:15 -03:00
codiff.c codiff: class__find_pair_member() doesn't need 'cu' args 2021-08-20 16:40:27 -03:00
config.h.cmake [DWARVES] Fixes a FIXME relating to a missing elf (libdw) symbol check. 2008-02-12 21:08:49 -02:00
ctf.h Adopt SPDX-License-Identifier 2019-01-18 15:41:48 -03:00
ctf_encoder.c strings: use BTF's string APIs for strings management 2020-10-20 17:17:51 -03:00
ctf_encoder.h Adopt SPDX-License-Identifier 2019-01-18 15:41:48 -03:00
ctf_loader.c core: Use obstacks: take 2 2021-08-20 16:40:27 -03:00
ctfdwdiff ctfdwdiff: Don't ask for variables and inline expansions in pfunct 2009-03-31 19:21:46 -03:00
ctracer.c ctracer: No need to read the ehdr, ditch it 2021-08-20 16:40:27 -03:00
dtagnames.c headers: Rebame __unused to __maybe_unused to avoid clashes with system headers 2021-06-13 10:25:35 -03:00
dutil.c dutil: elf_symtab__new() doesn't need the GElf_Ehdr *ep argument 2021-08-20 16:40:27 -03:00
dutil.h dutil: elf_symtab__new() doesn't need the GElf_Ehdr *ep argument 2021-08-20 16:40:27 -03:00
dwarf_loader.c dwarf_loader: cus__load_debug_types() doesn't use its 'cus' arg, remove it 2021-08-20 16:40:27 -03:00
dwarves.c core: cus__fprintf_load_files_err() doesn't use its 'cus' argument 2021-08-20 16:40:27 -03:00
dwarves.h core: Remove extra ; in 'print_numeric_version' extern declaration 2021-08-20 16:40:27 -03:00
dwarves_emit.c core: enumeration__emit_definitions() doesn't need a 'cu' argument 2021-08-12 09:39:46 -03:00
dwarves_emit.h emit: type__emit_fwd_decl() isn't used outside emit.c, make it static 2021-08-12 09:39:46 -03:00
dwarves_fprintf.c fprintf: class__vtable_fprintf() doesn't need a 'cu' arg 2021-08-12 09:41:13 -03:00
dwarves_reorganize.c core: base_type__name() doesn't need a 'cu' arg 2021-08-12 09:41:13 -03:00
dwarves_reorganize.h Adopt SPDX-License-Identifier 2019-01-18 15:41:48 -03:00
elf_symtab.c elf_symtab: Remove needless GElf_Ehdr pointer argument from the constructor 2021-08-20 16:40:27 -03:00
elf_symtab.h elf_symtab: Remove needless GElf_Ehdr pointer argument from the constructor 2021-08-20 16:40:27 -03:00
elfcreator.c elfcreator: elfcreator_copy_scn() doesn't need the 'elf' arg 2021-08-20 16:40:27 -03:00
elfcreator.h elfcreator: elfcreator_copy_scn() doesn't need the 'elf' arg 2021-08-20 16:40:27 -03:00
fullcircle v1.13: New release 2019-04-16 16:13:19 -03:00
gobuffer.c gobuffer: Use zfree() and make delete accept NULL, like free() 2021-05-27 11:00:18 -03:00
gobuffer.h Adopt SPDX-License-Identifier 2019-01-18 15:41:48 -03:00
hash.h hash: Remove unused hash_32(), hash_ptr() 2021-08-20 16:40:27 -03:00
libctf.c elf_symtab: Remove needless GElf_Ehdr pointer argument from the constructor 2021-08-20 16:40:27 -03:00
libctf.h strings: use BTF's string APIs for strings management 2020-10-20 17:17:51 -03:00
list.h list: Adopt list_next_entry() from the Linux kernel 2021-08-20 16:40:27 -03:00
pahole.c pahole: Improve the type sorting routine to consider multiple types with same name 2021-08-20 16:40:27 -03:00
pdwtags.c core: base_type__name() doesn't need a 'cu' arg 2021-08-12 09:41:13 -03:00
pfunct.c elf_symtab: Remove needless GElf_Ehdr pointer argument from the constructor 2021-08-20 16:40:27 -03:00
pglobal.c core: variable__name() doesn't need a 'cu' arg 2021-08-12 09:41:13 -03:00
prefcnt.c headers: Rebame __unused to __maybe_unused to avoid clashes with system headers 2021-06-13 10:25:35 -03:00
rbtree.c Adopt SPDX-License-Identifier 2019-01-18 15:41:48 -03:00
rbtree.h Adopt SPDX-License-Identifier 2019-01-18 15:41:48 -03:00
regtest regtest: Accept --diff instad of plain 'diff' as long option 2012-05-14 19:36:58 -03:00
scncopy.c elfcreator: elfcreator_copy_scn() doesn't need the 'elf' arg 2021-08-20 16:40:27 -03:00
syscse.c syscse: zero_extend() doesn't need a 'cu' arg 2021-08-20 16:40:27 -03:00

README

Build instructions:

1. install cmake
2. mkdir build
3. cd build
4. cmake -D__LIB=lib ..
5. make install

cmake Options:
  -DBUILD_SHARED_LIBS
    By default SHARED libraries are created and applications are linked to it.
    Use -DBUILD_SHARED_LIBS=OFF while invoking cmake to create STATIC libraries
    and link applications to it.

    Ex. cmake -D__LIB=lib -DBUILD_SHARED_LIBS=OFF ..

  -DCMAKE_INSTALL_PREFIX
    Default is to install to /usr/local, use -DCMAKE_INSTALL_PREFIX=
    when invoking cmake to specify another install location.

Known to work scenarios:

Mandriva Cooker:

cmake 2.4.5-1mdv2007.1
libelfutils1-devel 0.123-1mdv2007.1

Debian Unstable:

cmake 2.4.5-1
libdw-dev 0.123-2

Fedora Core 6:

cmake 2.4.5-2.fc6
elfutils-devel 0.126-1.fc6