This is the mail archive of the binutils@sourceware.org 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]

Re: PATCH: Optimize ia64 linker relaxation


On Wed, 2006-04-05 at 15:26, H. J. Lu wrote:
> There are many target specific fields in bfd_section, like
> need_finalize_relax, has_gp_reloc. Right now, we have

I see that has_gp_reloc has the same problem.  It is used in only one
place, in elf64-ppc.c, and that file uses a define to rename it to
has_toc_reloc.

I think renaming them to something like target_bit_1 is a good idea.  It
solves the problem of trying to remember why we have need_finalize_relax
and has_gp_reloc fields in bfd_section.

> +      /* We may need more than one relaxation pass.  */
> +      int i = link_info.relax_pass;
> +      /* The backend can use it to determine the current pass.  */
> +      link_info.relax_pass = 0;
> +      while (i--)
> +	{
> +	  relax_sections ();
> +	  link_info.relax_pass++;
>  	}

Dave Korn complained about the dual meaning of relax_pass.  One way to
solve it would be to rewrite this code as
  while (link_info.relax_pass--)
    relax_sections ();
And now relax_pass has only one meaning: the number of remaining
relaxation passes.  It can still be used by the backends to determine
the current pass, they just need to count backwards instead of
forwards.  It isn't clear whether this is better though, since the
current dual meaning doesn't seem that confusing to me, especially now
that it is documented.

The patch looks OK to me.
-- 
Jim Wilson, GNU Tools Support, http://www.specifix.com


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