- if (eh_alignment > 4)
- {
- /* Skip over zero terminator, and prevent empty sections
- from adding alignment padding at the end. */
- for (i = o->map_tail.s; i != NULL; i = i->map_tail.s)
- if (i->size == 0)
- i->flags |= SEC_EXCLUDE;
- else if (i->size > 4)
- break;
- /* The last non-empty eh_frame section doesn't need padding. */
- if (i != NULL)
- i = i->map_tail.s;
- /* Any prior sections must pad the last FDE out to the
- output section alignment. Otherwise we might have zero
- padding between sections, which would be seen as a
- terminator. If there is a terminator in the middle of
- FDEs, don't increase its size as that will write bogus
- data of whatever was after the terminator in the input
- file, to the output file. */
- for (; i != NULL; i = i->map_tail.s)
- if (i->size != 4)
+ /* Skip over zero terminator, and prevent empty sections from
+ adding alignment padding at the end. */
+ for (i = o->map_tail.s; i != NULL; i = i->map_tail.s)
+ if (i->size == 0)
+ i->flags |= SEC_EXCLUDE;
+ else if (i->size > 4)
+ break;
+ /* The last non-empty eh_frame section doesn't need padding. */
+ if (i != NULL)
+ i = i->map_tail.s;
+ /* Any prior sections must pad the last FDE out to the output
+ section alignment. Otherwise we might have zero padding
+ between sections, which would be seen as a terminator. */
+ for (; i != NULL; i = i->map_tail.s)
+ if (i->size == 4)
+ /* All but the last zero terminator should have been removed. */
+ BFD_FAIL ();
+ else
+ {
+ bfd_size_type size
+ = (i->size + eh_alignment - 1) & -eh_alignment;
+ if (i->size != size)