* 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.
This commit is contained in:
Alan Modra 2005-11-16 07:17:20 +00:00
parent c43c547375
commit 7270c5edcb
3 changed files with 27 additions and 25 deletions

View file

@ -1,3 +1,12 @@
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.

View file

@ -3775,9 +3775,7 @@ for (dst = &_bstart; dst< &_bend; dst++)
@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

View file

@ -1720,6 +1720,10 @@ init_os (lang_output_section_statement_type *s, asection *isec)
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,
@ -1941,10 +1945,6 @@ lang_add_section (lang_statement_list_type *ptr,
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)
{
@ -4144,6 +4144,8 @@ lang_size_sections_1
}
else
{
bfd_vma savedot;
if (os->addr_tree == NULL)
{
/* No address specified for this section, get one
@ -4193,27 +4195,20 @@ lang_size_sections_1
}
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);