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] Re: IA64 linker is broken


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 at redhat dot 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 at gnu dot 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


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