[oe-commits] Phil Blundell : apply patch from drow to fix linking of thumb binaries

git version control git at git.openembedded.org
Fri Sep 18 18:21:13 UTC 2009


Module: openembedded.git
Branch: org.openembedded.dev
Commit: 37ccccb96d9e7c337772064dc56f35af15e648d4
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=37ccccb96d9e7c337772064dc56f35af15e648d4

Author: Phil Blundell <philb at gnu.org>
Date:   Fri Sep 18 19:20:41 2009 +0100

apply patch from drow to fix linking of thumb binaries

---

 recipes/binutils/binutils-2.19.51/thumb-func.patch |   55 ++++++++++++++++++++
 recipes/binutils/binutils_2.19.51.bb               |    3 +-
 2 files changed, 57 insertions(+), 1 deletions(-)

diff --git a/recipes/binutils/binutils-2.19.51/thumb-func.patch b/recipes/binutils/binutils-2.19.51/thumb-func.patch
new file mode 100644
index 0000000..9c18eff
--- /dev/null
+++ b/recipes/binutils/binutils-2.19.51/thumb-func.patch
@@ -0,0 +1,55 @@
+Index: elf32-arm.c
+===================================================================
+RCS file: /cvs/src/src/bfd/elf32-arm.c,v
+retrieving revision 1.211
+retrieving revision 1.212
+diff -u -r1.211 -r1.212
+--- src/bfd/elf32-arm.c	29 Aug 2009 22:10:58 -0000	1.211
++++ src/bfd/elf32-arm.c	9 Sep 2009 18:36:10 -0000	1.212
+@@ -7036,6 +7036,9 @@
+ 			   + splt->output_offset
+ 			   + h->plt.offset);
+ 		  *unresolved_reloc_p = FALSE;
++		  /* The PLT entry is in ARM mode, regardless of the
++		     target function.  */
++		  sym_flags = STT_FUNC;
+ 		}
+ 
+ 	      from = (input_section->output_section->vma
+@@ -7452,10 +7455,14 @@
+  		/* If the Thumb BLX instruction is available, convert the
+ 		   BL to a BLX instruction to call the ARM-mode PLT entry.  */
+ 		lower_insn = (lower_insn & ~0x1000) | 0x0800;
++		sym_flags = STT_FUNC;
+  	      }
+  	    else
+- 	      /* Target the Thumb stub before the ARM PLT entry.  */
+- 	      value -= PLT_THUMB_STUB_SIZE;
++	      {
++		/* Target the Thumb stub before the ARM PLT entry.  */
++		value -= PLT_THUMB_STUB_SIZE;
++		sym_flags = STT_ARM_TFUNC;
++	      }
+ 	    *unresolved_reloc_p = FALSE;
+ 	  }
+ 
+@@ -11449,13 +11456,13 @@
+ 	    {
+ 	      h->root.u.def.section = s;
+ 	      h->root.u.def.value = h->plt.offset;
+-	    }
+ 
+-	  /* Make sure the function is not marked as Thumb, in case
+-	     it is the target of an ABS32 relocation, which will
+-	     point to the PLT entry.  */
+-	  if (ELF_ST_TYPE (h->type) == STT_ARM_TFUNC)
+-	    h->type = ELF_ST_INFO (ELF_ST_BIND (h->type), STT_FUNC);
++	      /* Make sure the function is not marked as Thumb, in case
++		 it is the target of an ABS32 relocation, which will
++		 point to the PLT entry.  */
++	      if (ELF_ST_TYPE (h->type) == STT_ARM_TFUNC)
++		h->type = ELF_ST_INFO (ELF_ST_BIND (h->type), STT_FUNC);
++	    }
+ 
+ 	  /* Make room for this entry.  */
+ 	  s->size += htab->plt_entry_size;
diff --git a/recipes/binutils/binutils_2.19.51.bb b/recipes/binutils/binutils_2.19.51.bb
index 20e86c7..a49445d 100644
--- a/recipes/binutils/binutils_2.19.51.bb
+++ b/recipes/binutils/binutils_2.19.51.bb
@@ -1,4 +1,4 @@
-PR = "r1"
+PR = "r2"
 
 require binutils.inc
 LICENSE = "GPLv3"
@@ -13,6 +13,7 @@ SRC_URI = "\
      file://binutils-uclibc-gas-needs-libm.patch;patch=1 \
      file://binutils-arm-pr7093.patch;patch=1 \
      file://ld-stub-crash.patch;patch=1;pnum=0 \
+     file://thumb-func.patch;patch=1 \
      "
 
 # powerpc patches





More information about the Openembedded-commits mailing list