new_contents, loc, input_section->size))
goto error_return;
- if (contents != NULL)
- free (contents);
+ free (contents);
return TRUE;
error_return:
- if (contents != NULL)
- free (contents);
+ free (contents);
return FALSE;
}
(_("%pB: duplicate section `%pA' has different contents\n"),
sec->owner, sec);
- if (sec_contents)
- free (sec_contents);
- if (l_sec_contents)
- free (l_sec_contents);
+ free (sec_contents);
+ free (l_sec_contents);
}
break;
}
section = h->u.c.p->section;
/* Increase the size of the section to align the common symbol.
- The alignment must be a power of two. */
- alignment = bfd_octets_per_byte (output_bfd, section) << power_of_two;
+ The alignment must be a power of two. But if the section does
+ not have any alignment requirement then do not increase the
+ alignment unnecessarily. */
+ if (power_of_two)
+ alignment = bfd_octets_per_byte (output_bfd, section) << power_of_two;
+ else
+ alignment = 1;
BFD_ASSERT (alignment != 0 && (alignment & -alignment) == alignment);
section->size += alignment - 1;
section->size &= -alignment;