[Bug debug/111735] incorrect BTF representation of forward-declared enums
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Dec 19 18:00:34 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111735
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by David Faust <dfaust@gcc.gnu.org>:
https://gcc.gnu.org/g:1502d724df85163b14b04e8f67072ca88eac411d
commit r14-6716-g1502d724df85163b14b04e8f67072ca88eac411d
Author: David Faust <david.faust@oracle.com>
Date: Tue Dec 12 13:55:59 2023 -0800
btf: change encoding of forward-declared enums [PR111735]
The BTF specification does not formally define a representation for
forward-declared enum types such as:
enum Foo;
Forward-declarations for struct and union types are represented by
BTF_KIND_FWD, which has a 1-bit flag distinguishing the two.
The de-facto standard format used by other tools like clang and pahole
is to represent forward-declared enums as BTF_KIND_ENUM with vlen=0,
i.e. as a regular enum type with no enumerators. This patch changes
GCC to adopt that format, and makes a couple of minor cleanups in
btf_asm_type ().
gcc/
PR debug/111735
* btfout.cc (btf_fwd_to_enum_p): New.
(btf_asm_type_ref): Special case references to enum forwards.
(btf_asm_type): Special case enum forwards. Rename btf_size_type to
btf_size, and change chained ifs switching on btf_kind into else
ifs.
gcc/testsuite/
PR debug/111735
* gcc.dg/debug/btf/btf-forward-2.c: New test.
More information about the Gcc-bugs
mailing list