+/* Check whether this section uses an alignment other than the
+ default. */
+
+static void
+coff_set_custom_section_alignment (abfd, section, alignment_table, table_size)
+ bfd *abfd ATTRIBUTE_UNUSED;
+ asection *section;
+ const struct coff_section_alignment_entry *alignment_table;
+ const unsigned int table_size;
+{
+ const unsigned int default_alignment = COFF_DEFAULT_SECTION_ALIGNMENT_POWER;
+ unsigned int i;
+
+ for (i = 0; i < table_size; ++i)
+ {
+ const char *secname = bfd_get_section_name (abfd, section);
+ if (alignment_table[i].comparison_length == (unsigned int) -1
+ ? strcmp (alignment_table[i].name, secname) == 0
+ : strncmp (alignment_table[i].name, secname,
+ alignment_table[i].comparison_length) == 0)
+ break;
+ }
+ if (i >= table_size)
+ return;
+
+ if (alignment_table[i].default_alignment_min != COFF_ALIGNMENT_FIELD_EMPTY
+ && default_alignment < alignment_table[i].default_alignment_min)
+ return;
+
+ if (alignment_table[i].default_alignment_max != COFF_ALIGNMENT_FIELD_EMPTY
+ && default_alignment > alignment_table[i].default_alignment_max)
+ return;
+
+ section->alignment_power = alignment_table[i].alignment_power;
+}
+
+/* Custom section alignment records. */
+
+static const struct coff_section_alignment_entry
+coff_section_alignment_table[] =
+{
+#ifdef COFF_SECTION_ALIGNMENT_ENTRIES
+ COFF_SECTION_ALIGNMENT_ENTRIES,
+#endif
+ /* There must not be any gaps between .stabstr sections. */
+ { COFF_SECTION_NAME_PARTIAL_MATCH (".stabstr"),
+ 1, COFF_ALIGNMENT_FIELD_EMPTY, 0 },
+ /* The .stab section must be aligned to 2**2 at most, to avoid gaps. */
+ { COFF_SECTION_NAME_PARTIAL_MATCH (".stab"),
+ 3, COFF_ALIGNMENT_FIELD_EMPTY, 2 },
+ /* Similarly for the .ctors and .dtors sections. */
+ { COFF_SECTION_NAME_EXACT_MATCH (".ctors"),
+ 3, COFF_ALIGNMENT_FIELD_EMPTY, 2 },
+ { COFF_SECTION_NAME_EXACT_MATCH (".dtors"),
+ 3, COFF_ALIGNMENT_FIELD_EMPTY, 2 }
+};
+
+static const unsigned int coff_section_alignment_table_size =
+ sizeof coff_section_alignment_table / sizeof coff_section_alignment_table[0];
+
+/* Initialize a section structure with information peculiar to this
+ particular implementation of COFF. */