bfd/
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 29 Apr 2003 01:53:46 +0000 (01:53 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Tue, 29 Apr 2003 01:53:46 +0000 (01:53 +0000)
2003-04-28  H.J. Lu <hjl@gnu.org>

* elfxx-ia64.c (elfNN_ia64_relax_section): Relax ldxmov during
the relax finalize pass.

* section.c (struct sec): Add need_finalize_relax and remove
flag11.
(STD_SECTION): Update struct sec initializer.
* bfd-in2.h: Regenerated.

include/

2003-04-28  H.J. Lu <hjl@gnu.org>

* bfdlink.h (bfd_link_info): Add relax_finalizing.

ld/

2003-04-28  H.J. Lu <hjl@gnu.org>

* ldlang.c (lang_process): Add the relax finalize pass.

* ldmain.c (main): Initialize link_info.relax_finalizing to
FALSE.

bfd/ChangeLog
bfd/bfd-in2.h
bfd/elfxx-ia64.c
bfd/section.c
include/ChangeLog
include/bfdlink.h
ld/ChangeLog
ld/ldlang.c
ld/ldmain.c

index f596fd2807ea2bc7f17fcb569fbdddd263d87851..51c0726875c6b38b320fd31232bccbd34a2da318 100644 (file)
@@ -1,3 +1,13 @@
+2003-04-28  H.J. Lu <hjl@gnu.org>
+
+       * elfxx-ia64.c (elfNN_ia64_relax_section): Relax ldxmov during
+       the relax finalize pass.
+
+       * section.c (struct sec): Add need_finalize_relax and remove
+       flag11.
+       (STD_SECTION): Update struct sec initializer.
+       * bfd-in2.h: Regenerated.
+
 2003-04-28  H.J. Lu <hjl@gnu.org>
 
        * elflink.h (elf_merge_symbol): Call elf_backend_copy_indirect_symbol
index d23a0b7a6b006a131d6dd930d8341e86c9b9ced8..9b6b5a393706bc2c7a297e15f34b9b28e26f8a96 100644 (file)
@@ -1291,8 +1291,10 @@ typedef struct sec
   /* Bits used by various backends.  */
   unsigned int has_tls_reloc:1;
 
+  /* Nonzero if this section needs the relax finalize pass.  */
+  unsigned int need_finalize_relax:1;
+
   /* Usused bits.  */
-  unsigned int flag11:1;
   unsigned int flag12:1;
   unsigned int flag13:1;
   unsigned int flag14:1;
index bff78c84345c164c18fd07aed44199daf7f92e0d..946157fd7bcd870c6130fbc7f573cf670aa293fa 100644 (file)
@@ -704,9 +704,12 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
   if (link_info->hash->creator->flavour != bfd_target_elf_flavour)
     return FALSE;
 
-  /* Nothing to do if there are no relocations.  */
+  /* Nothing to do if there are no relocations or there is no need for
+     the relax finalize pass.  */
   if ((sec->flags & SEC_RELOC) == 0
-      || sec->reloc_count == 0)
+      || sec->reloc_count == 0
+      || (link_info->relax_finalizing
+         && sec->need_finalize_relax == 0))
     return TRUE;
 
   /* If this is the first time we have been called for this section,
@@ -756,11 +759,18 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
        case R_IA64_PCREL21BI:
        case R_IA64_PCREL21M:
        case R_IA64_PCREL21F:
+         if (link_info->relax_finalizing)
+           continue;
          is_branch = TRUE;
          break;
 
        case R_IA64_LTOFF22X:
        case R_IA64_LDXMOV:
+         if (!link_info->relax_finalizing)
+           {
+             sec->need_finalize_relax = 1;
+             continue;
+           }
          is_branch = FALSE;
          break;
 
@@ -1047,6 +1057,9 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
       /* ??? Resize .rela.got too.  */
     }
 
+  if (link_info->relax_finalizing)
+    sec->need_finalize_relax = 0;
+
   *again = changed_contents || changed_relocs;
   return TRUE;
 
