This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: The relax finalize pass has broken relax for h8300-coff


On Tue, Dec 02, 2003 at 09:48:09AM +1030, Alan Modra wrote:
> On Wed, Nov 26, 2003 at 01:38:35PM -0800, H. J. Lu wrote:
> > 	* bout.c (b_out_bfd_relax_section): Skip the relax finalize
> > 	pass.
> > 	* coff-mips.c (mips_relax_section): Likewise.
> > 	* coff-sh.c (sh_relax_section): Likewise.
> > 	* elf-m10200.c (mn10200_elf_relax_section): Likewise.
> > 	* elf-m10300.c (mn10300_elf_relax_section): Likewise.
> > 	* elf32-h8300.c (elf32_h8_relax_section): Likewise.
> > 	* elf32-ip2k.c (ip2k_elf_relax_section): Likewise.
> > 	* elf32-m68hc11.c (m68hc11_elf_relax_section): Likewise.
> > 	* elf32-ppc.c (ppc_elf_relax_section): Likewise.
> > 	* elf32-sh.c (sh_elf_relax_section): Likewise.
> > 	* elf32-v850.c (v850_elf_relax_section): Likewise.
> > 	* elf32-xstormy16.c (xstormy16_elf_relax_section): Likewise.
> > 	* elf32-xtensa.c (elf_xtensa_relax_section): Likewise.
> > 	* elf64-alpha.c (elf64_alpha_relax_section): Likewise.
> > 	* elf64-mmix.c (x_elf_relax_section): Likewise.
> > 	* elfxx-mips.c (_bfd_mips_relax_section): Likewise.
> > 	* reloc16.c (bfd_coff_reloc16_relax_section): Likewise.
> 
> Instead of this, I suggest adding a need_relax_finalize flag to
> link_info, set by the ia64 backend and tested in lang_process.
> 

Here is the new patch.


H.J.
----
bfd/

2003-12-04  H.J. Lu  <hongjiu.lu@intel.com>

	* elfxx-ia64.c (elfNN_ia64_relax_section): Use the
	need_relax_finalize field in link_info instead of
	relax_finalizing to check if the relax finalize pass is being
	done.

include/

2003-12-04  H.J. Lu  <hongjiu.lu@intel.com>

	* bfdlink.h (bfd_link_info): Change relax_finalizing to
	need_relax_finalize.

ld/

2003-12-04  H.J. Lu  <hongjiu.lu@intel.com>

	* emultempl/ia64elf.em (gld${EMULATION_NAME}_after_parse): Set
	link_info.need_relax_finalize to TRUE.

	* ldlang.c (lang_process): Use link_info.need_relax_finalize
	instead of link_info.relax_finalizing.
	* ldmain.c (main): Likewise.
	
--- binutils/bfd/elfxx-ia64.c.final	2003-12-04 10:52:02.000000000 -0800
+++ binutils/bfd/elfxx-ia64.c	2003-12-04 11:13:18.000000000 -0800
@@ -724,7 +724,7 @@ elfNN_ia64_relax_section (abfd, sec, lin
      the relax finalize pass.  */
   if ((sec->flags & SEC_RELOC) == 0
       || sec->reloc_count == 0
-      || (link_info->relax_finalizing
+      || (!link_info->need_relax_finalize
 	  && sec->need_finalize_relax == 0))
     return TRUE;
 
@@ -775,14 +775,14 @@ elfNN_ia64_relax_section (abfd, sec, lin
 	case R_IA64_PCREL21BI:
 	case R_IA64_PCREL21M:
 	case R_IA64_PCREL21F:
-	  if (link_info->relax_finalizing)
+	  if (!link_info->need_relax_finalize)
 	    continue;
 	  is_branch = TRUE;
 	  break;
 
 	case R_IA64_LTOFF22X:
 	case R_IA64_LDXMOV:
-	  if (!link_info->relax_finalizing)
+	  if (link_info->need_relax_finalize)
 	    {
 	      sec->need_finalize_relax = 1;
 	      continue;
@@ -1083,7 +1083,7 @@ elfNN_ia64_relax_section (abfd, sec, lin
       /* ??? Resize .rela.got too.  */
     }
 
-  if (link_info->relax_finalizing)
+  if (!link_info->need_relax_finalize)
     sec->need_finalize_relax = 0;
 
   *again = changed_contents || changed_relocs;
--- binutils/include/bfdlink.h.final	2003-12-04 10:43:26.000000000 -0800
+++ binutils/include/bfdlink.h	2003-12-04 11:10:43.000000000 -0800
@@ -285,8 +285,8 @@ 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;
+  /* TRUE if the final relax pass is needed.  */
+  unsigned int need_relax_finalize: 1;
 
   /* TRUE if generating a position independent executable.  */
   unsigned int pie: 1;
--- binutils/ld/emultempl/ia64elf.em.final	2003-10-16 23:22:28.000000000 -0700
+++ binutils/ld/emultempl/ia64elf.em	2003-12-04 11:05:16.000000000 -0800
@@ -32,6 +32,7 @@ static int itanium = 0;
 static void
 gld${EMULATION_NAME}_after_parse (void)
 {
+  link_info.need_relax_finalize = TRUE;
   bfd_elf${ELFSIZE}_ia64_after_parse (itanium);
 }
 
--- binutils/ld/ldlang.c.final	2003-12-04 11:32:50.000000000 -0800
+++ binutils/ld/ldlang.c	2003-12-04 11:10:09.000000000 -0800
@@ -4262,9 +4262,9 @@ lang_process (void)
 
 	  /* 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)
+	  if (!relax_again && link_info.need_relax_finalize)
 	    {
-	      link_info.relax_finalizing = TRUE;
+	      link_info.need_relax_finalize = FALSE;
 	      relax_again = TRUE;
 	    }
 	}
--- binutils/ld/ldmain.c.final	2003-12-04 11:32:51.000000000 -0800
+++ binutils/ld/ldmain.c	2003-12-04 11:13:48.000000000 -0800
@@ -321,7 +321,7 @@ main (int argc, char **argv)
   link_info.spare_dynamic_tags = 5;
   link_info.flags = 0;
   link_info.flags_1 = 0;
-  link_info.relax_finalizing = FALSE;
+  link_info.need_relax_finalize = FALSE;
 
   ldfile_add_arch ("");
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]