Implement CONVERT_SYMBOLIC_ATTRIBUTE for MIPS.
authormfortune <matthew.fortune@imgtec.com>
Wed, 7 May 2014 21:37:00 +0000 (22:37 +0100)
committermfortune <matthew.fortune@imgtec.com>
Thu, 8 May 2014 14:09:35 +0000 (15:09 +0100)
gas/
* config/tc-mips.c (streq): Define.
(mips_convert_symbolic_attribute): New function.
* config/tc-mips.h (CONVERT_SYMBOLIC_ATTRIBUTE): Define.
(mips_convert_symbolic_attribute): New prototype

gas/testsuite/
* gas/mips/attr-gnu-abi-fp-1.s: New.
* gas/mips/attr-gnu-abi-fp-1.d: New.
* gas/mips/attr-gnu-abi-msa-1.s: New.
* gas/mips/attr-gnu-abi-msa-1.d: New.
* gas/mips/mips.exp: Add new tests.

gas/ChangeLog
gas/config/tc-mips.c
gas/config/tc-mips.h
gas/testsuite/ChangeLog
gas/testsuite/gas/mips/attr-gnu-abi-fp-1.d [new file with mode: 0644]
gas/testsuite/gas/mips/attr-gnu-abi-fp-1.s [new file with mode: 0644]
gas/testsuite/gas/mips/attr-gnu-abi-msa-1.d [new file with mode: 0644]
gas/testsuite/gas/mips/attr-gnu-abi-msa-1.s [new file with mode: 0644]
gas/testsuite/gas/mips/mips.exp

index 0c0d191a69fad3e9317a463bcee850ef266330c6..28f828bfa097c33162d698e11ae382cc467785f5 100644 (file)
@@ -1,3 +1,10 @@
+2014-05-08  Matthew Fortune  <matthew.fortune@imgtec.com>
+
+       * config/tc-mips.c (streq): Define.
+       (mips_convert_symbolic_attribute): New function.
+       * config/tc-mips.h (CONVERT_SYMBOLIC_ATTRIBUTE): Define.
+       (mips_convert_symbolic_attribute): New prototype.
+
 2014-05-02  Max Filippov  <jcmvbkbc@gmail.com>
 
        * config/tc-xtensa.c (md_apply_fix): mark BFD_RELOC_XTENSA_DIFF*
index 1c950a7a4583215c6a8f2149508ddc02ba862d10..edbab71e4a81598be8e6e4ed31d86c4da1c78fbc 100644 (file)
@@ -42,6 +42,8 @@ typedef char static_assert2[sizeof (valueT) < 8 ? -1 : 1];
 #define DBG(x)
 #endif
 
+#define streq(a, b)           (strcmp (a, b) == 0)
+
 #define SKIP_SPACE_TABS(S) \
   do { while (*(S) == ' ' || *(S) == '\t') ++(S); } while (0)
 
@@ -18342,3 +18344,34 @@ tc_mips_regname_to_dw2regnum (char *regname)
 
   return regnum;
 }
+
+/* Implement CONVERT_SYMBOLIC_ATTRIBUTE.
+   Given a symbolic attribute NAME, return the proper integer value.
+   Returns -1 if the attribute is not known.  */
+
+int
+mips_convert_symbolic_attribute (const char *name)
+{
+  static const struct
+  {
+    const char * name;
+    const int    tag;
+  }
+  attribute_table[] =
+    {
+#define T(tag) {#tag, tag}
+      T (Tag_GNU_MIPS_ABI_FP),
+      T (Tag_GNU_MIPS_ABI_MSA),
+#undef T
+    };
+  unsigned int i;
+
+  if (name == NULL)
+    return -1;
+
+  for (i = 0; i < ARRAY_SIZE (attribute_table); i++)
+    if (streq (name, attribute_table[i].name))
+      return attribute_table[i].tag;
+
+  return -1;
+}
index 510e8116b940f80d39a4494e751e76f9ad463e03..0b8e607441287f26e9dfbf3be28c50106ef95316 100644 (file)
@@ -194,4 +194,7 @@ extern int tc_mips_regname_to_dw2regnum (char *regname);
    64-bit form for n64 CFIs.  */
 #define CFI_DIFF_EXPR_OK 0
 
+#define CONVERT_SYMBOLIC_ATTRIBUTE(name) mips_convert_symbolic_attribute (name)
+extern int mips_convert_symbolic_attribute (const char *);
+
 #endif /* TC_MIPS */
index 9ff1b38f1dc716362234b511b88d37ce9173967a..3c1be3479669880a861affa2a699050a1cb2fd05 100644 (file)
@@ -1,3 +1,11 @@
+2014-05-08  Matthew Fortune  <matthew.fortune@imgtec.com>
+
+       * gas/mips/attr-gnu-abi-fp-1.s: New.
+       * gas/mips/attr-gnu-abi-fp-1.d: New.
+       * gas/mips/attr-gnu-abi-msa-1.s: New.
+       * gas/mips/attr-gnu-abi-msa-1.d: New.
+       * gas/mips/mips.exp: Add new tests.
+
 2014-05-07  Andrew Bennett  <andrew.bennett@imgtec.com>
 
        * gas/mips/mips.exp: Add MIPS32r5 tests.  Also add the mips32r3,
diff --git a/gas/testsuite/gas/mips/attr-gnu-abi-fp-1.d b/gas/testsuite/gas/mips/attr-gnu-abi-fp-1.d
new file mode 100644 (file)
index 0000000..63eaf8d
--- /dev/null
@@ -0,0 +1,8 @@
+#as: -32
+#source: attr-gnu-abi-fp-1.s
+#readelf: -A
+#name: MIPS gnu_attribute Tag_GNU_MIPS_ABI_FP,1
+
+Attribute Section: gnu
+File Attributes
+  Tag_GNU_MIPS_ABI_FP: Hard float \(double precision\)
diff --git a/gas/testsuite/gas/mips/attr-gnu-abi-fp-1.s b/gas/testsuite/gas/mips/attr-gnu-abi-fp-1.s
new file mode 100644 (file)
index 0000000..a96caaf
--- /dev/null
@@ -0,0 +1 @@
+.gnu_attribute Tag_GNU_MIPS_ABI_FP,1
diff --git a/gas/testsuite/gas/mips/attr-gnu-abi-msa-1.d b/gas/testsuite/gas/mips/attr-gnu-abi-msa-1.d
new file mode 100644 (file)
index 0000000..4720029
--- /dev/null
@@ -0,0 +1,7 @@
+#source: attr-gnu-abi-msa-1.s
+#readelf: -A
+#name: MIPS gnu_attribute Tag_GNU_MIPS_ABI_MSA,1
+
+Attribute Section: gnu
+File Attributes
+  Tag_GNU_MIPS_ABI_MSA: 128-bit MSA
diff --git a/gas/testsuite/gas/mips/attr-gnu-abi-msa-1.s b/gas/testsuite/gas/mips/attr-gnu-abi-msa-1.s
new file mode 100644 (file)
index 0000000..f22883e
--- /dev/null
@@ -0,0 +1 @@
+.gnu_attribute Tag_GNU_MIPS_ABI_MSA,1
index 9da95c6440e09342acc68e4f1480595a2d9d2be6..7ccbed5ce548d2be64feb04385f47b67335e6a21 100644 (file)
@@ -1197,4 +1197,7 @@ if { [istarget mips*-*-vxworks*] } {
        run_dump_test "pcrel-4-n32"
        run_dump_test "pcrel-4-64"
     }
+
+    run_dump_test "attr-gnu-abi-fp-1"
+    run_dump_test "attr-gnu-abi-msa-1"
 }