diff options
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 12 | ||||
-rw-r--r-- | ld/emultempl/ia64elf.em | 2 | ||||
-rw-r--r-- | ld/ldlang.c | 68 | ||||
-rw-r--r-- | ld/ldmain.c | 2 |
4 files changed, 53 insertions, 31 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 300fb6b..f68e6a3 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,15 @@ +2006-04-06 H.J. Lu <hongjiu.lu@intel.com> + + * emultempl/ia64elf.em: Set link_info.relax_pass to 2. Remove + link_info.need_relax_finalize. + + * ldlang.c (relax_sections): New. + (lang_process): Use. Call relax_sections link_info.relax_pass + times. + + * ldmain.c (main): Set link_info.relax_pass to 1. Remove + link_info.need_relax_finalize. + 2006-04-05 Alan Modra <amodra@bigpond.net.au> * Makefile.am (GENSCRIPTS): Pass prefix. diff --git a/ld/emultempl/ia64elf.em b/ld/emultempl/ia64elf.em index d41fa00..ddc5370 100644 --- a/ld/emultempl/ia64elf.em +++ b/ld/emultempl/ia64elf.em @@ -32,7 +32,7 @@ static int itanium = 0; static void gld${EMULATION_NAME}_after_parse (void) { - link_info.need_relax_finalize = TRUE; + link_info.relax_pass = 2; bfd_elf${ELFSIZE}_ia64_after_parse (itanium); } diff --git a/ld/ldlang.c b/ld/ldlang.c index 66219f0..8d4d9e9 100644 --- a/ld/ldlang.c +++ b/ld/ldlang.c @@ -5411,6 +5411,37 @@ lang_gc_sections (void) bfd_gc_sections (output_bfd, &link_info); } +/* Relax all sections until bfd_relax_section gives up. */ + +static void +relax_sections (void) +{ + /* Keep relaxing until bfd_relax_section gives up. */ + bfd_boolean relax_again; + + do + { + relax_again = FALSE; + + /* Note: pe-dll.c does something like this also. If you find + you need to change this code, you probably need to change + pe-dll.c also. DJ */ + + /* Do all the assignments with our current guesses as to + section sizes. */ + lang_do_assignments (); + + /* We must do this after lang_do_assignments, because it uses + size. */ + lang_reset_memory_regions (); + + /* Perform another relax pass - this time we know where the + globals are, so can make a better guess. */ + lang_size_sections (&relax_again, FALSE); + } + while (relax_again); +} + void lang_process (void) { @@ -5507,38 +5538,17 @@ lang_process (void) /* Now run around and relax if we can. */ if (command_line.relax) { - /* Keep relaxing until bfd_relax_section gives up. */ - bfd_boolean relax_again; - - do - { - relax_again = FALSE; + /* We may need more than one relaxation pass. */ + int i = link_info.relax_pass; - /* Note: pe-dll.c does something like this also. If you find - you need to change this code, you probably need to change - pe-dll.c also. DJ */ + /* The backend can use it to determine the current pass. */ + link_info.relax_pass = 0; - /* Do all the assignments with our current guesses as to - section sizes. */ - lang_do_assignments (); - - /* We must do this after lang_do_assignments, because it uses - size. */ - lang_reset_memory_regions (); - - /* Perform another relax pass - this time we know where the - globals are, so can make a better guess. */ - lang_size_sections (&relax_again, FALSE); - - /* If the normal relax is done and the relax finalize pass - is not performed yet, we perform another relax pass. */ - if (!relax_again && link_info.need_relax_finalize) - { - link_info.need_relax_finalize = FALSE; - relax_again = TRUE; - } + while (i--) + { + relax_sections (); + link_info.relax_pass++; } - while (relax_again); /* Final extra sizing to report errors. */ lang_do_assignments (); diff --git a/ld/ldmain.c b/ld/ldmain.c index 3093bdb..db87a40 100644 --- a/ld/ldmain.c +++ b/ld/ldmain.c @@ -313,7 +313,7 @@ main (int argc, char **argv) link_info.spare_dynamic_tags = 5; link_info.flags = 0; link_info.flags_1 = 0; - link_info.need_relax_finalize = FALSE; + link_info.relax_pass = 1; link_info.warn_shared_textrel = FALSE; link_info.gc_sections = FALSE; |