PATCH: Fix mixed ELF32 and ELF64 in archive

H. J. Lu hjl@lucon.org
Fri Feb 27 22:46:00 GMT 2004


When there are mixed ELF32 and ELF64 objects in archive and linker
supporting both, linker gets really confused since the wrong
value/function are used. When we deal with archive, we can't assume
the size and we have to get the right thing from the backend. This
patch fixes it. Ok to install?


H.J.
-------------- next part --------------
2004-02-27  H.J. Lu  <hongjiu.lu@intel.com>

	* elflink.h (elf_link_is_defined_archive_symbol): Get the size
	of ELF symbol table entry from backend.
	(elf_link_add_archive_symbols): Call bfd_link_add_symbols
	instead of elf_link_add_object_symbols.

--- bfd/elflink.h.mixed	2004-02-27 09:41:43.000000000 -0800
+++ bfd/elflink.h	2004-02-27 14:37:04.000000000 -0800
@@ -121,7 +121,7 @@ elf_link_is_defined_archive_symbol (bfd 
   else
     hdr = &elf_tdata (abfd)->dynsymtab_hdr;
 
-  symcount = hdr->sh_size / sizeof (Elf_External_Sym);
+  symcount = hdr->sh_size / get_elf_backend_data (abfd)->s->sizeof_sym;
 
   /* The sh_info field of the symtab header tells us where the
      external symbols start.  We don't care about the local symbols.  */
@@ -347,7 +347,7 @@ elf_link_add_archive_symbols (bfd *abfd,
 	  if (! (*info->callbacks->add_archive_element) (info, element,
 							 symdef->name))
 	    goto error_return;
-	  if (! elf_link_add_object_symbols (element, info))
+	  if (! bfd_link_add_symbols (element, info))
 	    goto error_return;
 
 	  /* If there are any new undefined symbols, we need to make


More information about the Binutils mailing list