This is the mail archive of the binutils@sourceware.org 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]

Re: PATCH: Linker failed to handle symbols with mismatched types


On Thu, Mar 02, 2006 at 12:43:17PM +1030, Alan Modra wrote:
> On Tue, Feb 28, 2006 at 01:48:22PM -0800, H. J. Lu wrote:
> > 	PR ld/2404
> > 	* elflink.c (_bfd_elf_merge_symbol): Skip the default indirect
> > 	symbol from the dynamic definition with the default version if
> > 	its type and the type of exiting regular definition mismatch.
> 
> I think the concept is reasonable, but I'd like to hear Ian's opinion
> before giving an OK.  Also, I'm wondering if you should check for type
> mismatches earlier, to avoid errors with tls syms.

Here is the updated patch.


H.J.
----
2006-03-02  H.J. Lu  <hongjiu.lu@intel.com>

	PR ld/2404
	* elflink.c (_bfd_elf_merge_symbol): Skip the default indirect
	symbol from the dynamic definition with the default version if
	its type and the type of exiting regular definition mismatch.

--- bfd/elflink.c.mis	2006-03-02 06:33:15.000000000 -0800
+++ bfd/elflink.c	2006-03-02 06:35:31.000000000 -0800
@@ -888,6 +888,22 @@ _bfd_elf_merge_symbol (bfd *abfd,
 	    && h->root.type != bfd_link_hash_undefweak
 	    && h->root.type != bfd_link_hash_common);
 
+  /* When we try to create a default indirect symbol from the dynamic
+     definition with the default version, we skip it if its type and
+     the type of exiting regular definition mismatch.  */
+  if (pold_alignment == NULL
+      && newdyn
+      && newdef
+      && !olddyn
+      && (olddef || h->root.type == bfd_link_hash_common)
+      && ELF_ST_TYPE (sym->st_info) != h->type
+      && ELF_ST_TYPE (sym->st_info) != STT_NOTYPE
+      && h->type != STT_NOTYPE)
+    {
+      *skip = TRUE;
+      return TRUE;
+    }
+
   /* Check TLS symbol.  We don't check undefined symbol introduced by
      "ld -u".  */
   if ((ELF_ST_TYPE (sym->st_info) == STT_TLS || h->type == STT_TLS)


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