This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: section-relative relocs on ia64 (was: Re: Why does slurp_ia64_unwind_table complain unwind symbol type?)
On Wed, Oct 27, 2004 at 10:23:09PM +0930, Alan Modra wrote:
> On Wed, Oct 27, 2004 at 03:03:38AM -0700, David Mosberger wrote:
> > >>>>> On Tue, 26 Oct 2004 14:13:51 -0700, "H. J. Lu" <hjl@lucon.org> said:
> >
> > HJ> Here is a patch.
> >
> > Ah, that looks good (and easy).
> >
> > HJ> H.J.
> > HJ> + /* Make output-section relative to section where the symbol
> > HJ> + is defined. PR 475 */
> > HJ> + value -= sym_sec->output_section->vma;
> >
> > This is automatically guaranteed to never go negative, even for
> > corner-cases, such as weak symbols, right?
>
> Undefined weak might present a problem. They'll have sym_sec == NULL.
>
David,
Does it look right?
H.J.
---
2004-10-27 H.J. Lu <hongjiu.lu@intel.com>
* elfxx-ia64.c (elfNN_ia64_relocate_section): Handle weak
undefined symbols for R_IA64_SECREL32MSB, R_IA64_SECREL32LSB,
R_IA64_SECREL64MSB and R_IA64_SECREL64LSB.
--- bfd/elfxx-ia64.c.weak 2004-10-26 16:05:02.000000000 -0700
+++ bfd/elfxx-ia64.c 2004-10-27 08:40:24.092936792 -0700
@@ -4376,7 +4376,8 @@ elfNN_ia64_relocate_section (output_bfd,
case R_IA64_SECREL64LSB:
/* Make output-section relative to section where the symbol
is defined. PR 475 */
- value -= sym_sec->output_section->vma;
+ if (sym_sec)
+ value -= sym_sec->output_section->vma;
r = elfNN_ia64_install_value (hit_addr, value, r_type);
break;