]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Compact elf_backend_data
authorAlan Modra <amodra@gmail.com>
Sat, 3 Jan 2026 03:13:50 +0000 (13:43 +1030)
committerAlan Modra <amodra@gmail.com>
Sun, 4 Jan 2026 02:42:26 +0000 (13:12 +1030)
* elf-bfd.h (struct elf_backend_data): Make arch, elf_osabi,
elf_machine_code and target_os bitfields, and reorder.  Make
maxpagesize, minpagesize, commonpagesize and p_align unsigned
int.
* elfxx-target.h (elfNN_bed): Reorder to suit.  Delete useless
comments.

bfd/elf-bfd.h
bfd/elfxx-target.h

index b759d469326c55acb8000f4ddd5f437d3cf2caf0..717b0912bb8bd5d07cf591955c013126f380b640 100644 (file)
@@ -1008,35 +1008,35 @@ typedef uint32_t obj_attr_tag_t;
 struct elf_backend_data
 {
   /* The architecture for this backend.  */
-  enum bfd_architecture arch;
+  ENUM_BITFIELD (bfd_architecture) arch : 8;
+
+  /* EI_OSABI.  */
+  unsigned elf_osabi : 8;
+
+  /* The ELF machine code (EM_xxxx) for this backend.  */
+  unsigned elf_machine_code : 16;
 
   /* An identifier used to distinguish different target specific
      extensions to elf_obj_tdata and elf_link_hash_table structures.  */
-  enum elf_target_id target_id;
+  ENUM_BITFIELD (elf_target_id) target_id : 8;
 
   /* Target OS.  */
-  enum elf_target_os target_os;
-
-  /* The ELF machine code (EM_xxxx) for this backend.  */
-  int elf_machine_code;
-
-  /* EI_OSABI.  */
-  int elf_osabi;
+  ENUM_BITFIELD (elf_target_os) target_os : 2;
 
   /* The maximum page size for this backend.  */
-  bfd_vma maxpagesize;
+  unsigned maxpagesize;
 
   /* The minimum page size for this backend.  An input object will not be
      considered page aligned unless its sections are correctly aligned for
      pages at least this large.  May be smaller than maxpagesize.  */
-  bfd_vma minpagesize;
+  unsigned minpagesize;
 
   /* The common page size for this backend.  */
-  bfd_vma commonpagesize;
+  unsigned commonpagesize;
 
   /* The p_align value for this backend.  If it is set, p_align of
       PT_LOAD alignment will be to p_align by default.  */
-  bfd_vma p_align;
+  unsigned p_align;
 
   /* The BFD flags applied to sections created for dynamic linking.  */
   flagword dynamic_sec_flags;
index ffda07dfe616f309df03ebfbf97704f039f99324..88f8a041ea85b2d61ca6199f5c9ddf3cc819d70a 100644 (file)
@@ -806,16 +806,16 @@ extern const struct elf_size_info _bfd_elfNN_size_info ATTRIBUTE_HIDDEN;
 
 static const struct elf_backend_data elfNN_bed =
 {
-  ELF_ARCH,                    /* arch */
-  ELF_TARGET_ID,               /* target_id */
-  ELF_TARGET_OS,               /* target_os */
-  ELF_MACHINE_CODE,            /* elf_machine_code */
-  ELF_OSABI,                   /* elf_osabi  */
-  ELF_MAXPAGESIZE,             /* maxpagesize */
-  ELF_MINPAGESIZE,             /* minpagesize */
-  ELF_COMMONPAGESIZE,          /* commonpagesize */
-  ELF_P_ALIGN,                 /* p_align */
-  ELF_DYNAMIC_SEC_FLAGS,       /* dynamic_sec_flags */
+  ELF_ARCH,
+  ELF_OSABI,
+  ELF_MACHINE_CODE,
+  ELF_TARGET_ID,
+  ELF_TARGET_OS,
+  ELF_MAXPAGESIZE,
+  ELF_MINPAGESIZE,
+  ELF_COMMONPAGESIZE,
+  ELF_P_ALIGN,
+  ELF_DYNAMIC_SEC_FLAGS,
   elf_backend_arch_data,
   elf_info_to_howto,
   elf_info_to_howto_rel,