+2021-05-24 Nelson Chu <nelson.chu@sifive.com>
+
+ PR 25212
+ * config/tc-riscv.c (riscv_set_abi_by_arch): If -mabi isn't set, we
+ will choose ilp32e abi for rv32e. Besides, report errors for the
+ invalid march and mabi combinations.
+ * testsuite/gas/riscv/mabi-attr-rv32e.s: New testcase. Only accept
+ ilp32e abi for rve extension.
+ * testsuite/gas/riscv/mabi-fail-rv32e-lp64f.d: Likewise.
+ * testsuite/gas/riscv/mabi-fail-rv32e-lp64f.l: Likewise.
+ * testsuite/gas/riscv/mabi-fail-rv32e-lp64d.d: Likewise.
+ * testsuite/gas/riscv/mabi-fail-rv32e-lp64d.l: Likewise.
+ * testsuite/gas/riscv/mabi-fail-rv32e-lp64d.q: Likewise.
+ * testsuite/gas/riscv/mabi-fail-rv32e-lp64d.q: Likewise.
+ Renamed all mabi testcases to their march-mabi settings.
+
2021-05-22 Alan Modra <amodra@gmail.com>
PR 25599
riscv_set_abi (xlen, FLOAT_ABI_QUAD, false);
else if (riscv_subset_supports ("d"))
riscv_set_abi (xlen, FLOAT_ABI_DOUBLE, false);
+ else if (riscv_subset_supports ("e"))
+ riscv_set_abi (xlen, FLOAT_ABI_SOFT, true);
else
riscv_set_abi (xlen, FLOAT_ABI_SOFT, false);
}
as_bad ("can't have %d-bit ABI on %d-bit ISA", abi_xlen, xlen);
else if (abi_xlen < xlen)
as_bad ("%d-bit ABI not yet supported on %d-bit ISA", abi_xlen, xlen);
+
+ if (riscv_subset_supports ("e") && !rve_abi)
+ as_bad ("only the ilp32e ABI is supported for e extension");
+
+ if (float_abi == FLOAT_ABI_SINGLE
+ && !riscv_subset_supports ("f"))
+ as_bad ("ilp32f/lp64f ABI can't be used when f extension "
+ "isn't supported");
+ else if (float_abi == FLOAT_ABI_DOUBLE
+ && !riscv_subset_supports ("d"))
+ as_bad ("ilp32d/lp64d ABI can't be used when d extension "
+ "isn't supported");
+ else if (float_abi == FLOAT_ABI_QUAD
+ && !riscv_subset_supports ("q"))
+ as_bad ("ilp32q/lp64q ABI can't be used when q extension "
+ "isn't supported");
}
/* Update the EF_RISCV_FLOAT_ABI field of elf_flags. */
+++ /dev/null
- .attribute arch,"rv32i"
- .option pic
- .extern foo
- .text
-foo:
- la a0, foo
+++ /dev/null
- .attribute arch,"rv32ifd"
- .option pic
- .extern foo
- .text
-foo:
- la a0, foo
+++ /dev/null
- .attribute arch,"rv64ifdq"
- .option pic
- .extern foo
- .text
-foo:
- la a0, foo
--- /dev/null
+ .attribute arch,"rv32e"
--- /dev/null
+ .attribute arch,"rv32i"
+ .option pic
+ .extern foo
+ .text
+foo:
+ la a0, foo
--- /dev/null
+ .attribute arch,"rv32ifd"
+ .option pic
+ .extern foo
+ .text
+foo:
+ la a0, foo
--- /dev/null
+ .attribute arch,"rv64ifdq"
+ .option pic
+ .extern foo
+ .text
+foo:
+ la a0, foo
+++ /dev/null
-#as: -march-attr -mabi=lp64d
-#source: mabi-attr-01.s
-#error_output: mabi-fail-01.l
+++ /dev/null
-.*Assembler messages:
-.*Error: can't have 64-bit ABI on 32-bit ISA
+++ /dev/null
-#as: -march-attr -mabi=ilp32
-#source: mabi-attr-03.s
-#error_output: mabi-fail-02.l
+++ /dev/null
-.*Assembler messages:
-.*Error: 32-bit ABI not yet supported on 64-bit ISA
--- /dev/null
+#as: -march-attr -mabi=lp64d
+#source: mabi-attr-rv32e.s
+#error_output: mabi-fail-rv32e-lp64d.l
--- /dev/null
+.*Assembler messages:
+.*Error: can't have 64-bit ABI on 32-bit ISA
+.*Error: only the ilp32e ABI is supported for e extension
+.*Error: ilp32d/lp64d ABI can't be used when d extension isn't supported
--- /dev/null
+#as: -march-attr -mabi=lp64f
+#source: mabi-attr-rv32e.s
+#error_output: mabi-fail-rv32e-lp64f.l
--- /dev/null
+.*Assembler messages:
+.*Error: can't have 64-bit ABI on 32-bit ISA
+.*Error: only the ilp32e ABI is supported for e extension
+.*Error: ilp32f/lp64f ABI can't be used when f extension isn't supported
--- /dev/null
+#as: -march-attr -mabi=lp64q
+#source: mabi-attr-rv32e.s
+#error_output: mabi-fail-rv32e-lp64q.l
--- /dev/null
+.*Assembler messages:
+.*Error: can't have 64-bit ABI on 32-bit ISA
+.*Error: only the ilp32e ABI is supported for e extension
+.*Error: ilp32q/lp64q ABI can't be used when q extension isn't supported
--- /dev/null
+#as: -march-attr -mabi=lp64
+#source: mabi-attr-rv32i.s
+#error_output: mabi-fail-rv32i-lp64.l
--- /dev/null
+.*Assembler messages:
+.*Error: can't have 64-bit ABI on 32-bit ISA
--- /dev/null
+#as: -march-attr -mabi=ilp32
+#source: mabi-attr-rv64iq.s
+#error_output: mabi-fail-rv64iq-ilp32.l
--- /dev/null
+.*Assembler messages:
+.*Error: 32-bit ABI not yet supported on 64-bit ISA
+++ /dev/null
-#as: -march-attr -march=rv64ifd
-#readelf: -h
-#source: mabi-attr-01.s
-
-ELF Header:
-#...
-[ ]+Class:[ ]+ELF32
-#...
-[ ]+Flags:[ ]+0x0
-#...
+++ /dev/null
-#as: -march-attr -march=rv64ifd
-#objdump: -d
-#source: mabi-attr-01.s
-
-.*:[ ]+file format elf32.*
-
-
-Disassembly of section .text:
-
-0+000 <foo>:
-#...
-[ ]+[0-9a-f]+:[ ]+00052503[ ]+lw[ ]+a0,0\(a0\) # .*
+++ /dev/null
-#as: -march-attr -march=rv64i
-#readelf: -h
-#source: mabi-attr-02.s
-
-ELF Header:
-#...
-[ ]+Class:[ ]+ELF32
-#...
-[ ]+Flags:[ ]+0x4, double-float ABI
-#...
+++ /dev/null
-#as: -march-attr -march=rv64i
-#objdump: -d
-#source: mabi-attr-02.s
-
-.*:[ ]+file format elf32.*
-
-
-Disassembly of section .text:
-
-0+000 <foo>:
-#...
-[ ]+[0-9a-f]+:[ ]+00052503[ ]+lw[ ]+a0,0\(a0\) # .*
+++ /dev/null
-#as: -march-attr -march=rv32i
-#readelf: -h
-#source: mabi-attr-03.s
-
-ELF Header:
-#...
-[ ]+Class:[ ]+ELF64
-#...
-[ ]+Flags:[ ]+0x6, quad-float ABI
-#...
+++ /dev/null
-#as: -march-attr -march=rv32i
-#objdump: -d
-#source: mabi-attr-03.s
-
-.*:[ ]+file format elf64.*
-
-
-Disassembly of section .text:
-
-0+000 <foo>:
-#...
-[ ]+[0-9a-f]+:[ ]+00053503[ ]+ld[ ]+a0,0\(a0\) # .*
--- /dev/null
+#as: -march-attr -march=rv64id
+#readelf: -h
+#source: mabi-attr-rv32i.s
+
+ELF Header:
+#...
+[ ]+Class:[ ]+ELF32
+#...
+[ ]+Flags:[ ]+0x0
+#...
--- /dev/null
+#as: -march-attr -march=rv64id
+#objdump: -d
+#source: mabi-attr-rv32i.s
+
+.*:[ ]+file format elf32.*
+
+
+Disassembly of section .text:
+
+0+000 <foo>:
+#...
+[ ]+[0-9a-f]+:[ ]+00052503[ ]+lw[ ]+a0,0\(a0\) # .*
--- /dev/null
+#as: -march-attr -march=rv64i
+#readelf: -h
+#source: mabi-attr-rv32id.s
+
+ELF Header:
+#...
+[ ]+Class:[ ]+ELF32
+#...
+[ ]+Flags:[ ]+0x4, double-float ABI
+#...
--- /dev/null
+#as: -march-attr -march=rv64i
+#objdump: -d
+#source: mabi-attr-rv32id.s
+
+.*:[ ]+file format elf32.*
+
+
+Disassembly of section .text:
+
+0+000 <foo>:
+#...
+[ ]+[0-9a-f]+:[ ]+00052503[ ]+lw[ ]+a0,0\(a0\) # .*
--- /dev/null
+#as: -march-attr -march=rv32i
+#readelf: -h
+#source: mabi-attr-rv64iq.s
+
+ELF Header:
+#...
+[ ]+Class:[ ]+ELF64
+#...
+[ ]+Flags:[ ]+0x6, quad-float ABI
+#...
--- /dev/null
+#as: -march-attr -march=rv32i
+#objdump: -d
+#source: mabi-attr-rv64iq.s
+
+.*:[ ]+file format elf64.*
+
+
+Disassembly of section .text:
+
+0+000 <foo>:
+#...
+[ ]+[0-9a-f]+:[ ]+00053503[ ]+ld[ ]+a0,0\(a0\) # .*
+++ /dev/null
-#as: -march=rv32i
-#readelf: -h
-#source: empty.s
-
-ELF Header:
-#...
-[ ]+Class:[ ]+ELF32
-#...
-[ ]+Flags:[ ]+0x0
-#...
+++ /dev/null
-#as: -march=rv32ifd
-#readelf: -h
-#source: empty.s
-
-ELF Header:
-#...
-[ ]+Class:[ ]+ELF32
-#...
-[ ]+Flags:[ ]+0x4, double-float ABI
-#...
+++ /dev/null
-#as: -march=rv64ifdq
-#readelf: -h
-#source: empty.s
-
-ELF Header:
-#...
-[ ]+Class:[ ]+ELF64
-#...
-[ ]+Flags:[ ]+0x6, quad-float ABI
-#...
--- /dev/null
+#as: -march=rv32i
+#readelf: -h
+#source: empty.s
+
+ELF Header:
+#...
+[ ]+Class:[ ]+ELF32
+#...
+[ ]+Flags:[ ]+0x0
+#...
--- /dev/null
+#as: -march=rv32id
+#readelf: -h
+#source: empty.s
+
+ELF Header:
+#...
+[ ]+Class:[ ]+ELF32
+#...
+[ ]+Flags:[ ]+0x4, double-float ABI
+#...
--- /dev/null
+#as: -march=rv64iq
+#readelf: -h
+#source: empty.s
+
+ELF Header:
+#...
+[ ]+Class:[ ]+ELF64
+#...
+[ ]+Flags:[ ]+0x6, quad-float ABI
+#...