aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2006-07-26 12:27:12 +0000
committerAlan Modra <amodra@gmail.com>2006-07-26 12:27:12 +0000
commit00bb149b2841c91bab43c976161e87fe26c86092 (patch)
tree25e31a0d6ee1faac829b4b50ddd79d85d862e963 /ld/emultempl/elf-generic.em
parent * ld-scripts/overlay-size-map.d: Update. (diff)
downloadbinutils-gdb-00bb149b2841c91bab43c976161e87fe26c86092.tar.gz
binutils-gdb-00bb149b2841c91bab43c976161e87fe26c86092.tar.bz2
binutils-gdb-00bb149b2841c91bab43c976161e87fe26c86092.zip
* emultempl/elf-generic.em (map_segments): Reorganise loop so that
layout happens before segment map. Don't do segment map on relocatable link.
Diffstat (limited to 'ld/emultempl/elf-generic.em')
-rw-r--r--ld/emultempl/elf-generic.em39
1 files changed, 20 insertions, 19 deletions
diff --git a/ld/emultempl/elf-generic.em b/ld/emultempl/elf-generic.em
index 5d65cdcd4b3..dd0907ccf82 100644
--- a/ld/emultempl/elf-generic.em
+++ b/ld/emultempl/elf-generic.em
@@ -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"));