diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2006-04-06 18:52:46 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2006-04-06 18:52:46 +0000 |
commit | fbbc375958301d22e296eccef0ff31b36c75d9ca (patch) | |
tree | 5978463f47363265740b2ab8986a62a69ad9faa8 /ld/ldlang.c | |
parent | 7f198e01c2e54f523e8f27c8b485a81643801a0b (diff) | |
download | gdb-fbbc375958301d22e296eccef0ff31b36c75d9ca.zip gdb-fbbc375958301d22e296eccef0ff31b36c75d9ca.tar.gz gdb-fbbc375958301d22e296eccef0ff31b36c75d9ca.tar.bz2 |
bfd/
2006-04-06 H.J. Lu <hongjiu.lu@intel.com>
* elfxx-ia64.c (elfNN_ia64_relax_section): Skip unneeded passes
with the skip_relax_pass_0 and skip_relax_pass_1 bits in the
section structure.
include/
2006-04-06 H.J. Lu <hongjiu.lu@intel.com>
* bfdlink.h (bfd_link_info): Replace need_relax_finalize with
relax_pass.
ld/
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.
Diffstat (limited to 'ld/ldlang.c')
-rw-r--r-- | ld/ldlang.c | 68 |
1 files changed, 39 insertions, 29 deletions
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 (); |