public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Re: PATCH: Linker failed to handle symbols with mismatched types
       [not found] <20060228214822.GA11030@lucon.org>
@ 2006-03-02  2:13 ` Alan Modra
  2006-03-02 14:39   ` H. J. Lu
  0 siblings, 1 reply; 5+ messages in thread
From: Alan Modra @ 2006-03-02  2:13 UTC (permalink / raw)
  To: H. J. Lu; +Cc: binutils

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.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PATCH: Linker failed to handle symbols with mismatched types
  2006-03-02  2:13 ` PATCH: Linker failed to handle symbols with mismatched types Alan Modra
@ 2006-03-02 14:39   ` H. J. Lu
  2006-03-10  2:30     ` H. J. Lu
  0 siblings, 1 reply; 5+ messages in thread
From: H. J. Lu @ 2006-03-02 14:39 UTC (permalink / raw)
  To: binutils; +Cc: ian

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)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PATCH: Linker failed to handle symbols with mismatched types
  2006-03-02 14:39   ` H. J. Lu
@ 2006-03-10  2:30     ` H. J. Lu
  2006-03-10  3:49       ` H. J. Lu
  0 siblings, 1 reply; 5+ messages in thread
From: H. J. Lu @ 2006-03-10  2:30 UTC (permalink / raw)
  To: binutils

On Thu, Mar 02, 2006 at 06:39:10AM -0800, H. J. Lu wrote:
> 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.
> 

Can someone please take a look at

http://sourceware.org/ml/binutils/2006-03/msg00018.html

Thanks.


H.J.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PATCH: Linker failed to handle symbols with mismatched types
  2006-03-10  2:30     ` H. J. Lu
@ 2006-03-10  3:49       ` H. J. Lu
  2006-04-05 11:50         ` Nick Clifton
  0 siblings, 1 reply; 5+ messages in thread
From: H. J. Lu @ 2006-03-10  3:49 UTC (permalink / raw)
  To: binutils

On Thu, Mar 09, 2006 at 06:30:12PM -0800, H. J. Lu wrote:
> On Thu, Mar 02, 2006 at 06:39:10AM -0800, H. J. Lu wrote:
> > 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.
> > 
> 
> Can someone please take a look at
> 
> http://sourceware.org/ml/binutils/2006-03/msg00018.html

Here is the updated patch. We only skip the default indirect symbol if
the exiting regular definition won't be dynamic.


H.J.
----
2006-03-09  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-09 09:43:10.000000000 -0800
+++ bfd/elflink.c	2006-03-09 19:41:16.000000000 -0800
@@ -888,6 +888,26 @@ _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.  We only do it
+     if the exiting regular definition won't be dynamic.  */
+  if (pold_alignment == NULL
+      && !info->shared
+      && !info->export_dynamic
+      && !h->ref_dynamic
+      && 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)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PATCH: Linker failed to handle symbols with mismatched types
  2006-03-10  3:49       ` H. J. Lu
@ 2006-04-05 11:50         ` Nick Clifton
  0 siblings, 0 replies; 5+ messages in thread
From: Nick Clifton @ 2006-04-05 11:50 UTC (permalink / raw)
  To: H. J. Lu; +Cc: binutils

Hi H. J.

> 2006-03-09  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.

Approved - please apply, but ...

I think that you have a spelling typo in the ChangeLog and the comment 
in the patch: exiting -> existing.

Cheers
   Nick

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-04-05 11:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20060228214822.GA11030@lucon.org>
2006-03-02  2:13 ` PATCH: Linker failed to handle symbols with mismatched types Alan Modra
2006-03-02 14:39   ` H. J. Lu
2006-03-10  2:30     ` H. J. Lu
2006-03-10  3:49       ` H. J. Lu
2006-04-05 11:50         ` Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).