MIPS/GAS: Set MSA info in .gnu_attribute section if used
Checks
Commit Message
Currently, Tag_GNU_MIPS_ABI_MSA info won't be set, even if
`-mmsa` option is used or `.module msa` pINSN exists.
gas
* config/tc-mips.c (mips_md_finish): Set msa in
.gnu_attribute section if msa is used.
* testsuite/gas/mips/attr-gnu-abi-msa-mmsa.d: New test for
-mmsa option with empty asm file.
* testsuite/gas/mips/attribute-gnu-abi-msa-module.d: New test
for asm file with .module msa.
* testsuite/gas/mips/attribute-gnu-abi-msa-module.s: Likewise.
* testsuite/gas/mips/attribute-gnu-abi-msa-1.d: Don't match
ABI_FP, since it may be differs.
---
gas/config/tc-mips.c | 10 ++++++++++
gas/testsuite/gas/mips/a.out | Bin 0 -> 788 bytes
gas/testsuite/gas/mips/attr-gnu-abi-msa-1.d | 2 +-
gas/testsuite/gas/mips/attr-gnu-abi-msa-mmsa.d | 11 +++++++++++
gas/testsuite/gas/mips/attr-gnu-abi-msa-module.d | 10 ++++++++++
gas/testsuite/gas/mips/attr-gnu-abi-msa-module.s | 1 +
gas/testsuite/gas/mips/mips.exp | 2 ++
7 files changed, 35 insertions(+), 1 deletion(-)
create mode 100644 gas/testsuite/gas/mips/a.out
create mode 100644 gas/testsuite/gas/mips/attr-gnu-abi-msa-mmsa.d
create mode 100644 gas/testsuite/gas/mips/attr-gnu-abi-msa-module.d
create mode 100644 gas/testsuite/gas/mips/attr-gnu-abi-msa-module.s
index 97fc8bf3f46..5231698d1a8 100644
@@ -20578,6 +20578,7 @@ void
mips_md_finish (void)
{
int fpabi = Val_GNU_MIPS_ABI_FP_ANY;
+ int msaabi = Val_GNU_MIPS_ABI_MSA_ANY;
mips_emit_delays ();
if (cur_proc_ptr)
@@ -20631,6 +20632,15 @@ mips_md_finish (void)
as_fatal (_("error adding attribute: %s"),
bfd_errmsg (bfd_get_error ()));
}
+ if (!obj_elf_seen_attribute (OBJ_ATTR_GNU, Tag_GNU_MIPS_ABI_FP)
+ && (file_mips_opts.ase & ASE_MSA))
+ {
+ msaabi = Val_GNU_MIPS_ABI_MSA_128;
+ if (!bfd_elf_add_obj_attr_int (stdoutput, OBJ_ATTR_GNU,
+ Tag_GNU_MIPS_ABI_MSA, msaabi))
+ as_fatal (_ ("error adding attribute: %s"),
+ bfd_errmsg (bfd_get_error ()));
+ }
}
/* Returns the relocation type required for a particular CFI encoding. */
new file mode 100644
GIT binary patch
literal 788
zcmah{!AiqG5S{JTw(7z5CU~(YMPyHUkDx-Kg3yaXFB_W1fVLsof}ZrJJ=Zszotg%;
z1G8`6%-fmSO+N3&_ev=eQ`DnhMl@y8r~Jwb&gqa2M7je{TS`;Mi(0g)d2@tFx>%9w
zV$-hje^k<&Q<Xpy3e`-Lt}y~@H~3zIZ@1ILGnn$@&Dj{}iV9z3=aP3vW@eow6PG2K
zB1yBwd`aeE^f)m#&gQQ+MLeGsWN<5Eoh!0<<&tu%^Z(=oX?|vzE^5g8fe(SKlUqk2
zE+D!y1bXmYx=U!#GnZG5z>nc#{F=<K;TJXCQ-}k+aWB^0!g)TiTs8sa>x{s^*XyOE
uStqk|OlmO7Y#jdzz7OP{T#wH&m%C!?3rLMXeRzPiuH)bS*=MRn&invo(=53F
literal 0
HcmV?d00001
@@ -4,7 +4,7 @@
Attribute Section: gnu
File Attributes
- Tag_GNU_MIPS_ABI_FP: Hard float \(double precision\)
+ Tag_GNU_MIPS_ABI_FP: .*
Tag_GNU_MIPS_ABI_MSA: 128-bit MSA
#...
new file mode 100644
@@ -0,0 +1,11 @@
+#source: empty.s
+#as: -32 -mips32r2 -mmsa -mhard-float
+#readelf: -A
+#name: MIPS gnu_attribute Tag_GNU_MIPS_ABI_MSA,1 (-mmsa)
+
+Attribute Section: gnu
+File Attributes
+ Tag_GNU_MIPS_ABI_FP: Hard float \(32-bit CPU, 64-bit FPU\)
+ Tag_GNU_MIPS_ABI_MSA: 128-bit MSA
+
+#...
new file mode 100644
@@ -0,0 +1,10 @@
+#as: -32 -mips32r2 -mhard-float
+#readelf: -A
+#name: MIPS gnu_attribute Tag_GNU_MIPS_ABI_MSA,1 (.module msa)
+
+Attribute Section: gnu
+File Attributes
+ Tag_GNU_MIPS_ABI_FP: Hard float \(32-bit CPU, 64-bit FPU\)
+ Tag_GNU_MIPS_ABI_MSA: 128-bit MSA
+
+#...
new file mode 100644
@@ -0,0 +1 @@
+.module msa
@@ -2061,6 +2061,8 @@ if { [istarget mips*-*-vxworks*] } {
run_dump_test "attr-gnu-abi-fp-1"
run_dump_test "attr-gnu-abi-msa-1"
+ run_dump_test "attr-gnu-abi-msa-mmsa"
+ run_dump_test "attr-gnu-abi-msa-module"
run_dump_test "module-override"
run_dump_test "module-defer-warn1"