MSP430: gas: Ignore -md option required for GCC backward compatibility
authorJozef Lawrynowicz <jozef.l@mittosystems.com>
Thu, 12 Nov 2020 19:10:18 +0000 (19:10 +0000)
committerJozef Lawrynowicz <jozef.l@mittosystems.com>
Thu, 12 Nov 2020 19:27:04 +0000 (19:27 +0000)
The redundant -md option was removed in e4ae357fe8, but it is required
for backwards compatibility with GCC 10, which passes it to the
assembler implicitly in certain situations.

It is now silently ignored.

gas/ChangeLog:

* config/tc-msp430.c (OPTION_MOVE_DATA): Define.
(md_parse_option): Ignore OPTION_MOVE_DATA.
(md_longopts): Handle -md option.
* testsuite/gas/msp430/msp430.exp: Run new test.
* testsuite/gas/msp430/empty.s: New test.
* testsuite/gas/msp430/ignore-md.d: New test.

gas/ChangeLog
gas/config/tc-msp430.c
gas/testsuite/gas/msp430/empty.s [new file with mode: 0644]
gas/testsuite/gas/msp430/ignore-md.d [new file with mode: 0644]
gas/testsuite/gas/msp430/msp430.exp

index f412f9d27e03a17cde489963a04af31737775ef4..8976025a4623a6e7328e1dababea56f4e35a17dd 100644 (file)
@@ -1,3 +1,12 @@
+2020-11-12  Jozef Lawrynowicz  <jozef.l@mittosystems.com>
+
+       * config/tc-msp430.c (OPTION_MOVE_DATA): Define.
+       (md_parse_option): Ignore OPTION_MOVE_DATA.
+       (md_longopts): Handle -md option.
+       * testsuite/gas/msp430/msp430.exp: Run new test.
+       * testsuite/gas/msp430/empty.s: New test.
+       * testsuite/gas/msp430/ignore-md.d: New test.
+
 2020-11-12  Nick Clifton  <nickc@redhat.com>
 
        PR 26850
index 6d1803202ce7cfea1b280d38873f25efea0b717c..322ad7c7a4847ce69fe11fd80a45ba7f7aaef126 100644 (file)
@@ -690,6 +690,9 @@ static bfd_boolean upper_data_region_in_use = FALSE;
 /* The default is to use the lower region only.  */
 static bfd_boolean lower_data_region_only = TRUE;
 
+/* Deprecated option, silently ignore it for compatibility with GCC <= 10.  */
+#define OPTION_MOVE_DATA 'd'
+
 enum
 {
   OPTION_SILICON_ERRATA = OPTION_MD_BASE,
@@ -1465,6 +1468,10 @@ md_parse_option (int c, const char * arg)
       do_unknown_interrupt_nops = FALSE;
       return 1;
 
+    case OPTION_MOVE_DATA:
+      /* Silently ignored.  */
+      return 1;
+
     case OPTION_DATA_REGION:
       if (strcmp (arg, "upper") == 0
          || strcmp (arg, "either") == 0)
@@ -1750,6 +1757,7 @@ struct option md_longopts[] =
   {"my", no_argument, NULL, OPTION_WARN_INTR_NOPS},
   {"mu", no_argument, NULL, OPTION_UNKNOWN_INTR_NOPS},
   {"mU", no_argument, NULL, OPTION_NO_UNKNOWN_INTR_NOPS},
+  {"md", no_argument, NULL, OPTION_MOVE_DATA},
   {"mdata-region", required_argument, NULL, OPTION_DATA_REGION},
   {NULL, no_argument, NULL, 0}
 };
diff --git a/gas/testsuite/gas/msp430/empty.s b/gas/testsuite/gas/msp430/empty.s
new file mode 100644 (file)
index 0000000..910559d
--- /dev/null
@@ -0,0 +1,4 @@
+.text
+.global foo
+foo:
+.word 0
diff --git a/gas/testsuite/gas/msp430/ignore-md.d b/gas/testsuite/gas/msp430/ignore-md.d
new file mode 100644 (file)
index 0000000..2e55f22
--- /dev/null
@@ -0,0 +1,8 @@
+#name: Silently Ignore -md Option
+#source: empty.s
+#as: -md --fatal-warnings
+#DUMPPROG: nm
+
+#...
+.*foo.*
+#pass
index 624867f33b4d915302f3c5a41a35ee9c440734e3..ae9499cd61733fad3b48aa18a0c75720f65fc8ae 100644 (file)
@@ -53,4 +53,5 @@ if [expr [istarget "msp430-*-*"]]  then {
     run_dump_test "attr-430x-large-any-bad"
     run_dump_test "attr-430x-large-any-good"
     run_dump_test "reloc-lo-430x"
+    run_dump_test "ignore-md"
 }