public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Rearrange struct bfd_section a little
@ 2022-04-09  6:05 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2022-04-09  6:05 UTC (permalink / raw)
  To: binutils

For better packing on 64-bit hosts.

	* section.c (struct bfd_section): Move next and prev field earlier.
	Move alignment_power later.
	(BFD_FAKE_SECTION): Adjust to suit.
	* bfd-in2.h: Regenerate.

diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index eb3b79e0bfe..50e26fc691d 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -766,6 +766,12 @@ typedef struct bfd_section
      the same as that passed to bfd_make_section.  */
   const char *name;
 
+  /* The next section in the list belonging to the BFD, or NULL.  */
+  struct bfd_section *next;
+
+  /* The previous section in the list belonging to the BFD, or NULL.  */
+  struct bfd_section *prev;
+
   /* A unique sequence number.  */
   unsigned int id;
 
@@ -776,12 +782,6 @@ typedef struct bfd_section
   /* Which section in the bfd; 0..n-1 as sections are created in a bfd.  */
   unsigned int index;
 
-  /* The next section in the list belonging to the BFD, or NULL.  */
-  struct bfd_section *next;
-
-  /* The previous section in the list belonging to the BFD, or NULL.  */
-  struct bfd_section *prev;
-
   /* The field flags contains attributes of the section. Some
      flags are read in from the object file, and some are
      synthesized from other information.  */
@@ -1082,10 +1082,6 @@ typedef struct bfd_section
   /* The output section through which to map on output.  */
   struct bfd_section *output_section;
 
-  /* The alignment requirement of the section, as an exponent of 2 -
-     e.g., 3 aligns to 2^3 (or 8).  */
-  unsigned int alignment_power;
-
   /* If an input section, a pointer to a vector of relocation
      records for the data in this section.  */
   struct reloc_cache_entry *relocation;
@@ -1097,6 +1093,10 @@ typedef struct bfd_section
   /* The number of relocation records in one of the above.  */
   unsigned reloc_count;
 
+  /* The alignment requirement of the section, as an exponent of 2 -
+     e.g., 3 aligns to 2^3 (or 8).  */
+  unsigned int alignment_power;
+
   /* Information below is back end specific - and not always used
      or updated.  */
 
@@ -1306,8 +1306,8 @@ discarded_section (const asection *sec)
 }
 
 #define BFD_FAKE_SECTION(SEC, SYM, NAME, IDX, FLAGS)                   \
