+2005-11-16 Alan Modra <amodra@bigpond.net.au>
+
+ * ld.texinfo (Forced Output Alignment): Specify that this is an
+ alignment increase, not an override.
+ * ldlang.c (init_os): Set output section alignment here..
+ (lang_add_section): ..rather than here.
+ (lang_size_sections_1): Consolidate alignment code. Warn if section
+ alignment affects start address when explicit address given.
+
2005-11-07 Steve Ellcey <sje@cup.hp.com>
* configure: Regenerate after modifying bfd/warning.m4.
@kindex ALIGN(@var{section_align})
@cindex forcing output section alignment
@cindex output section alignment
-You can force an output section alignment by using ALIGN. The value
-specified overrides any alignment given by input sections, whether
-larger or smaller.
+You can increase an output section's alignment by using ALIGN.
@node Forced Input Alignment
@subsubsection Forced Input Alignment
if (s->load_base != NULL)
exp_init_os (s->load_base);
+ /* If supplied an alignment, set it. */
+ if (s->section_alignment != -1)
+ s->bfd_section->alignment_power = s->section_alignment;
+
if (isec)
bfd_init_private_section_data (isec->owner, isec,
output_bfd, s->bfd_section,
if (section->alignment_power > output->bfd_section->alignment_power)
output->bfd_section->alignment_power = section->alignment_power;
- /* If supplied an alignment, then force it. */
- if (output->section_alignment != -1)
- output->bfd_section->alignment_power = output->section_alignment;
-
if (bfd_get_arch (section->owner) == bfd_arch_tic54x
&& (section->flags & SEC_TIC54X_BLOCK) != 0)
{
}
else
{
+ bfd_vma savedot;
+
if (os->addr_tree == NULL)
{
/* No address specified for this section, get one
}
newdot = os->region->current;
-
- if (os->section_alignment == -1)
- {
- bfd_vma savedot = newdot;
- newdot = align_power (newdot,
- os->bfd_section->alignment_power);
-
- if (newdot != savedot
- && config.warn_section_align
- && expld.phase != lang_mark_phase_enum)
- einfo (_("%P: warning: changing start of section"
- " %s by %lu bytes\n"),
- os->name, (unsigned long) (newdot - savedot));
- }
}
- /* The section starts here.
- First, align to what the section needs. */
+ /* Align to what the section needs. */
+ savedot = newdot;
+ newdot = align_power (newdot,
+ os->bfd_section->alignment_power);
- if (os->section_alignment != -1)
- newdot = align_power (newdot, os->section_alignment);
+ if (newdot != savedot
+ && (config.warn_section_align
+ || os->addr_tree != NULL)
+ && expld.phase != lang_mark_phase_enum)
+ einfo (_("%P: warning: changing start of section"
+ " %s by %lu bytes\n"),
+ os->name, (unsigned long) (newdot - savedot));
bfd_set_section_vma (0, os->bfd_section, newdot);