This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PATCH: Linker failed to handle symbols with mismatched types
- From: "H. J. Lu" <hjl at lucon dot org>
- To: binutils at sources dot redhat dot com
- Date: Tue, 28 Feb 2006 13:48:22 -0800
- Subject: PATCH: Linker failed to handle symbols with mismatched types
When we create the default indirect symbol from the dynamic definition
with the default version, we should check if the type of exiting
regular definition matches. If not, we shouldn't create the default
indirect symbol.
H.J.
---
2006-02-28 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-02-27 15:51:31.000000000 -0800
+++ bfd/elflink.c 2006-02-28 13:39:58.000000000 -0800
@@ -1018,6 +1018,22 @@ _bfd_elf_merge_symbol (bfd *abfd,
return TRUE;
}
+ /* 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;
+ }
+
/* Differentiate strong and weak symbols. */
newweak = bind == STB_WEAK;
oldweak = (h->root.type == bfd_link_hash_defweak