[PATCH] remove -t/--itbl options for targets not supporting them

Jan Beulich jbeulich@novell.com
Tue Sep 25 15:26:00 GMT 2007


Until I was able to look into what gas' --itbl option really is for I
was always assuming this would be something generic (i.e. for [almost]
all architectures). Now that I looked at it, I think it is really
inappropriate to show this option on all targets, even those that don't
support it.

Built and tested on x86_64-unknown-linux-gnu.

gas/
2007-09-25  Jan Beulich  <jbeulich@novell.com>

	* as.c (itbl_parse): Remove #define.
	(struct itbl_file_list): Move down and ...
	(itbl_files): .. conditionalize upon HAVE_ITBL_CPU.
	(show_usage): Conditionalize printing of --itbl option upon
	HAVE_ITBL_CPU.
	(parse_args): Conditionalize handling of -t/--itbl options upon
	HAVE_ITBL_CPU. Remove OPTION_INSTTBL and replace its use with
	't'.

--- 2007-09-25/gas/as.c	2007-09-11 12:23:33.000000000 +0200
+++ 2007-09-25/gas/as.c	2007-09-21 17:22:36.000000000 +0200
@@ -45,7 +45,6 @@
 #ifdef HAVE_ITBL_CPU
 #include "itbl-ops.h"
 #else
-#define itbl_parse(itbl_file) 1
 #define itbl_init()
 #endif
 
@@ -60,13 +59,6 @@ extern PTR sbrk ();
 extern void gas_cgen_begin (void);
 #endif
 
-/* Keep a record of the itbl files we read in.  */
-struct itbl_file_list
-{
-  struct itbl_file_list *next;
-  char *name;
-};
-
 /* We build a list of defsyms as we read the options, and then define
    them after we have initialized everything.  */
 struct defsym_list
@@ -117,7 +109,15 @@ static char *listing_filename = NULL;
 
 static struct defsym_list *defsyms;
 
+#ifdef HAVE_ITBL_CPU
+/* Keep a record of the itbl files we read in.  */
+struct itbl_file_list
+{
+  struct itbl_file_list *next;
+  char *name;
+};
 static struct itbl_file_list *itbl_files;
+#endif
 
 static long start_time;
 
@@ -323,9 +323,11 @@ Options:\n\
   --warn                  don't suppress warnings\n"));
   fprintf (stream, _("\
   --fatal-warnings        treat warnings as errors\n"));
+#ifdef HAVE_ITBL_CPU
   fprintf (stream, _("\
   --itbl INSTTBL          extend instruction set to include instructions\n\
                           matching the specifications defined in file INSTTBL\n"));
+#endif
   fprintf (stream, _("\
   -w                      ignored\n"));
   fprintf (stream, _("\
@@ -392,8 +394,10 @@ parse_args (int * pargc, char *** pargv)
     'v',
 #endif
     'w', 'X',
+#ifdef HAVE_ITBL_CPU
     /* New option for extending instruction set (see also --itbl below).  */
     't', ':',
+#endif
     '\0'
   };
   struct option *longopts;
@@ -411,7 +415,6 @@ parse_args (int * pargc, char *** pargv)
       OPTION_EMULATION,
       OPTION_DEBUG_PREFIX_MAP,
       OPTION_DEFSYM,
-      OPTION_INSTTBL,
       OPTION_LISTING_LHS_WIDTH,
       OPTION_LISTING_LHS_WIDTH2,
       OPTION_LISTING_RHS_WIDTH,
@@ -466,13 +469,15 @@ parse_args (int * pargc, char *** pargv)
     ,{"gstabs+", no_argument, NULL, OPTION_GSTABS_PLUS}
     ,{"hash-size", required_argument, NULL, OPTION_HASH_TABLE_SIZE}
     ,{"help", no_argument, NULL, OPTION_HELP}
+#ifdef HAVE_ITBL_CPU
     /* New option for extending instruction set (see also -t above).
        The "-t file" or "--itbl file" option extends the basic set of
        valid instructions by reading "file", a text file containing a
        list of instruction formats.  The additional opcodes and their
        formats are added to the built-in set of instructions, and
        mnemonics for new registers may also be defined.  */
-    ,{"itbl", required_argument, NULL, OPTION_INSTTBL}
+    ,{"itbl", required_argument, NULL, 't'}
+#endif
     /* getopt allows abbreviations, so we do this to stop it from
        treating -k as an abbreviation for --keep-locals.  Some
        ports use -k to enable PIC assembly.  */
@@ -648,7 +653,7 @@ This program has absolutely no warranty.
 	  }
 	  break;
 
-	case OPTION_INSTTBL:
+#ifdef HAVE_ITBL_CPU
 	case 't':
 	  {
 	    /* optarg is the name of the file containing the instruction
@@ -676,6 +681,7 @@ This program has absolutely no warranty.
 			itbl_files->name);
 	  }
 	  break;
+#endif
 
 	case OPTION_DEPFILE:
 	  start_dependencies (optarg);




More information about the Binutils mailing list