aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorMatt Jacobson <mhjacobson@me.com>2021-08-11 10:03:19 +0100
committerNick Clifton <nickc@redhat.com>2021-08-11 10:03:19 +0100
commitd86d1fc7f988f52da4711a86c078194347ab6482 (patch)
tree1086243d3c10740164fefb19bfcacd42f72d8f6d /gas
parentbda3d9fbc86950e4661188161ee643f0987d032c (diff)
downloadgdb-d86d1fc7f988f52da4711a86c078194347ab6482.zip
gdb-d86d1fc7f988f52da4711a86c078194347ab6482.tar.gz
gdb-d86d1fc7f988f52da4711a86c078194347ab6482.tar.bz2
Add a -mno-dollar-line-separator command line option to the AVR assembler.
Some frontends, like the gcc Objective-C frontend, emit symbols with $ characters in them. The AVR target code in gas treats $ as a line separator, so the code doesn?t assemble correctly. Provide a machine-specific option to disable treating $ as a line separator. * config/tc-avr.c (enum options): Add option flag. (struct option): Add option -mno-dollar-line-separator. (md_parse_option): Adjust treatment of $ when option is present. * config/tc-avr.h: Use avr_line_separator_chars.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog9
-rw-r--r--gas/config/tc-avr.c14
-rw-r--r--gas/config/tc-avr.h5
-rw-r--r--gas/doc/c-avr.texi9
4 files changed, 33 insertions, 4 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 14666b4..dd19f3e 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,12 @@
+2021-08-11 Matt Jacobson <mhjacobson@me.com>
+
+ * config/tc-avr.c (enum options): Add option flag.
+ (struct option): Add option -mno-dollar-line-separator.
+ (md_parse_option): Adjust treatment of $ when option is present.
+ (usage): Mention the new option.
+ * config/tc-avr.h: Use avr_line_separator_chars.
+ * doc/c-avr.texi: Document the new option.
+
2021-08-11 Nick Clifton <nickc@redhat.com>
* config/tc-tic4x.c (tic4x_gen_to_words): Fix typo.
diff --git a/gas/config/tc-avr.c b/gas/config/tc-avr.c
index 40dcce7..e731ea9 100644
--- a/gas/config/tc-avr.c
+++ b/gas/config/tc-avr.c
@@ -157,7 +157,9 @@ static struct avr_opcodes_s *avr_gccisr_opcode;
const char comment_chars[] = ";";
const char line_comment_chars[] = "#";
-const char line_separator_chars[] = "$";
+
+const char *avr_line_separator_chars = "$";
+static const char *avr_line_separator_chars_no_dollar = "";
const char *md_shortopts = "m:";
struct mcu_type_s
@@ -565,7 +567,8 @@ enum options
OPTION_ISA_RMW,
OPTION_LINK_RELAX,
OPTION_NO_LINK_RELAX,
- OPTION_HAVE_GCCISR
+ OPTION_HAVE_GCCISR,
+ OPTION_NO_DOLLAR_LINE_SEPARATOR,
};
struct option md_longopts[] =
@@ -578,6 +581,7 @@ struct option md_longopts[] =
{ "mlink-relax", no_argument, NULL, OPTION_LINK_RELAX },
{ "mno-link-relax", no_argument, NULL, OPTION_NO_LINK_RELAX },
{ "mgcc-isr", no_argument, NULL, OPTION_HAVE_GCCISR },
+ { "mno-dollar-line-separator", no_argument, NULL, OPTION_NO_DOLLAR_LINE_SEPARATOR },
{ NULL, no_argument, NULL, 0 }
};
@@ -687,6 +691,8 @@ md_show_usage (FILE *stream)
" -mlink-relax generate relocations for linker relaxation (default)\n"
" -mno-link-relax don't generate relocations for linker relaxation.\n"
" -mgcc-isr accept the __gcc_isr pseudo-instruction.\n"
+ " -mno-dollar-line-separator\n"
+ " do not treat the $ character as a line separator.\n"
));
show_mcu_list (stream);
}
@@ -756,6 +762,10 @@ md_parse_option (int c, const char *arg)
case OPTION_HAVE_GCCISR:
avr_opt.have_gccisr = 1;
return 1;
+ case OPTION_NO_DOLLAR_LINE_SEPARATOR:
+ avr_line_separator_chars = avr_line_separator_chars_no_dollar;
+ lex_type['$'] = LEX_NAME | LEX_BEGIN_NAME;
+ return 1;
}
return 0;
diff --git a/gas/config/tc-avr.h b/gas/config/tc-avr.h
index 0f85099..5862697 100644
--- a/gas/config/tc-avr.h
+++ b/gas/config/tc-avr.h
@@ -143,7 +143,7 @@ extern int avr_force_relocation (struct fix *);
would print `12 34 56 78'. The default value is 4. */
#define LISTING_WORD_SIZE 2
-/* AVR port uses `$' as a logical line separator. */
+/* AVR port uses `$' as a logical line separator by default. */
#define LEX_DOLLAR 0
/* An `.lcomm' directive with no explicit alignment parameter will
@@ -244,3 +244,6 @@ struct avr_frag_data
#define TC_FRAG_TYPE struct avr_frag_data
#define TC_FRAG_INIT(frag, max_bytes) avr_frag_init (frag)
extern void avr_frag_init (fragS *);
+
+#define tc_line_separator_chars avr_line_separator_chars
+extern const char *avr_line_separator_chars;
diff --git a/gas/doc/c-avr.texi b/gas/doc/c-avr.texi
index ab79739..f83cbe1 100644
--- a/gas/doc/c-avr.texi
+++ b/gas/doc/c-avr.texi
@@ -159,6 +159,12 @@ information.
@item -mgcc-isr
Enable the @code{__gcc_isr} pseudo instruction.
+@cindex @code{-mno-dollar-line-separator} command line option, AVR
+@item -mno-dollar-line-separator
+Do not treat the @code{$} character as a line separator character.
+This is for languages where @code{$} is valid character inside symbol
+names.
+
@end table
@@ -189,7 +195,8 @@ control command (@pxref{Preprocessing}).
@cindex AVR line separator
The @samp{$} character can be used instead of a newline to separate
-statements.
+statements. Note: the @option{-mno-dollar-line-separator} option
+disables this behaviour.
@node AVR-Regs
@subsection Register Names