RISC-V: PR25212, Report errors for invalid march and mabi combinations.
This patch clarify the following invalid combinations of march and mabi, * ilp32f/lp64f abi without f extension. * ilp32d/lp64d abi without d extension. * ilp32q/lp64q abi without q extension. * e extension with any abi except ilp32e GNU assembler reports errors when finding the above invalid combinations. But LLVM-MC reports warnings and ignores these invalid cases. It help to set the correct ilp32/lp64/ilp32e abi according to rv32/rv64/rve. This looks good and convenient, so perhaps we can do the same things. However, if you don't set the mabi, GNU assembler also try to set the suitable ABI according to march/elf-attribute. Compared to LLVM-MC, we will choose double/quad abi if d/f extension is set. gas/ 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.
This commit is contained in:
parent
d16ce6e4d5
commit
5d0ed830d3
@ -1,3 +1,19 @@
|
||||
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
|
||||
|
@ -441,6 +441,8 @@ riscv_set_abi_by_arch (void)
|
||||
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);
|
||||
}
|
||||
@ -451,6 +453,22 @@ riscv_set_abi_by_arch (void)
|
||||
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. */
|
||||
|
1
gas/testsuite/gas/riscv/mabi-attr-rv32e.s
Normal file
1
gas/testsuite/gas/riscv/mabi-attr-rv32e.s
Normal file
@ -0,0 +1 @@
|
||||
.attribute arch,"rv32e"
|
@ -1,3 +0,0 @@
|
||||
#as: -march-attr -mabi=lp64d
|
||||
#source: mabi-attr-01.s
|
||||
#error_output: mabi-fail-01.l
|
@ -1,3 +0,0 @@
|
||||
#as: -march-attr -mabi=ilp32
|
||||
#source: mabi-attr-03.s
|
||||
#error_output: mabi-fail-02.l
|
3
gas/testsuite/gas/riscv/mabi-fail-rv32e-lp64d.d
Normal file
3
gas/testsuite/gas/riscv/mabi-fail-rv32e-lp64d.d
Normal file
@ -0,0 +1,3 @@
|
||||
#as: -march-attr -mabi=lp64d
|
||||
#source: mabi-attr-rv32e.s
|
||||
#error_output: mabi-fail-rv32e-lp64d.l
|
4
gas/testsuite/gas/riscv/mabi-fail-rv32e-lp64d.l
Normal file
4
gas/testsuite/gas/riscv/mabi-fail-rv32e-lp64d.l
Normal file
@ -0,0 +1,4 @@
|
||||
.*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
|
3
gas/testsuite/gas/riscv/mabi-fail-rv32e-lp64f.d
Normal file
3
gas/testsuite/gas/riscv/mabi-fail-rv32e-lp64f.d
Normal file
@ -0,0 +1,3 @@
|
||||
#as: -march-attr -mabi=lp64f
|
||||
#source: mabi-attr-rv32e.s
|
||||
#error_output: mabi-fail-rv32e-lp64f.l
|
4
gas/testsuite/gas/riscv/mabi-fail-rv32e-lp64f.l
Normal file
4
gas/testsuite/gas/riscv/mabi-fail-rv32e-lp64f.l
Normal file
@ -0,0 +1,4 @@
|
||||
.*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
|
3
gas/testsuite/gas/riscv/mabi-fail-rv32e-lp64q.d
Normal file
3
gas/testsuite/gas/riscv/mabi-fail-rv32e-lp64q.d
Normal file
@ -0,0 +1,3 @@
|
||||
#as: -march-attr -mabi=lp64q
|
||||
#source: mabi-attr-rv32e.s
|
||||
#error_output: mabi-fail-rv32e-lp64q.l
|
4
gas/testsuite/gas/riscv/mabi-fail-rv32e-lp64q.l
Normal file
4
gas/testsuite/gas/riscv/mabi-fail-rv32e-lp64q.l
Normal file
@ -0,0 +1,4 @@
|
||||
.*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
|
3
gas/testsuite/gas/riscv/mabi-fail-rv32i-lp64.d
Normal file
3
gas/testsuite/gas/riscv/mabi-fail-rv32i-lp64.d
Normal file
@ -0,0 +1,3 @@
|
||||
#as: -march-attr -mabi=lp64
|
||||
#source: mabi-attr-rv32i.s
|
||||
#error_output: mabi-fail-rv32i-lp64.l
|
3
gas/testsuite/gas/riscv/mabi-fail-rv64iq-ilp32.d
Normal file
3
gas/testsuite/gas/riscv/mabi-fail-rv64iq-ilp32.d
Normal file
@ -0,0 +1,3 @@
|
||||
#as: -march-attr -mabi=ilp32
|
||||
#source: mabi-attr-rv64iq.s
|
||||
#error_output: mabi-fail-rv64iq-ilp32.l
|
@ -1,6 +1,6 @@
|
||||
#as: -march-attr -march=rv64ifd
|
||||
#as: -march-attr -march=rv64id
|
||||
#readelf: -h
|
||||
#source: mabi-attr-01.s
|
||||
#source: mabi-attr-rv32i.s
|
||||
|
||||
ELF Header:
|
||||
#...
|
@ -1,6 +1,6 @@
|
||||
#as: -march-attr -march=rv64ifd
|
||||
#as: -march-attr -march=rv64id
|
||||
#objdump: -d
|
||||
#source: mabi-attr-01.s
|
||||
#source: mabi-attr-rv32i.s
|
||||
|
||||
.*:[ ]+file format elf32.*
|
||||
|
@ -1,6 +1,6 @@
|
||||
#as: -march-attr -march=rv64i
|
||||
#readelf: -h
|
||||
#source: mabi-attr-02.s
|
||||
#source: mabi-attr-rv32id.s
|
||||
|
||||
ELF Header:
|
||||
#...
|
@ -1,6 +1,6 @@
|
||||
#as: -march-attr -march=rv64i
|
||||
#objdump: -d
|
||||
#source: mabi-attr-02.s
|
||||
#source: mabi-attr-rv32id.s
|
||||
|
||||
.*:[ ]+file format elf32.*
|
||||
|
@ -1,6 +1,6 @@
|
||||
#as: -march-attr -march=rv32i
|
||||
#readelf: -h
|
||||
#source: mabi-attr-03.s
|
||||
#source: mabi-attr-rv64iq.s
|
||||
|
||||
ELF Header:
|
||||
#...
|
@ -1,6 +1,6 @@
|
||||
#as: -march-attr -march=rv32i
|
||||
#objdump: -d
|
||||
#source: mabi-attr-03.s
|
||||
#source: mabi-attr-rv64iq.s
|
||||
|
||||
.*:[ ]+file format elf64.*
|
||||
|
@ -1,4 +1,4 @@
|
||||
#as: -march=rv32ifd
|
||||
#as: -march=rv32id
|
||||
#readelf: -h
|
||||
#source: empty.s
|
||||
|
@ -1,4 +1,4 @@
|
||||
#as: -march=rv64ifdq
|
||||
#as: -march=rv64iq
|
||||
#readelf: -h
|
||||
#source: empty.s
|
||||
|
Loading…
x
Reference in New Issue
Block a user