aboutsummaryrefslogtreecommitdiff
path: root/gas/config
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2005-11-07 06:01:18 +0000
committerAlan Modra <amodra@gmail.com>2005-11-07 06:01:18 +0000
commitb3b91714e232061888a000aa811cebbcf1cb61b7 (patch)
treea056ccfa72f0959aa37997f7d153fb14f58041b8 /gas/config
parentfb7ccfc159511562e051e679bf046cdee0d995a7 (diff)
downloadgdb-b3b91714e232061888a000aa811cebbcf1cb61b7.zip
gdb-b3b91714e232061888a000aa811cebbcf1cb61b7.tar.gz
gdb-b3b91714e232061888a000aa811cebbcf1cb61b7.tar.bz2
* 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.
Diffstat (limited to 'gas/config')
-rw-r--r--gas/config/tc-i386.c61
-rw-r--r--gas/config/tc-i386.h3
2 files changed, 46 insertions, 18 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index a3cd6c8..2612190 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -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
}
diff --git a/gas/config/tc-i386.h b/gas/config/tc-i386.h
index 40b92b0..0a9cd1c 100644
--- a/gas/config/tc-i386.h
+++ b/gas/config/tc-i386.h
@@ -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) */