diff options
| author | David Faust <david.faust@oracle.com> | 2025-10-29 15:21:16 -0700 |
|---|---|---|
| committer | David Faust <david.faust@oracle.com> | 2025-10-30 09:13:05 -0700 |
| commit | d5f30b7d5285679805796461beeb2f7ce4b25c44 (patch) | |
| tree | 54218c9e91b400c0383e78730e93b56b77a20518 /gcc/fortran/trans-array.cc | |
| parent | b8a786b9242f97fd8460c9aefc8195f9118d0cf9 (diff) | |
| download | gcc-d5f30b7d5285679805796461beeb2f7ce4b25c44.zip gcc-d5f30b7d5285679805796461beeb2f7ce4b25c44.tar.gz gcc-d5f30b7d5285679805796461beeb2f7ce4b25c44.tar.bz2 | |
btf: do not prune at typedefs
The existing BTF pruning logic meant that an anonymous struct or
union type hidden behind a typedef, such as in the common construct:
typedef struct { ... } my_struct_type;
could be pruned if 'my_struct_type' was only ever referenced via pointer
members in other structs/unions types used in the program.
The result of pruning is to skip emitting full type information for
a struct or union type by replacing it with a BTF_KIND_FWD, indicating
that it exists but its definition is omitted. Any types used only by
pruned types are fully omitted from the generated BTF.
In cases like this where the struct/union type is anonymous, the result
is an anonymous BTF_KIND_FWD, which is useless. The presence of such a
type record rightly causes complaints from BTF loaders. Worse, since
the TYPEDEF for 'my_struct_type' itself may _not_ be pruned, its type
information will be incomplete.
Change the BTF pruner so that we never consider pruning at a typedef,
and always either keep or discard both the type and the typedef.
gcc/
* btfout.cc (btf_add_used_type_1): Do not consider creating
fixups at typedefs.
gcc/testsuite/
* gcc.dg/debug/btf/btf-prune-4.c: New.
Diffstat (limited to 'gcc/fortran/trans-array.cc')
0 files changed, 0 insertions, 0 deletions
