* 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.
This commit is contained in:
Alan Modra
2005-11-07 06:01:18 +00:00
parent fb7ccfc159
commit b3b91714e2
4 changed files with 65 additions and 19 deletions

View 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> 2005-11-07 Arnold Metselaar <arnold.metselaar@planet.nl>
* expr.c (op_encoding): Map '=' to O_SINGLE_EQ, if defined. * expr.c (op_encoding): Map '=' to O_SINGLE_EQ, if defined.

View File

@ -203,10 +203,17 @@ const char extra_symbol_chars[] = "*%-(["
&& !defined (TE_FreeBSD) \ && !defined (TE_FreeBSD) \
&& !defined (TE_NetBSD))) && !defined (TE_NetBSD)))
/* This array holds the chars that always start a comment. If the /* This array holds the chars that always start a comment. If the
pre-processor is disabled, these aren't very useful. */ pre-processor is disabled, these aren't very useful. The option
const char comment_chars[] = "#/"; --divide will remove '/' from this list. */
const char *i386_comment_chars = "#/";
#define SVR4_COMMENT_CHARS 1
#define PREFIX_SEPARATOR '\\' #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 /* 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' a line. If the line seems to have the form '# 123 filename'
.line and .file directives will appear in the pre-processed output. .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. #NO_APP at the beginning of its output.
Also note that comments started like this one will always work if Also note that comments started like this one will always work if
'/' isn't otherwise defined. */ '/' isn't otherwise defined. */
const char line_comment_chars[] = "#"; 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_separator_chars[] = ";"; const char line_separator_chars[] = ";";
@ -5302,13 +5300,16 @@ const char *md_shortopts = "kVQ:sqn";
const char *md_shortopts = "qn"; const char *md_shortopts = "qn";
#endif #endif
struct option md_longopts[] = {
#define OPTION_32 (OPTION_MD_BASE + 0) #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}, {"32", no_argument, NULL, OPTION_32},
#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
#define OPTION_64 (OPTION_MD_BASE + 1)
{"64", no_argument, NULL, OPTION_64}, {"64", no_argument, NULL, OPTION_64},
#endif #endif
{"divide", no_argument, NULL, OPTION_DIVIDE},
{NULL, no_argument, NULL, 0} {NULL, no_argument, NULL, 0}
}; };
size_t md_longopts_size = sizeof (md_longopts); size_t md_longopts_size = sizeof (md_longopts);
@ -5370,6 +5371,23 @@ md_parse_option (c, arg)
default_arch = "i386"; default_arch = "i386";
break; 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: default:
return 0; return 0;
} }
@ -5384,14 +5402,21 @@ md_show_usage (stream)
fprintf (stream, _("\ fprintf (stream, _("\
-Q ignored\n\ -Q ignored\n\
-V print assembler version number\n\ -V print assembler version number\n\
-k ignored\n\ -k ignored\n"));
-n Do not optimize code alignment\n\ #endif
-q quieten some warnings\n\
-s ignored\n"));
#else
fprintf (stream, _("\ fprintf (stream, _("\
-n Do not optimize code alignment\n\ -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, _("\
--divide ignored\n"));
#endif #endif
} }

View File

@ -88,6 +88,9 @@ extern void i386_elf_emit_arch_note PARAMS ((void));
extern const char extra_symbol_chars[]; extern const char extra_symbol_chars[];
#define tc_symbol_chars 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_OPERANDS 3 /* max operands per insn */
#define MAX_IMMEDIATE_OPERANDS 2/* max immediates per insn (lcall, ljmp) */ #define MAX_IMMEDIATE_OPERANDS 2/* max immediates per insn (lcall, ljmp) */
#define MAX_MEMORY_OPERANDS 2 /* max memory refs per insn (string ops) */ #define MAX_MEMORY_OPERANDS 2 /* max memory refs per insn (string ops) */

View File

@ -67,6 +67,15 @@ usage and use x86-64 as target platform).
By default, x86 GAS replaces multiple nop instructions used for By default, x86 GAS replaces multiple nop instructions used for
alignment within code sections with multi-byte nop instructions such alignment within code sections with multi-byte nop instructions such
as leal 0(%esi,1),%esi. This switch disables the optimization. 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 @end table
@node i386-Syntax @node i386-Syntax