public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH][MIPS] Implement CONVERT_SYMBOLIC_ATTRIBUTE
@ 2014-05-08  7:58 Matthew Fortune
  2014-05-08  8:07 ` Richard Sandiford
  0 siblings, 1 reply; 2+ messages in thread
From: Matthew Fortune @ 2014-05-08  7:58 UTC (permalink / raw)
  To: Richard Sandiford; +Cc: binutils

[-- Attachment #1: Type: text/plain, Size: 728 bytes --]

Hi Richard,

This is split out of the FPXX patch. Implement
CONVERT_SYMBOLIC_ATTRIBUTE to support textual names for gnu attributes.

OK to commit? If so, would you be willing to grant me write access to
binutils-gdb?

Regards,
Matthew

2014-05-07  Matthew Fortune  <matthew.fortune@imgtec.com>

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.

[-- Attachment #2: 0001-PATCH-MIPS-Implement-CONVERT_SYMBOLIC_ATTRIBUTE.patch --]
[-- Type: application/octet-stream, Size: 4665 bytes --]

2014-05-07  Matthew Fortune  <matthew.fortune@imgtec.com>

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/config/tc-mips.c                        |   35 +++++++++++++++++++++++++++
 gas/config/tc-mips.h                        |    5 ++++
 gas/testsuite/gas/mips/attr-gnu-abi-fp-1.d  |    8 ++++++
 gas/testsuite/gas/mips/attr-gnu-abi-fp-1.s  |    1 +
 gas/testsuite/gas/mips/attr-gnu-abi-msa-1.d |    7 +++++
 gas/testsuite/gas/mips/attr-gnu-abi-msa-1.s |    1 +
 gas/testsuite/gas/mips/mips.exp             |    3 ++
 7 files changed, 60 insertions(+), 0 deletions(-)
 create mode 100644 gas/testsuite/gas/mips/attr-gnu-abi-fp-1.d
 create mode 100644 gas/testsuite/gas/mips/attr-gnu-abi-fp-1.s
 create mode 100644 gas/testsuite/gas/mips/attr-gnu-abi-msa-1.d
 create mode 100644 gas/testsuite/gas/mips/attr-gnu-abi-msa-1.s

diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index 960169e..b80470c 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -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)
 
@@ -18272,3 +18274,36 @@ tc_mips_regname_to_dw2regnum (char *regname)
 
   return regnum;
 }
+
+#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
+/* 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;
+}
+#endif
diff --git a/gas/config/tc-mips.h b/gas/config/tc-mips.h
index 510e811..0a07f3a 100644
--- a/gas/config/tc-mips.h
+++ b/gas/config/tc-mips.h
@@ -194,4 +194,9 @@ extern int tc_mips_regname_to_dw2regnum (char *regname);
    64-bit form for n64 CFIs.  */
 #define CFI_DIFF_EXPR_OK 0
 
+#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
+#define CONVERT_SYMBOLIC_ATTRIBUTE(name) mips_convert_symbolic_attribute (name)
+extern int mips_convert_symbolic_attribute (const char *);
+#endif
+
 #endif /* TC_MIPS */
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
index 0000000..63eaf8d
--- /dev/null
+++ b/gas/testsuite/gas/mips/attr-gnu-abi-fp-1.d
@@ -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
index 0000000..a96caaf
--- /dev/null
+++ b/gas/testsuite/gas/mips/attr-gnu-abi-fp-1.s
@@ -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
index 0000000..4720029
--- /dev/null
+++ b/gas/testsuite/gas/mips/attr-gnu-abi-msa-1.d
@@ -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
index 0000000..f22883e
--- /dev/null
+++ b/gas/testsuite/gas/mips/attr-gnu-abi-msa-1.s
@@ -0,0 +1 @@
+.gnu_attribute Tag_GNU_MIPS_ABI_MSA,1
diff --git a/gas/testsuite/gas/mips/mips.exp b/gas/testsuite/gas/mips/mips.exp
index b0d8ac2..bbb484b 100644
--- a/gas/testsuite/gas/mips/mips.exp
+++ b/gas/testsuite/gas/mips/mips.exp
@@ -1180,4 +1180,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"
 }
-- 
1.7.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH][MIPS] Implement CONVERT_SYMBOLIC_ATTRIBUTE
  2014-05-08  7:58 [PATCH][MIPS] Implement CONVERT_SYMBOLIC_ATTRIBUTE Matthew Fortune
@ 2014-05-08  8:07 ` Richard Sandiford
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Sandiford @ 2014-05-08  8:07 UTC (permalink / raw)
  To: Matthew Fortune; +Cc: binutils

Matthew Fortune <Matthew.Fortune@imgtec.com> writes:
> +#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)

The non-ELF support has been removed from MIPS gas, so this (and the
corresponding header test) shouldn't be needed.

OK otherwise, thanks.

To get commit access, please fill out:

  https://www.sourceware.org/cgi-bin/pdw/ps_form.cgi

and list me as approver.

Richard

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-05-08  8:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-08  7:58 [PATCH][MIPS] Implement CONVERT_SYMBOLIC_ATTRIBUTE Matthew Fortune
2014-05-08  8:07 ` Richard Sandiford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).