aboutsummaryrefslogtreecommitdiff
path: root/gas/config
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2013-09-18 07:50:34 +0000
committerNick Clifton <nickc@redhat.com>2013-09-18 07:50:34 +0000
commitab90591541a18371d9676ce8d731ff50d4f74a90 (patch)
tree12da79250b827ea4133bba8143a0f6f9329d8696 /gas/config
parentee47b2f89d1b45727d1867e6b5b3c137bbcfe792 (diff)
downloadgdb-ab90591541a18371d9676ce8d731ff50d4f74a90.zip
gdb-ab90591541a18371d9676ce8d731ff50d4f74a90.tar.gz
gdb-ab90591541a18371d9676ce8d731ff50d4f74a90.tar.bz2
* config/tc-msp430.c (OPTION_MOVE_DATA): Define.
(move_data): New variable. (md_parse_option): Parse -md. (msp430_section): New function. Catch references to the .bss or .data sections and generate a special symbol for use by the libcrt library. (md_pseudo_table): Intercept .section directives. (md_longopt): Add -md (md_show_usage): Likewise. (msp430_operands): Generate a warning message if a NOP is inserted into the instruction stream. * doc/c-msp430.texi (node MSP430 Options): Document -md option.
Diffstat (limited to 'gas/config')
-rw-r--r--gas/config/tc-msp430.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/gas/config/tc-msp430.c b/gas/config/tc-msp430.c
index e16fcd9..4f34a37 100644
--- a/gas/config/tc-msp430.c
+++ b/gas/config/tc-msp430.c
@@ -1123,6 +1123,8 @@ static bfd_boolean large_model = FALSE;
#define OPTION_NO_INTR_NOPS 'N'
static bfd_boolean gen_interrupt_nops = TRUE;
#define OPTION_MCPU 'c'
+#define OPTION_MOVE_DATA 'd'
+static bfd_boolean move_data = FALSE;
static void
msp430_set_arch (int option)
@@ -1210,16 +1212,44 @@ md_parse_option (int c, char * arg)
case OPTION_NO_INTR_NOPS:
gen_interrupt_nops = FALSE;
return 1;
+
+ case OPTION_MOVE_DATA:
+ move_data = TRUE;
+ return 1;
}
return 0;
}
+static void
+msp430_section (int arg)
+{
+ char * saved_ilp = input_line_pointer;
+ char * name = obj_elf_section_name ();
+
+ if (strncmp (name, ".bss", 4) == 0
+ || strncmp (name, ".gnu.linkonce.b.", 16) == 0)
+ (void) symbol_find_or_make ("__crt0_init_bss");
+
+ if (move_data
+ && (strncmp (name, ".data", 5) == 0
+ || strncmp (name, ".gnu.linkonce.d.", 16) == 0))
+ (void) symbol_find_or_make ("__crt0_movedata");
+
+ input_line_pointer = saved_ilp;
+ obj_elf_section (arg);
+}
+
const pseudo_typeS md_pseudo_table[] =
{
{"arch", msp430_set_arch, OPTION_MMCU},
{"cpu", msp430_set_arch, OPTION_MCPU},
{"profiler", msp430_profiler, 0},
+ {"section", msp430_section, 0},
+ {"section.s", msp430_section, 0},
+ {"sect", msp430_section, 0},
+ {"sect.s", msp430_section, 0},
+ {"pushsection", msp430_section, 1},
{NULL, NULL, 0}
};
@@ -1233,6 +1263,7 @@ struct option md_longopts[] =
{"mQ", no_argument, NULL, OPTION_RELAX},
{"ml", no_argument, NULL, OPTION_LARGE},
{"mN", no_argument, NULL, OPTION_NO_INTR_NOPS},
+ {"md", no_argument, NULL, OPTION_MOVE_DATA},
{NULL, no_argument, NULL, 0}
};
@@ -1252,6 +1283,8 @@ md_show_usage (FILE * stream)
_(" -ml - enable large code model\n"));
fprintf (stream,
_(" -mN - disable generation of NOP after changing interrupts\n"));
+ fprintf (stream,
+ _(" -md - Force copying of data from ROM to RAM at startup\n"));
show_mcu_list (stream);
}
@@ -2201,6 +2234,8 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
See 1.3.4.1 of the MSP430x5xx User Guide. */
insn_length += 2;
frag = frag_more (2);
+ as_warn (_("a NOP instruction has been inserted after %s"),
+ opcode->name);
bfd_putl16 ((bfd_vma) 0x4303 /* NOP */, frag);
}
dwarf2_emit_insn (insn_length);
@@ -2285,6 +2320,8 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
insn_length += 2;
frag = frag_more (2);
bfd_putl16 ((bfd_vma) 0x4303 /* NOP */, frag);
+ as_warn (_("a NOP instruction has been inserted after %s"),
+ opcode->name);
}
dwarf2_emit_insn (insn_length);
@@ -3041,6 +3078,8 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
insn_length += 2;
frag = frag_more (2);
bfd_putl16 ((bfd_vma) 0x4303 /* NOP */, frag);
+ as_warn (_("a NOP instruction has been inserted after %s"),
+ opcode->name);
}
dwarf2_emit_insn (insn_length);