* config/tc-i386.h (tc_comment_chars): Define.
authorAlan Modra <amodra@gmail.com>
Mon, 7 Nov 2005 06:01:18 +0000 (06:01 +0000)
committerAlan Modra <amodra@gmail.com>
Mon, 7 Nov 2005 06:01:18 +0000 (06:01 +0000)
* config/tc-i386.c (line_comment_chars): Use '/' unconditionally.
(i386_comment_chars): Add.
(md_parse_options): Process OPTION_DIVIDE.
(md_show_usage): Describe --divide option.
* doc/c-i386.texi: Document --divide option.

gas/ChangeLog
gas/config/tc-i386.c
gas/config/tc-i386.h
gas/doc/c-i386.texi

index 7de85364e617e865ef431cec381e79e0f9cf3b34..b7ec09a04f8cf894dac418805afa2cfd23620a54 100644 (file)
@@ -1,3 +1,12 @@
+2005-11-07  John Levon  <levon@movementarian.org>
+
+       * config/tc-i386.h (tc_comment_chars): Define.
+       * config/tc-i386.c (line_comment_chars): Use '/' unconditionally.
+       (i386_comment_chars): Add.
+       (md_parse_options): Process OPTION_DIVIDE.
+       (md_show_usage): Describe --divide option.
+       * doc/c-i386.texi: Document --divide option.
+
 2005-11-07  Arnold Metselaar  <arnold.metselaar@planet.nl>
 
        * expr.c (op_encoding): Map '=' to O_SINGLE_EQ, if defined.
index a3cd6c8ca7248e87a1813cbcbaec7e702e7dfc70..26121907fb2a7d173ac0bb5d2557281a4907fdcb 100644 (file)
@@ -203,10 +203,17 @@ const char extra_symbol_chars[] = "*%-(["
         && !defined (TE_FreeBSD)                       \
         && !defined (TE_NetBSD)))
 /* This array holds the chars that always start a comment.  If the
-   pre-processor is disabled, these aren't very useful.  */
-const char comment_chars[] = "#/";
+   pre-processor is disabled, these aren't very useful.  The option
+   --divide will remove '/' from this list.  */
+const char *i386_comment_chars = "#/";
+#define SVR4_COMMENT_CHARS 1
 #define PREFIX_SEPARATOR '\\'
 
+#else
+const char *i386_comment_chars = "#";
+#define PREFIX_SEPARATOR '/'
+#endif
+
 /* This array holds the chars that only start a comment at the beginning of
    a line.  If the line seems to have the form '# 123 filename'
    .line and .file directives will appear in the pre-processed output.
@@ -215,16 +222,7 @@ const char comment_chars[] = "#/";
    #NO_APP at the beginning of its output.
    Also note that comments started like this one will always work if
    '/' isn't otherwise defined.  */
-const char line_comment_chars[] = "#";
-
-#else
-/* Putting '/' here makes it impossible to use the divide operator.
-   However, we need it for compatibility with SVR4 systems.  */
-const char comment_chars[] = "#";
-#define PREFIX_SEPARATOR '/'
-
-const char line_comment_chars[] = "/#";
-#endif
+const char line_comment_chars[] = "#/";
 
 const char line_separator_chars[] = ";";
 
@@ -5302,13 +5300,16 @@ const char *md_shortopts = "kVQ:sqn";
 const char *md_shortopts = "qn";
 #endif
 
-struct option md_longopts[] = {
 #define OPTION_32 (OPTION_MD_BASE + 0)
+#define OPTION_64 (OPTION_MD_BASE + 1)
+#define OPTION_DIVIDE (OPTION_MD_BASE + 2)
+
+struct option md_longopts[] = {
   {"32", no_argument, NULL, OPTION_32},
 #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
-#define OPTION_64 (OPTION_MD_BASE + 1)
   {"64", no_argument, NULL, OPTION_64},
 #endif
+  {"divide", no_argument, NULL, OPTION_DIVIDE},
   {NULL, no_argument, NULL, 0}
 };
 size_t md_longopts_size = sizeof (md_longopts);
@@ -5370,6 +5371,23 @@ md_parse_option (c, arg)
       default_arch = "i386";
       break;
 
+    case OPTION_DIVIDE:
+#ifdef SVR4_COMMENT_CHARS
+      {
+       char *n, *t;
+       const char *s;
+
+       n = (char *) xmalloc (strlen (i386_comment_chars) + 1);
+       t = n;
+       for (s = i386_comment_chars; *s != '\0'; s++)
+         if (*s != '/')
+           *t++ = *s;
+       *t = '\0';
+       i386_comment_chars = n;
+      }
+#endif
+      break;
+
     default:
       return 0;
     }
@@ -5384,14 +5402,21 @@ md_show_usage (stream)
   fprintf (stream, _("\
   -Q                      ignored\n\
   -V                      print assembler version number\n\
-  -k                      ignored\n\
+  -k                      ignored\n"));
+#endif
+  fprintf (stream, _("\
   -n                      Do not optimize code alignment\n\
-  -q                      quieten some warnings\n\
+  -q                      quieten some warnings\n"));
+#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
+  fprintf (stream, _("\
   -s                      ignored\n"));
+#endif
+#ifdef SVR4_COMMENT_CHARS
+  fprintf (stream, _("\
+  --divide                do not treat `/' as a comment character\n"));
 #else
   fprintf (stream, _("\
-  -n                      Do not optimize code alignment\n\
-  -q                      quieten some warnings\n"));
+  --divide                ignored\n"));
 #endif
 }
 
index 40b92b0feb04088af97edfcc1cbc35cb3cd1ed22..0a9cd1c082980c5e8968cb397a2fc6b128f36da6 100644 (file)
@@ -88,6 +88,9 @@ extern void i386_elf_emit_arch_note PARAMS ((void));
 extern const char extra_symbol_chars[];
 #define tc_symbol_chars extra_symbol_chars
 
+extern const char *i386_comment_chars;
+#define tc_comment_chars i386_comment_chars
+
 #define MAX_OPERANDS 3         /* max operands per insn */
 #define MAX_IMMEDIATE_OPERANDS 2/* max immediates per insn (lcall, ljmp) */
 #define MAX_MEMORY_OPERANDS 2  /* max memory refs per insn (string ops) */
index 678dfe34deb3d7c14b1af43d7699e0904b8f3e44..81039c4dbe72a0295670b24d2858feb5e0e6cd9d 100644 (file)
@@ -67,6 +67,15 @@ usage and use x86-64 as target platform).
 By default, x86 GAS replaces multiple nop instructions used for
 alignment within code sections with multi-byte nop instructions such
 as leal 0(%esi,1),%esi.  This switch disables the optimization.
+
+@cindex @samp{--divide} option, i386
+@item --divide
+On SVR4-derived platforms, the character @samp{/} is treated as a comment
+character, which means that it cannot be used in expressions.  The
+@samp{--divide} option turns @samp{/} into a normal character.  This does
+not disable @samp{/} at the beginning of a line starting a comment, or
+affect using @samp{#} for starting a comment.
+
 @end table
 
 @node i386-Syntax
This page took 0.034615 seconds and 4 git commands to generate.