[patch] Armvt interworking stub fix

Paul Brook paul@codesourcery.com
Tue Oct 31 09:55:00 GMT 2006


When creating an armv4t shared library, ld will try and create ARM export 
stubs for thumb symbols imported from other shared libraries.  These stubs 
should only be created for symbols defined in this shared library.

The patch below fixes this, and adds an assert in the place that was 
previously crashing.

Tested on arm-none-linux-gnueabi.
Ok?

Paul

2006-10-30  Paul Brook  <paul@codesourcery.com>

	bfd/
	* elf32-arm.c (elf32_arm_to_thumb_export_stub): Assert that output
	section is present.
	(allocate_dynrelocs): Only add export stub for symbols definind in
	this object.

Index: bfd/elf32-arm.c
===================================================================
RCS file: /var/cvsroot/src-cvs/src/bfd/elf32-arm.c,v
retrieving revision 1.70.2.17
diff -u -p -r1.70.2.17 elf32-arm.c
--- bfd/elf32-arm.c	29 Oct 2006 00:03:03 -0000	1.70.2.17
+++ bfd/elf32-arm.c	30 Oct 2006 19:48:43 -0000
@@ -3366,6 +3366,9 @@ elf32_arm_to_thumb_export_stub (struct e
   BFD_ASSERT (s->output_section != NULL);
 
   sec = eh->export_glue->root.u.def.section;
+
+  BFD_ASSERT (sec->output_section != NULL);
+
   val = eh->export_glue->root.u.def.value + sec->output_offset
 	+ sec->output_section->vma;
   myh = elf32_arm_create_thumb_stub (info, h->root.root.string,
@@ -7724,6 +7727,7 @@ allocate_dynrelocs (struct elf_link_hash
 
   /* Allocate stubs for exported Thumb functions on v4t.  */
   if (!htab->use_blx && h->dynindx != -1
+      && h->def_regular
       && ELF_ST_TYPE (h->type) == STT_ARM_TFUNC
       && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
     {



More information about the Binutils mailing list