+2021-04-21 Tom Tromey <tom@tromey.com>
+
+ * dwarf2/read.h (struct dwarf2_per_cu_data) <dwarf_version>: Now
+ unsigned char.
+ (struct dwarf2_per_cu_data): Rearrange.
+ * dwarf2/comp-unit.h (struct comp_unit_head) <version>: Now
+ unsigned char.
+ (struct comp_unit_head): Rearrange.
+ * dwarf2/comp-unit.c (read_comp_unit_head): Update.
+
2021-04-21 Tom de Vries <tdevries@suse.de>
PR build/27681
cu_header->initial_length_size = bytes_read;
cu_header->offset_size = (bytes_read == 4) ? 4 : 8;
info_ptr += bytes_read;
- cu_header->version = read_2_bytes (abfd, info_ptr);
- if (cu_header->version < 2 || cu_header->version > 5)
+ unsigned version = read_2_bytes (abfd, info_ptr);
+ if (version < 2 || version > 5)
error (_("Dwarf Error: wrong version in compilation unit header "
"(is %d, should be 2, 3, 4 or 5) [in module %s]"),
- cu_header->version, filename);
+ version, filename);
+ cu_header->version = version;
info_ptr += 2;
if (cu_header->version < 5)
switch (section_kind)
struct comp_unit_head
{
unsigned int length;
- short version;
+ unsigned char version;
unsigned char addr_size;
unsigned char signed_addr_p;
sect_offset abbrev_sect_off;
enum dwarf_unit_type unit_type;
- /* Offset to the first byte of this compilation unit header in the
- .debug_info section, for resolving relative reference dies. */
- sect_offset sect_off;
-
/* Offset to first die in this cu from the start of the cu.
This will be the first byte following the compilation unit header. */
cu_offset first_die_cu_offset;
+ /* Offset to the first byte of this compilation unit header in the
+ .debug_info section, for resolving relative reference dies. */
+ sect_offset sect_off;
+
+ /* For types, offset in the type's DIE of the type defined by this TU. */
+ cu_offset type_cu_offset_in_tu;
/* 64-bit signature of this unit. For type units, it denotes the signature of
the type (DW_UT_type in DWARF 4, additionally DW_UT_split_type in DWARF 5).
DW_UT_skeleton or DW_UT_split_compile. */
ULONGEST signature;
- /* For types, offset in the type's DIE of the type defined by this TU. */
- cu_offset type_cu_offset_in_tu;
-
/* Return the total length of the CU described by this header. */
unsigned int get_length () const
{
unsigned int length;
/* DWARF standard version this data has been read from (such as 4 or 5). */
- short dwarf_version;
+ unsigned char dwarf_version;
/* Flag indicating this compilation unit will be read in before
any of the current compilation units are processed. */
This flag is only valid if is_debug_types is true. */
unsigned int tu_read : 1;
+ /* True if HEADER has been read in.
+
+ Don't access this field directly. It should be private, but we can't make
+ it private at the moment. */
+ mutable bool m_header_read_in : 1;
+
+ /* The unit type of this CU. */
+ ENUM_BITFIELD (dwarf_unit_type) unit_type : 8;
+
+ /* The language of this CU. */
+ ENUM_BITFIELD (language) lang : LANGUAGE_BITS;
+
/* Our index in the unshared "symtabs" vector. */
unsigned index;
not the DWO file. */
struct dwarf2_section_info *section;
- /* The unit type of this CU. */
- enum dwarf_unit_type unit_type;
-
- /* The language of this CU. */
- enum language lang;
-
/* Backlink to the owner of this. */
dwarf2_per_bfd *per_bfd;
should be private, but we can't make it private at the moment. */
mutable comp_unit_head m_header;
- /* True if HEADER has been read in.
-
- Don't access this field directly. It should be private, but we can't make
- it private at the moment. */
- mutable bool m_header_read_in;
-
/* When dwarf2_per_bfd::using_index is true, the 'quick' field
is active. Otherwise, the 'psymtab' field is active. */
union