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]

[patch, binutils] Patch elf/mips.h for -mfp64 support.


We would like to enable Linux processes to use 64-bit FP registers (as
opposed to using register pairs for DP values) on 32-bit MIPS
processors.

Even though there are GNU attributes for this mode AFAICS, the GNU
attribution section is not being inspected by the Linux kernel, thus
adding a bit to the MIPS e_flag field is needed.

Is it OK if we apply the following patch so that we can proceed with
adding the support to the Linux kernel to support this mode?

Changelog entry:

2013-09-07  Doug Gilmore <doug.gilmore@imgtec.com>

	* mips.h (EF_MIPS_32BITMODE): New e_flags bit.
	* elfxx-mips.c check for EF_MIPS_32BITMODE, print [32bitfp64]
	* readelf.c check for EF_MIPS_32BITMODE, print 32bitfp64
	* tc-mips.c When it is appropriate, set EF_MIPS_32BITMODE.

Patch attached.

Thanks,

Doug
Index: bfd/elfxx-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-mips.c,v
retrieving revision 1.358
diff -u -p -r1.358 elfxx-mips.c
--- bfd/elfxx-mips.c	15 Jul 2013 15:07:29 -0000	1.358
+++ bfd/elfxx-mips.c	9 Sep 2013 21:24:38 -0000
@@ -14938,6 +14938,9 @@ _bfd_mips_elf_print_private_bfd_data (bf
   if (elf_elfheader (abfd)->e_flags & EF_MIPS_NAN2008)
     fprintf (file, " [nan2008]");
 
+  if (elf_elfheader (abfd)->e_flags & EF_MIPS_32BITMODE_FP64)
+    fprintf (file, " [32bitfp64]");
+
   if (elf_elfheader (abfd)->e_flags & EF_MIPS_32BITMODE)
     fprintf (file, " [32bitmode]");
   else
Index: binutils/readelf.c
===================================================================
RCS file: /cvs/src/src/binutils/readelf.c,v
retrieving revision 1.607
diff -u -p -r1.607 readelf.c
--- binutils/readelf.c	9 Aug 2013 10:40:03 -0000	1.607
+++ binutils/readelf.c	9 Sep 2013 21:24:38 -0000
@@ -2571,6 +2571,9 @@ get_machine_flags (unsigned e_flags, uns
 	  if (e_flags & EF_MIPS_NAN2008)
 	    strcat (buf, ", nan2008");
 
+	  if (e_flags & EF_MIPS_32BITMODE_FP64)
+	    strcat (buf, ", 32bitfp64");
+
 	  switch ((e_flags & EF_MIPS_MACH))
 	    {
 	    case E_MIPS_MACH_3900: strcat (buf, ", 3900"); break;
Index: gas/config/tc-mips.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mips.c,v
retrieving revision 1.591
diff -u -p -r1.591 tc-mips.c
--- gas/config/tc-mips.c	19 Aug 2013 20:07:09 -0000	1.591
+++ gas/config/tc-mips.c	9 Sep 2013 21:24:39 -0000
@@ -17207,11 +17207,9 @@ mips_elf_final_processing (void)
   if (mips_flag_nan2008)
     elf_elfheader (stdoutput)->e_flags |= EF_MIPS_NAN2008;
 
-#if 0 /* XXX FIXME */
   /* 32 bit code with 64 bit FP registers.  */
   if (!file_mips_fp32 && ABI_NEEDS_32BIT_REGS (mips_abi))
-    elf_elfheader (stdoutput)->e_flags |= ???;
-#endif
+    elf_elfheader (stdoutput)->e_flags |= EF_MIPS_32BITMODE_FP64;
 }
 
 typedef struct proc {
Index: include/elf/mips.h
===================================================================
RCS file: /cvs/src/src/include/elf/mips.h,v
retrieving revision 1.54
diff -u -p -r1.54 mips.h
--- include/elf/mips.h	15 Jul 2013 15:07:30 -0000	1.54
+++ include/elf/mips.h	9 Sep 2013 21:24:40 -0000
@@ -191,6 +191,9 @@ END_RELOC_NUMBERS (R_MIPS_maxext)
    (regs are 32-bits wide).  */
 #define EF_MIPS_32BITMODE	0x00000100
 
+/* 32-bit machine but FP registers are 64 bit (-mfp64).  */
+#define EF_MIPS_32BITMODE_FP64  0x00000200
+
 /* Code in file uses the IEEE 754-2008 NaN encoding convention.  */
 #define EF_MIPS_NAN2008		0x00000400
 

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