public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* IA64 linker is broken
@ 2003-03-04 20:13 H. J. Lu
  2003-03-18 15:25 ` [PATCH] " Jakub Jelinek
  0 siblings, 1 reply; 3+ messages in thread
From: H. J. Lu @ 2003-03-04 20:13 UTC (permalink / raw)
  To: rth; +Cc: binutils

Hi Richard,

You added a call to get_dyn_sym_info in your last change without checking
relocation type. Now

--foo.s--
        .section .text
 {   .mib
        nop.m   0
        nop.i   0
        br.cond.dpnt.many       .b1_1 ;;
 }
        .section .text1
 .b1_1:
 {   .mii
        nop.m   0
        nop.i   0
        nop.i   0
 }
----

No longer works. You may want to check the relocation type first.


H.J.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] Re: IA64 linker is broken
  2003-03-04 20:13 IA64 linker is broken H. J. Lu
@ 2003-03-18 15:25 ` Jakub Jelinek
  2003-03-18 18:57   ` Richard Henderson
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Jelinek @ 2003-03-18 15:25 UTC (permalink / raw)
  To: H. J. Lu, rth; +Cc: binutils

On Tue, Mar 04, 2003 at 12:13:22PM -0800, H. J. Lu wrote:
> Hi Richard,
> 
> You added a call to get_dyn_sym_info in your last change without checking
> relocation type. Now
> 
> --foo.s--
>         .section .text
>  {   .mib
>         nop.m   0
>         nop.i   0
>         br.cond.dpnt.many       .b1_1 ;;
>  }
>         .section .text1
^^^^^^^^^^^^^^^^^^^^^^^^^^^ I guess you meant .section .text1, "ax", @progbits
here. Branches to unallocated sections aren't good idea.

>  .b1_1:
>  {   .mii
>         nop.m   0
>         nop.i   0
>         nop.i   0
>  }
> ----
> 
> No longer works. You may want to check the relocation type first.

But this is certainly true, dyn_i is only used for LTOFF22X and thus
IMHO should be only called in that case. Fixes H.J.'s testcase.
Ok to commit?

2003-03-18  Jakub Jelinek  <jakub@redhat.com>

	* elfxx-ia64.c (elfNN_ia64_relax_section): Only call
	get_dyn_sym_info for R_IA64_LTOFF22X relocations against local
	symbols.  Reported by H.J.Lu <hjl@gnu.org>.

--- bfd/elfxx-ia64.c.jj	2003-03-17 12:57:52.000000000 -0500
+++ bfd/elfxx-ia64.c	2003-03-18 10:07:30.000000000 -0500
@@ -791,7 +791,10 @@ elfNN_ia64_relax_section (abfd, sec, lin
 	    tsec = bfd_section_from_elf_index (abfd, isym->st_shndx);
 
 	  toff = isym->st_value + irel->r_addend;
-	  dyn_i = get_dyn_sym_info (ia64_info, NULL, abfd, irel, FALSE);
+	  if (r_type == R_IA64_LTOFF22X)
+	    dyn_i = get_dyn_sym_info (ia64_info, NULL, abfd, irel, FALSE);
+	  else
+	    dyn_i = NULL;
 	}
       else
 	{


	Jakub

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Re: IA64 linker is broken
  2003-03-18 15:25 ` [PATCH] " Jakub Jelinek
@ 2003-03-18 18:57   ` Richard Henderson
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2003-03-18 18:57 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: H. J. Lu, binutils

On Tue, Mar 18, 2003 at 04:25:51PM +0100, Jakub Jelinek wrote:
> 	* elfxx-ia64.c (elfNN_ia64_relax_section): Only call
> 	get_dyn_sym_info for R_IA64_LTOFF22X relocations against local
> 	symbols.  Reported by H.J.Lu <hjl@gnu.org>.

No.  First, this is also used for LDXMOV, second, I think the
better fix is in get_dyn_sym_info.


r~


	* elfxx-ia64.c (get_dyn_sym_info): Return NULL gracefully for
	local symbols that have no dyninfo.

Index: elfxx-ia64.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-ia64.c,v
retrieving revision 1.71
diff -u -p -u -r1.71 elfxx-ia64.c
--- elfxx-ia64.c	3 Mar 2003 23:19:19 -0000	1.71
+++ elfxx-ia64.c	18 Mar 2003 18:55:01 -0000
@@ -1965,7 +1965,11 @@ get_dyn_sym_info (ia64_info, h, abfd, re
       struct elfNN_ia64_local_hash_entry *loc_h;
 
       loc_h = get_local_sym_hash (ia64_info, abfd, rel, create);
-      BFD_ASSERT (loc_h);
+      if (!loc_h)
+	{
+	  BFD_ASSERT (!create);
+	  return NULL;
+	}
 
       pp = &loc_h->info;
     }

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-03-18 18:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-04 20:13 IA64 linker is broken H. J. Lu
2003-03-18 15:25 ` [PATCH] " Jakub Jelinek
2003-03-18 18:57   ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).