This is the mail archive of the binutils@sources.redhat.com 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]

[PATCH, arm] Support for Thumb init/fini entry points, take 2


Nick,

> I like this better.  I prefer target-specific patches which do not
> affect generic code.  Please could you have a go and see if this idea
> will work ?

Sure, how about this?

I regtested with the gcc testsuite with -mthumb and ran the ld
testsuite as well.

Note that this change does not rely on the ld/emultemp/armelf.em
change from the previous version of this patch that you have already
applied:

> > ld/ChangeLog:
> > 2002-08-12  Adam Nemet  <anemet@lnxw.com>
> > 
> > 	* emultempl/armelf.em: Include elf-bfd.h and elf/arm.h.
> > 	(arm_elf_finish): Set the last bit of DT_INIT and DT_FINI
> > 	depending on the type of the function.
> 
> This part of the patch is OK and I have applied it.  I made one change
> - I took the common bit of code from the creation of the three symbols
> and moved it into a seperate function.

Can you please revert above change.  I did all the testing with this
change being locally reverted in my tree.

Thanks,
Adam

2002-08-26  Adam Nemet  <anemet@lnxw.com>

	* elf32-arm.h (elf32_arm_finish_dynamic_sections): Set the last
	bit of DT_INIT and DT_FINI for Thumb functions.

Index: elf32-arm.h
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.h,v
retrieving revision 1.90
diff -u -p -r1.90 elf32-arm.h
--- elf32-arm.h	1 Aug 2002 14:03:01 -0000	1.90
+++ elf32-arm.h	26 Aug 2002 06:52:55 -0000
@@ -3546,6 +3693,33 @@ elf32_arm_finish_dynamic_sections (outpu
 		}
 	      bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
 	      break;
+
+	      /* Set the bottom bit of DT_INIT/FINI if the
+		 corresponding function is Thumb.  */
+	    case DT_INIT:
+	      name = info->init_function;
+	      goto get_sym;
+	    case DT_FINI:
+	      name = info->fini_function;
+	    get_sym:
+	      /* If it wasn't set by elf_bfd_final_link then there is
+		 nothing to ajdust.  */
+	      if (dyn.d_un.d_val == 0)
+		continue;
+
+	      {
+		struct elf_link_hash_entry * eh;
+
+		eh = elf_link_hash_lookup (elf_hash_table (info), name,
+					   false, false, true);
+		if (eh != (struct elf_link_hash_entry *) NULL
+		    && ELF_ST_TYPE (eh->type) == STT_ARM_TFUNC)
+		  {
+		    dyn.d_un.d_val |= 1;
+		    bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);		
+		  }
+		break;
+	      }
 	    }
 	}
 


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