index 89f8126536cb45dc6b38c66c3cb4f292e89840f7..04f439e9b4e4c47490007e1c7c9b156160ec1f92 100644 (file)
@@ -396,8 +396,10 @@ CODE_FRAGMENT
 .  {* Bits used by various backends.  *}
 .  unsigned int has_tls_reloc:1;
 .
+.  {* Nonzero if this section needs the relax finalize pass.  *}
+.  unsigned int need_finalize_relax:1;
+.
 .  {* Usused bits.  *}
-.  unsigned int flag11:1;
 .  unsigned int flag12:1;
 .  unsigned int flag13:1;
 .  unsigned int flag14:1;
@@ -615,8 +617,8 @@ static const asymbol global_syms[] =
     /* linker_mark, linker_has_input, gc_mark, segment_mark,         */        \
        0,           0,                1,       0,                      \
                                                                        \
-    /* sec_info_type, use_rela_p, has_tls_reloc, flag11, flag12,     */ \
-       0,            0,          0,             0,      0,             \
+    /* sec_info_type, use_rela_p, has_tls_reloc, need_finalize_relax, flag12,     */ \
+       0,            0,          0,             0,                   0,                \
                                                                        \
     /* flag13, flag14, flag15, flag16, flag20, flag24,               */ \
        0,      0,      0,      0,      0,      0,                      \
index 3d7ec5caa7774ec680053bf42ba45577ca920773..6d18714eee2e6733b44391b3e45254dc2c7dae55 100644 (file)
@@ -1,3 +1,7 @@
+2003-04-28  H.J. Lu <hjl@gnu.org>
+
+       * bfdlink.h (bfd_link_info): Add relax_finalizing.
+
 2003-04-23  H.J. Lu <hjl@gnu.org>
 
        * bfdlink.h (bfd_link_callbacks): Add error_handler.
index acb7449e520b2238f45ca040fba03243afda5c92..380923a979218c4ed6012ccfb684b2a698d3c3bf 100644 (file)
@@ -288,6 +288,9 @@ struct bfd_link_info
   /* TRUE if global symbols in discarded sections should be stripped.  */
   unsigned int strip_discarded: 1;
 
+  /* TRUE if relaxation is being finalized.  */
+  unsigned int relax_finalizing: 1;
+
   /* Which symbols to strip.  */
   enum bfd_link_strip strip;
 
index 4f2445425e3dfebc9bba4d59fef15801c6d2a0c8..ced3178bb0370e79c9613215290674967e512ebf 100644 (file)
@@ -1,3 +1,10 @@
+2003-04-28  H.J. Lu <hjl@gnu.org>
+
+       * ldlang.c (lang_process): Add the relax finalize pass.
+
+       * ldmain.c (main): Initialize link_info.relax_finalizing to
+       FALSE.
+
 2003-04-24  Roland McGrath  <roland@redhat.com>
 
        * ldgram.y (phdr_type): Grok PT_TLS and PT_GNU_EH_FRAME names.
index 5cca71ff345564fbdd91bd8d4c75dfc90ce92588..884691702c9fb946570d4bd188fe4d0f8073fc51 100644 (file)
@@ -4393,6 +4393,14 @@ lang_process ()
                              abs_output_section,
                              &statement_list.head, 0, (bfd_vma) 0,
                              &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.relax_finalizing)
+           {
+             link_info.relax_finalizing = TRUE;
+             relax_again = TRUE;
+           }
        }
       while (relax_again);
 
index d8ee1b23e7f578476f343a265341f174c810d2e0..0b0b0383ac300f23169f6bb694ac002ef58324c6 100644 (file)
@@ -329,6 +329,7 @@ main (argc, argv)
   link_info.spare_dynamic_tags = 5;
   link_info.flags = (bfd_vma) 0;
   link_info.flags_1 = (bfd_vma) 0;
+  link_info.relax_finalizing = FALSE;
 
   ldfile_add_arch ("");