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: RL78] Add support for 64-bit doubles


Hi,
Please find below a patch which adds support for 64-bit doubles to the RL78 target.
This is a supporting patch for my GCC patch posted earlier,
http://gcc.gnu.org/ml/gcc-patches/2014-05/msg00731.html

Kindly review the below patch. 

Thanks & Best Regards,
Kaushik

	bfd/Changelog
	* elf32-rl78.c (rl78_elf_merge_private_bfd_data): Complain if
	64-bit doubles objects mix with 32-bit doubles objects.
	(rl78_elf_print_private_bfd_data): Describe 64-bit doubles flag.
	binutils/Changelog
	* readelf.c (get_machine_flags): Handle RL78 64-bit doubles flag.
	gas/Changelog
	* config/tc-rl78.c (enum options): Add OPTION_32BIT_DOUBLES
	and OPTION_64BIT_DOUBLES.
	(md_longopts): Add -m32bit-doubles and -m64bit-doubles.
	(md_parse_option): Parse -m32bit-doubles and -m64bit-doubles.
	(md_show_usage): Show all of the RL78 options.
	(rl78_float_cons): New static functions.
	(md_pseudo_table): Update handler for "double".

	diff -upr a/bfd/elf32-rl78.c b/bfd/elf32-rl78.c
--- a/bfd/elf32-rl78.c	2013-10-09 21:14:27.000000000 +0530
+++ b/bfd/elf32-rl78.c	2014-05-14 10:38:54.000000000 +0530
@@ -1048,6 +1048,21 @@ rl78_elf_merge_private_bfd_data (bfd * i
 	    (*_bfd_error_handler) (_("- %s is G10, %s is not"),
 				   bfd_get_filename (ibfd), bfd_get_filename (obfd));
 	}
+      if (changed_flags & E_FLAG_RL78_64BIT_DOUBLES)
+	{
+	  (*_bfd_error_handler)
+	    (_("RL78 merge conflict: cannot link 32-bit and 64-bit objects together"));
+	  if (old_flags & E_FLAG_RL78_64BIT_DOUBLES)
+	    {
+	      (*_bfd_error_handler) (_("- %s is 64-bit, %s is not"),
+				    bfd_get_filename (obfd), bfd_get_filename (ibfd));
+	    }
+	  else
+	    {
+	      (*_bfd_error_handler) (_("- %s is 64-bit, %s is not"),
+				     bfd_get_filename (ibfd), bfd_get_filename (obfd));
+	    }
+	}    
     }
 
   return !error;
@@ -1070,6 +1085,9 @@ rl78_elf_print_private_bfd_data (bfd * a
   if (flags & E_FLAG_RL78_G10)
     fprintf (file, _(" [G10]"));
 
+  if (flags & E_FLAG_RL78_64BIT_DOUBLES)
+    fprintf (file, _(" [64-bit doubles]"));
+
   fputc ('\n', file);
   return TRUE;
 }
diff -upr a/binutils/readelf.c b/binutils/readelf.c
--- a/binutils/readelf.c	2013-10-15 00:15:46.000000000 +0530
+++ b/binutils/readelf.c	2014-05-14 10:38:54.000000000 +0530
@@ -2785,6 +2785,8 @@ get_machine_flags (unsigned e_flags, uns
 	case EM_RL78:
 	  if (e_flags & E_FLAG_RL78_G10)
 	    strcat (buf, ", G10");
+	  if (e_flags & E_FLAG_RL78_64BIT_DOUBLES)
+	    strcat (buf, ", 64-bit doubles");
 	  break;
 
 	case EM_RX:
diff -upr a/gas/config/tc-rl78.c b/gas/config/tc-rl78.c
--- a/gas/config/tc-rl78.c	2013-08-09 16:10:04.000000000 +0530
+++ b/gas/config/tc-rl78.c	2014-05-14 10:38:54.000000000 +0530
@@ -263,6 +263,8 @@ enum options
 {
   OPTION_RELAX = OPTION_MD_BASE,
   OPTION_G10,
+  OPTION_32BIT_DOUBLES,
+  OPTION_64BIT_DOUBLES,
 };
 
 #define RL78_SHORTOPTS ""
@@ -273,6 +275,8 @@ struct option md_longopts[] =
 {
   {"relax", no_argument, NULL, OPTION_RELAX},
   {"mg10", no_argument, NULL, OPTION_G10},
+  {"m32bit-doubles", no_argument, NULL, OPTION_32BIT_DOUBLES},
+  {"m64bit-doubles", no_argument, NULL, OPTION_64BIT_DOUBLES},
   {NULL, no_argument, NULL, 0}
 };
 size_t md_longopts_size = sizeof (md_longopts);
@@ -289,6 +293,14 @@ md_parse_option (int c, char * arg ATTRI
     case OPTION_G10:
       elf_flags |= E_FLAG_RL78_G10;
       return 1;
+
+    case OPTION_32BIT_DOUBLES:
+      elf_flags &= ~ E_FLAG_RL78_64BIT_DOUBLES;
+      return 1;
+
+    case OPTION_64BIT_DOUBLES:
+      elf_flags |= E_FLAG_RL78_64BIT_DOUBLES;
+      return 1;
     }
   return 0;
 }
@@ -296,6 +308,9 @@ md_parse_option (int c, char * arg ATTRI
 void
 md_show_usage (FILE * stream ATTRIBUTE_UNUSED)
 {
+  fprintf (stream, _(" RL78 specific command line options:\n"));
+  fprintf (stream, _("  --m32bit-doubles [default]\n"));
+  fprintf (stream, _("  --m64bit-doubles\n"));
 }
 
 
@@ -309,11 +324,19 @@ s_bss (int ignore ATTRIBUTE_UNUSED)
   demand_empty_rest_of_line ();
 }
 
+static void
+rl78_float_cons (int ignore ATTRIBUTE_UNUSED)
+{
+  if (elf_flags & E_FLAG_RL78_64BIT_DOUBLES)
+    return float_cons ('d');
+  return float_cons ('f');
+}
+
 /* The target specific pseudo-ops which we support.  */
 const pseudo_typeS md_pseudo_table[] =
 {
   /* Our "standard" pseudos. */
-  { "double",   float_cons,    'd' },
+  { "double",   rl78_float_cons,'d' },
   { "bss",	s_bss, 		0 },
   { "3byte",	cons,		3 },
   { "int",	cons,		4 },


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