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]

Re: section-relative relocs on ia64 (was: Re: Why does slurp_ia64_unwind_table complain unwind symbol type?)


>>>>> On Wed, 27 Oct 2004 08:45:44 -0700, "H. J. Lu" <hjl@lucon.org> said:

  >> Undefined weak might present a problem.  They'll have sym_sec ==
  >> NULL.

  HJ> Does it look right?

  HJ> --- bfd/elfxx-ia64.c.weak	2004-10-26 16:05:02.000000000 -0700
  HJ> +++ bfd/elfxx-ia64.c	2004-10-27 08:40:24.092936792 -0700
  HJ> @@ -4376,7 +4376,8 @@ elfNN_ia64_relocate_section (output_bfd,
  HJ>  	case R_IA64_SECREL64LSB:
  HJ>  	  /* Make output-section relative to section where the symbol
  HJ>  	     is defined. PR 475  */
  HJ> -	  value -= sym_sec->output_section->vma;
  HJ> +	  if (sym_sec)
  HJ> +	    value -= sym_sec->output_section->vma;
  HJ>  	  r = elfNN_ia64_install_value (hit_addr, value, r_type);
  HJ>  	  break;

If we want to be paranoid, perhaps this would be safer:

	  if (sym_sec && value > sym_sec->output_section->vma)
	    value -= sym_sec->output_section->vma;
	  else
	    value = 0;

That should guarantee that we have no regression vs. the old code
(assuming sym_sec->output_section is never NULL).

Note that with the (corrected) interpretation of @symsec(expr), it's
impossible to have a real value that is negative, so "truncating" it
to zero is not a problem.

	--david


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