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]: New options for HC11/HC12 gas to specify the ABI


Hi!

The HC11/HC12 port stores in the elf flags the ABI (16/32 bit int, 32/64 bit double).
It is possible to control the ABI by using a .mode opcode in gas.  This patch adds
several options to specify the ABI from the command line.  Options are named to follow
gcc (or be close to it).  Use of these options is easier in most cases.

I've committed this patch with associated doc.

	Stephane

2002-12-01  Stephane Carrez  <stcarrez@nerim.fr>

	* config/tc-m68hc11.c (elf_flags): Set default ABI to gcc default
	(32-bit int, 64-bit double).
	(md_longopts): New options -mshort, -mlong, -mshort-double and
	-mlong-double to control the ABI.
	(md_show_usage): Update.
	(md_parse_option): Handle new options.
	* doc/as.texinfo (Overview): Document new options for HC11/HC12.
Index: config/tc-m68hc11.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-m68hc11.c,v
retrieving revision 1.30
diff -u -p -r1.30 tc-m68hc11.c
--- config/tc-m68hc11.c	30 Nov 2002 08:39:43 -0000	1.30
+++ config/tc-m68hc11.c	1 Dec 2002 10:12:33 -0000
@@ -242,7 +242,7 @@ static int num_opcodes;
 static struct m68hc11_opcode *m68hc11_sorted_opcodes;
 
 /* ELF flags to set in the output file header.  */
-static int elf_flags = 0;
+static int elf_flags = E_M68HC11_F64;
 
 /* These are the machine dependent pseudo-ops.  These are included so
    the assembler can work on the output from the SUN C compiler, which
@@ -305,6 +305,18 @@ struct option md_longopts[] = {
 #define OPTION_GENERATE_EXAMPLE  (OPTION_MD_BASE + 5)
   {"generate-example", no_argument, NULL, OPTION_GENERATE_EXAMPLE},
 
+#define OPTION_MSHORT  (OPTION_MD_BASE + 6)
+  {"mshort", no_argument, NULL, OPTION_MSHORT},
+
+#define OPTION_MLONG  (OPTION_MD_BASE + 7)
+  {"mlong", no_argument, NULL, OPTION_MLONG},
+
+#define OPTION_MSHORT_DOUBLE  (OPTION_MD_BASE + 8)
+  {"mshort-double", no_argument, NULL, OPTION_MSHORT_DOUBLE},
+
+#define OPTION_MLONG_DOUBLE  (OPTION_MD_BASE + 9)
+  {"mlong-double", no_argument, NULL, OPTION_MLONG_DOUBLE},
+
   {NULL, no_argument, NULL, 0}
 };
 size_t md_longopts_size = sizeof (md_longopts);
@@ -356,6 +368,10 @@ md_show_usage (stream)
   fprintf (stream, _("\
 Motorola 68HC11/68HC12 options:\n\
   -m68hc11 | -m68hc12     specify the processor [default %s]\n\
+  -mshort                 use 16-bit int ABI (default)\n\
+  -mlong                  use 32-bit int ABI\n\
+  -mshort-double          use 32-bit double ABI\n\
+  -mlong-double           use 64-bit double ABI (default)\n\
   --force-long-branchs    always turn relative branchs into absolute ones\n\
   -S,--short-branchs      do not turn relative branchs into absolute ones\n\
                           when the offset is out of range\n\
@@ -455,6 +471,22 @@ md_parse_option (c, arg)
 
     case OPTION_GENERATE_EXAMPLE:
       flag_print_opcodes = 2;
+      break;
+
+    case OPTION_MSHORT:
+      elf_flags &= ~E_M68HC11_I32;
+      break;
+
+    case OPTION_MLONG:
+      elf_flags |= E_M68HC11_I32;
+      break;
+
+    case OPTION_MSHORT_DOUBLE:
+      elf_flags &= ~E_M68HC11_F64;
+      break;
+
+    case OPTION_MLONG_DOUBLE:
+      elf_flags |= E_M68HC11_F64;
       break;
 
     case 'm':
Index: doc/as.texinfo
===================================================================
RCS file: /cvs/src/src/gas/doc/as.texinfo,v
retrieving revision 1.70
diff -u -p -r1.70 as.texinfo
--- doc/as.texinfo	22 Aug 2002 20:10:53 -0000	1.70
+++ doc/as.texinfo	1 Dec 2002 10:12:38 -0000
@@ -363,6 +363,8 @@ gcc(1), ld(1), and the Info entries for 
 
 @emph{Target M68HC11 options:}
    [@b{-m68hc11}|@b{-m68hc12}]
+   [@b{-mshort}|@b{-mlong}]
+   [@b{-mshort-double}|@b{-mlong-double}]
    [@b{--force-long-branchs}] [@b{--short-branchs}]
    [@b{--strict-direct-mode}] [@b{--print-insn-syntax}]
    [@b{--print-opcodes}] [@b{--generate-example}]
@@ -801,6 +803,18 @@ Motorola 68HC11 or 68HC12 series.
 @item -m68hc11 | -m68hc12
 Specify what processor is the target.  The default is
 defined by the configuration option when building the assembler.
+
+@item -mshort
+Specify to use the 16-bit integer ABI.
+
+@item -mlong
+Specify to use the 32-bit integer ABI.  
+
+@item -mshort-double
+Specify to use the 32-bit double ABI.  
+
+@item -mlong-double
+Specify to use the 64-bit double ABI.  
 
 @item --force-long-branchs
 Relative branches are turned into absolute ones. This concerns

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