public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Adjust Thumb PLT entries
@ 2006-07-20 19:28 Daniel Jacobowitz
  2006-08-08 11:56 ` Nick Clifton
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Jacobowitz @ 2006-07-20 19:28 UTC (permalink / raw)
  To: binutils

I saw a bug report today that binutils would sometimes fail to create a
four-byte Thumb header on a PLT entry, despite a Thumb branch targeting
it.  The testcase used a uClibc configuration where a normal
application referencing open picks up the archive containing it;
open becomes a weakdef.  We copy the plt_thumb_refcount from open to
__libc_open, but we don't copy plt.refcount, since the common
copy_indirect_symbol returns early for non-indirect symbols
(copy_indirect_symbol can be called without an indirect symbol... yeah,
don't you just love interface creep?).

I think this is the natural fix and it appears to work for me.  OK?

-- 
Daniel Jacobowitz
CodeSourcery

2006-07-20  Daniel Jacobowitz  <dan@codesourcery.com>

	* elf32-arm.c (elf32_arm_copy_indirect_symbol): Only copy
	plt_thumb_refcount from indirect symbols.

Index: elf32-arm.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.c,v
retrieving revision 1.83
diff -u -p -r1.83 elf32-arm.c
--- elf32-arm.c	23 Jun 2006 02:58:00 -0000	1.83
+++ elf32-arm.c	20 Jul 2006 19:23:16 -0000
@@ -2351,15 +2351,17 @@ elf32_arm_copy_indirect_symbol (struct b
       eind->relocs_copied = NULL;
     }
 
-  /* Copy over PLT info.  */
-  edir->plt_thumb_refcount += eind->plt_thumb_refcount;
-  eind->plt_thumb_refcount = 0;
-
-  if (ind->root.type == bfd_link_hash_indirect
-      && dir->got.refcount <= 0)
+  if (ind->root.type == bfd_link_hash_indirect)
     {
-      edir->tls_type = eind->tls_type;
-      eind->tls_type = GOT_UNKNOWN;
+      /* Copy over PLT info.  */
+      edir->plt_thumb_refcount += eind->plt_thumb_refcount;
+      eind->plt_thumb_refcount = 0;
+
+      if (dir->got.refcount <= 0)
+	{
+	  edir->tls_type = eind->tls_type;
+	  eind->tls_type = GOT_UNKNOWN;
+	}
     }
 
   _bfd_elf_link_hash_copy_indirect (info, dir, ind);

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

* Re: Adjust Thumb PLT entries
  2006-07-20 19:28 Adjust Thumb PLT entries Daniel Jacobowitz
@ 2006-08-08 11:56 ` Nick Clifton
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Clifton @ 2006-08-08 11:56 UTC (permalink / raw)
  To: binutils

Hi Daniel,

> 2006-07-20  Daniel Jacobowitz  <dan@codesourcery.com>
> 
> 	* elf32-arm.c (elf32_arm_copy_indirect_symbol): Only copy
> 	plt_thumb_refcount from indirect symbols.
> 

Approved - please apply.

Cheers
   Nick

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

end of thread, other threads:[~2006-08-08 11:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-20 19:28 Adjust Thumb PLT entries Daniel Jacobowitz
2006-08-08 11:56 ` 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).