-  /* name, id,  section_id, index, next, prev, flags, user_set_vma, */ \
-  {  NAME, IDX, 0,          0,     NULL, NULL, FLAGS, 0,               \
+  /* name, next, prev, id,  section_id, index, flags, user_set_vma, */ \
+  {  NAME, NULL, NULL, IDX, 0,          0,     FLAGS, 0,               \
                                                                        \
   /* linker_mark, linker_has_input, gc_mark, decompress_status,     */ \
      0,           0,                1,       0,                        \
@@ -1318,14 +1318,14 @@ discarded_section (const asection *sec)
   /* sec_flg0, sec_flg1, sec_flg2, sec_flg3, sec_flg4, sec_flg5,    */ \
      0,        0,        0,        0,        0,        0,              \
                                                                        \
-  /* vma, lma, size, rawsize, compressed_size, */                      \
+  /* vma, lma, size, rawsize, compressed_size,                      */ \
      0,   0,   0,    0,       0,                                       \
                                                                        \
-  /* output_offset, output_section, alignment_power,                */ \
-     0,             &SEC,           0,                                 \
+  /* output_offset, output_section, relocation, orelocation,        */ \
+     0,             &SEC,           NULL,       NULL,                  \
                                                                        \
-  /* relocation, orelocation, reloc_count, filepos, rel_filepos,    */ \
-     NULL,       NULL,        0,           0,       0,                 \
+  /* reloc_count, alignment_power, filepos, rel_filepos,            */ \
+     0,           0,               0,       0,                         \
                                                                        \
   /* line_filepos, userdata, contents, lineno, lineno_count,        */ \
      0,            NULL,     NULL,     NULL,   0,                      \
diff --git a/bfd/section.c b/bfd/section.c
index d7922e0741a..5a487ce6c6f 100644
--- a/bfd/section.c
+++ b/bfd/section.c
@@ -151,6 +151,12 @@ CODE_FRAGMENT
 .     the same as that passed to bfd_make_section.  *}
 .  const char *name;
 .
+.  {* The next section in the list belonging to the BFD, or NULL.  *}
+.  struct bfd_section *next;
+.
+.  {* The previous section in the list belonging to the BFD, or NULL.  *}
+.  struct bfd_section *prev;
+.
 .  {* A unique sequence number.  *}
 .  unsigned int id;
 .
@@ -161,12 +167,6 @@ CODE_FRAGMENT
 .  {* Which section in the bfd; 0..n-1 as sections are created in a bfd.  *}
 .  unsigned int index;
 .
-.  {* The next section in the list belonging to the BFD, or NULL.  *}
-.  struct bfd_section *next;
-.
-.  {* The previous section in the list belonging to the BFD, or NULL.  *}
-.  struct bfd_section *prev;
-.
 .  {* The field flags contains attributes of the section. Some
 .     flags are read in from the object file, and some are
 .     synthesized from other information.  *}
@@ -467,10 +467,6 @@ CODE_FRAGMENT
 .  {* The output section through which to map on output.  *}
 .  struct bfd_section *output_section;
 .
-.  {* The alignment requirement of the section, as an exponent of 2 -
-.     e.g., 3 aligns to 2^3 (or 8).  *}
-.  unsigned int alignment_power;
-.
 .  {* If an input section, a pointer to a vector of relocation
 .     records for the data in this section.  *}
 .  struct reloc_cache_entry *relocation;
@@ -482,6 +478,10 @@ CODE_FRAGMENT
 .  {* The number of relocation records in one of the above.  *}
 .  unsigned reloc_count;
 .
+.  {* The alignment requirement of the section, as an exponent of 2 -
+.     e.g., 3 aligns to 2^3 (or 8).  *}
+.  unsigned int alignment_power;
+.
 .  {* Information below is back end specific - and not always used
 .     or updated.  *}
 .
@@ -691,8 +691,8 @@ CODE_FRAGMENT
 .}
 .
 .#define BFD_FAKE_SECTION(SEC, SYM, NAME, IDX, FLAGS)			\
-.  {* name, id,  section_id, index, next, prev, flags, user_set_vma, *}	\
-.  {  NAME, IDX, 0,          0,     NULL, NULL, FLAGS, 0,		\
+.  {* name, next, prev, id,  section_id, index, flags, user_set_vma, *}	\
+.  {  NAME, NULL, NULL, IDX, 0,          0,     FLAGS, 0,		\
 .									\
 .  {* linker_mark, linker_has_input, gc_mark, decompress_status,     *}	\
 .     0,           0,                1,       0,			\
@@ -703,14 +703,14 @@ CODE_FRAGMENT
 .  {* sec_flg0, sec_flg1, sec_flg2, sec_flg3, sec_flg4, sec_flg5,    *}	\
 .     0,        0,        0,        0,        0,        0,		\
 .									\
-.  {* vma, lma, size, rawsize, compressed_size, *}			\
+.  {* vma, lma, size, rawsize, compressed_size,                      *}	\
 .     0,   0,   0,    0,       0,					\
 .									\
-.  {* output_offset, output_section, alignment_power,                *}	\
-.     0,             &SEC,           0,					\
+.  {* output_offset, output_section, relocation, orelocation,        *}	\
+.     0,             &SEC,           NULL,       NULL,			\
 .									\
-.  {* relocation, orelocation, reloc_count, filepos, rel_filepos,    *}	\
-.     NULL,       NULL,        0,           0,       0,			\
+.  {* reloc_count, alignment_power, filepos, rel_filepos,            *}	\
+.     0,           0,               0,       0,				\
 .									\
 .  {* line_filepos, userdata, contents, lineno, lineno_count,        *}	\
 .     0,            NULL,     NULL,     NULL,   0,			\

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-09  6:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-09  6:05 Rearrange struct bfd_section a little Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).