* emultempl/elf-generic.em (map_segments): Reorganise loop so that

layout happens before segment map.  Don't do segment map on
	relocatable link.
This commit is contained in:
Alan Modra 2006-07-26 12:27:12 +00:00
parent a7f651f7f2
commit 00bb149b28
2 changed files with 26 additions and 19 deletions

View File

@ -1,3 +1,9 @@
2006-07-26 Alan Modra <amodra@bigpond.net.au>
* emultempl/elf-generic.em (map_segments): Reorganise loop so that
layout happens before segment map. Don't do segment map on
relocatable link.
2006-07-26 Alan Modra <amodra@bigpond.net.au>
* ldexp.c (fold_name <LOADADDR>): Use the lma.

View File

@ -28,9 +28,26 @@ gld${EMULATION_NAME}_map_segments (bfd_boolean need_layout)
{
int tries = 10;
while (tries)
do
{
if (output_bfd->xvec->flavour == bfd_target_elf_flavour)
if (need_layout)
{
lang_reset_memory_regions ();
/* Resize the sections. */
lang_size_sections (NULL, TRUE);
/* Redo special stuff. */
ldemul_after_allocation ();
/* Do the assignments again. */
lang_do_assignments ();
need_layout = FALSE;
}
if (output_bfd->xvec->flavour == bfd_target_elf_flavour
&& !link_info.relocatable)
{
bfd_size_type phdr_size;
@ -45,24 +62,8 @@ gld${EMULATION_NAME}_map_segments (bfd_boolean need_layout)
if (phdr_size != elf_tdata (output_bfd)->program_header_size)
need_layout = TRUE;
}
if (!need_layout)
break;
lang_reset_memory_regions ();
/* Resize the sections. */
lang_size_sections (NULL, TRUE);
/* Redo special stuff. */
ldemul_after_allocation ();
/* Do the assignments again. */
lang_do_assignments ();
need_layout = FALSE;
--tries;
}
while (need_layout && --tries);
if (tries == 0)
einfo (_("%P%F: looping in map_segments"));