On Tue, Jan 9, 2024 at 9:18 PM Eric Botcazou <botca...@adacore.com> wrote: > > Hi, > > this is not really a regression but the patch was written last week and is > quite straightforward, so hopefully can nevertheless be OK. It implements the > support of DW_AT_endianity for enumeration types because they are scalar and, > therefore, reverse Scalar_Storage_Order is supported for them, but only when > the -gstrict-dwarf switch is not passed because this is an extension. > > There is an associated GDB patch to be submitted by Tom to grok the new DWARF. > > Tested on x86-64/Linux, OK for the mainline? It may also help the GDB side to > backport it for the upcoming 13.3 release.
Can you elaborate on the DIE order constraint and why it was chosen? That is, + /* The DIE with DW_AT_endianity is placed right after the naked DIE. */ + if (reverse) + { + gcc_assert (type_die); ... and + /* The DIE with DW_AT_endianity is placed right after the naked DIE. */ + if (reverse_type) + { + dw_die_ref after_die + = modified_type_die (type, cv_quals, false, context_die); + gen_type_die (type, context_die, true); + gcc_assert (after_die->die_sib + && get_AT_unsigned (after_die->die_sib, DW_AT_endianity)); + return after_die->die_sib; ? Likewise the extra argument to the functions is odd - is that not available on the tree type? Richard. > > 2024-01-09 Eric Botcazou <ebotca...@adacore.com> > > * dwarf2out.cc (modified_type_die): Extend the support of reverse > storage order to enumeration types if -gstrict-dwarf is not passed. > (gen_enumeration_type_die): Add REVERSE parameter and generate the > DIE immediately after the existing one if it is true. > (gen_tagged_type_die): Add REVERSE parameter and pass it in the > call to gen_enumeration_type_die. > (gen_type_die_with_usage): Add REVERSE parameter and pass it in the > first recursive call as well as the call to gen_tagged_type_die. > (gen_type_die): Add REVERSE parameter and pass it in the call to > gen_type_die_with_usage. > > -- > Eric Botcazou