Skip to content

Commit

Permalink
pahole: Do --lang_exclude CU filtering earlier
Browse files Browse the repository at this point in the history
With this, we can avoid warnings for unsupported DWARF tags like:

  die__process_function: tag not supported 0x2f (template_type_parameter)!

when processing object files generated from languages such as Rust, for
instance when building the Linux kernel with `CONFIG_RUST`, after
applying the next patch in this series.

As an added bonus, this should speed up processing of large objects with
filtered CUs, as their details will no longer be walked.

Committer testing:

Tested building a kernel with CONFIG_RUST, no warnings (that
template_type_param wouldn't appear anyway as I added initial support
for it, at least for creating some structs out of its DWARF info, so no
more warnings), but:

  ⬢[acme@toolbox linux]$ pahole -C '<kernel::str::RawFormatter as core::fmt::Write>::{vtable_type}' ../build/rust-kernel/rust/kernel.o
  die__process_class: tag not supported 0x33 (variant_part) at <14f43>!
  struct <kernel::str::RawFormatter as core::fmt::Write>::{vtable_type} {
          () *                       drop_in_place __attribute__((__aligned__(8))); /*     0     8 */
          usize                      size __attribute__((__aligned__(8))); /*     8     8 */
          usize                      align __attribute__((__aligned__(8))); /*    16     8 */
          () *                       __method3 __attribute__((__aligned__(8))); /*    24     8 */
          () *                       __method4 __attribute__((__aligned__(8))); /*    32     8 */
          () *                       __method5 __attribute__((__aligned__(8))); /*    40     8 */

          /* size: 48, cachelines: 1, members: 6 */
          /* forced alignments: 6 */
          /* last cacheline: 48 bytes */
  } __attribute__((__aligned__(8)));

  ⬢[acme@toolbox linux]$

That DW_TAG_variant_part warning would show up without this series, so
seems to be working as expected :-)

Reviewed-by: Alan Maguire <[email protected]>
Signed-off-by: Matthew Maurer <[email protected]>
Tested-by: Alan Maguire <[email protected]>
Tested-by: Arnaldo Carvalho de Melo <[email protected]>
Cc: Alice Ryhl <[email protected]>
Cc: [email protected]
Link: https://lore.kernel.org/r/[email protected]
[ Split from a larger patch ]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
maurer authored and acmel committed Aug 9, 2024
1 parent c46455b commit 5e3ed3e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pahole.c
Original file line number Diff line number Diff line change
Expand Up @@ -3766,6 +3766,10 @@ int main(int argc, char *argv[])
memset(tab, ' ', sizeof(tab) - 1);

conf_load.steal = pahole_stealer;

if (languages.exclude)
conf_load.early_cu_filter = cu__filter;

conf_load.thread_exit = pahole_thread_exit;

if (conf_load.reproducible_build) {
Expand Down

0 comments on commit 5e3ed3e

Please sign in to comment.