This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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]

[commit] MIPS soft float automatic detecton


This patch uses the recently introduced .gnu_attribute mechanism
to automatically detect -msoft-float versus -mhard-float (and
-msingle-float versus -mdouble-float too).  If you have a new
enough compiler and binutils, this fixes a bundle of failures
when running the testsuite for mips-linux -msoft-float.  I
like how easy it was now that the infrastructure is in place!

Tested on MIPS (soft float o32, hard float o32, n32, n64) and
committed.

-- 
Daniel Jacobowitz
CodeSourcery

2007-08-22  Daniel Jacobowitz  <dan@codesourcery.com>

	* mips-tdep.c (mips_gdbarch_init): Use Tag_GNU_MIPS_ABI_FP to
	determine the file's FPU type.

Index: gdb/mips-tdep.c
===================================================================
--- gdb/mips-tdep.c	(revision 179591)
+++ gdb/mips-tdep.c	(working copy)
@@ -4862,6 +4927,7 @@ mips_gdbarch_init (struct gdbarch_info i
   int i, num_regs;
   enum mips_fpu_type fpu_type;
   struct tdesc_arch_data *tdesc_data = NULL;
+  int elf_fpu_type = 0;
 
   /* Check any target description for validity.  */
   if (tdesc_has_registers (info.target_desc))
@@ -5069,8 +5135,32 @@ mips_gdbarch_init (struct gdbarch_info i
 			mips64_transfers_32bit_regs_p);
 
   /* Determine the MIPS FPU type.  */
+#ifdef HAVE_ELF
+  if (info.abfd
+      && bfd_get_flavour (info.abfd) == bfd_target_elf_flavour)
+    elf_fpu_type = bfd_elf_get_obj_attr_int (info.abfd, OBJ_ATTR_GNU,
+					     Tag_GNU_MIPS_ABI_FP);
+#endif /* HAVE_ELF */
+
   if (!mips_fpu_type_auto)
     fpu_type = mips_fpu_type;
+  else if (elf_fpu_type != 0)
+    {
+      switch (elf_fpu_type)
+	{
+	case 1:
+	  fpu_type = MIPS_FPU_DOUBLE;
+	  break;
+	case 2:
+	  fpu_type = MIPS_FPU_SINGLE;
+	  break;
+	case 3:
+	default:
+	  /* Soft float or unknown.  */
+	  fpu_type = MIPS_FPU_NONE;
+	  break;
+	}
+    }
   else if (info.bfd_arch_info != NULL
 	   && info.bfd_arch_info->arch == bfd_arch_mips)
     switch (info.bfd_arch_info->mach)


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