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]

more elf32/64 problems


Yet another restriction on calling elf_link_input_bfd.  It's not
sufficient to check reloc size matches, as some sections may not have
relocs.  When elf_link_input_bfd (compiled for the output elf class)
tries to load input bfd symbols of a different class, we get all sorts
of interesting errors.  eg. powerpc64-linux-ld presented with
powerpc-linux input:

ld: t.o: invalid string offset 188 >= 90 for section `.strtab'
ld: BFD 2.12.90 20020218 assertion fail /src/binutils/bfd/elflink.h:2649
ld: t.o: Relocation R_PPC64_RELATIVE is not supported for symbol <local symbol>.
ld: t.o: unknown relocation type 128 for symbol <local symbol>
ld: t.o: unknown relocation type 148 for symbol <local symbol>
ld: t.o: unknown relocation type -1325400064 for symbol <local symbol>
ld: t.o: unknown relocation type 67305472 for symbol <local symbol>
ld: t.o: unknown relocation type 168230912 for symbol <local symbol>
ld: t.o: unknown relocation type 168361984 for symbol <local symbol>
ld: final link failed: Bad value

	* elflink.h (elf_bfd_final_link): Ensure input bfd class is the
	same as the output before calling elf_link_input_bfd.

Index: bfd/elflink.h
===================================================================
RCS file: /cvs/src/src/bfd/elflink.h,v
retrieving revision 1.156
diff -u -p -r1.156 elflink.h
--- bfd/elflink.h	28 Mar 2002 03:27:45 -0000	1.156
+++ bfd/elflink.h	26 Apr 2002 08:25:02 -0000
@@ -5347,21 +5347,11 @@ elf_bfd_final_link (abfd, info)
     {
       for (p = o->link_order_head; p != NULL; p = p->next)
 	{
-	  Elf_Internal_Shdr *rhdr;
-
 	  if (p->type == bfd_indirect_link_order
-	      && (bfd_get_flavour (p->u.indirect.section->owner)
+	      && (bfd_get_flavour ((sub = p->u.indirect.section->owner))
 		  == bfd_target_elf_flavour)
-	      && (((rhdr = &elf_section_data (p->u.indirect.section)->rel_hdr)
-		   ->sh_entsize == 0)
-		  || rhdr->sh_entsize == sizeof (Elf_External_Rel)
-		  || rhdr->sh_entsize == sizeof (Elf_External_Rela))
-	      && (((rhdr = elf_section_data (p->u.indirect.section)->rel_hdr2)
-		   == NULL)
-		  || rhdr->sh_entsize == sizeof (Elf_External_Rel)
-		  || rhdr->sh_entsize == sizeof (Elf_External_Rela)))
+	      && (elf_elfheader (sub)->e_ident[EI_CLASS] == bed->s->elfclass))
 	    {
-	      sub = p->u.indirect.section->owner;
 	      if (! sub->output_has_begun)
 		{
 		  if (! elf_link_input_bfd (&finfo, sub))

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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