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]

Adjust Thumb PLT entries


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);


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