* [PATCH] RISC-V: For '-march' and '-mabi' options, add 'Negative' property mentions itself.
@ 2021-04-28 8:29 Geng Qi
2021-04-30 2:25 ` Jim Wilson
0 siblings, 1 reply; 3+ messages in thread
From: Geng Qi @ 2021-04-28 8:29 UTC (permalink / raw)
To: gcc-patches; +Cc: Geng Qi
When use multi-lib riscv-tool-chain. A bug is triggered when there are two
'-march' at command line.
riscv64-unknown-elf-gcc -march=rv32gcp -mabi=ilp32f -march=rv32gcpzp64 HelloWorld.c
/lhome/gengq/riscv64-linux-ptest/lib/gcc/riscv64-unknown-elf/10.2.0/../../../../riscv64-unknown-elf/bin/ld: /lhome/gengq/riscv64-linux-ptest/lib/gcc/riscv64-unknown-elf/10.2.0/../../../../riscv64-unknown-elf/lib/crt0.o: ABI is incompatible with that of the selected emulation:
target emulation `elf64-littleriscv' does not match `elf32-littleriscv'
/lhome/gengq/riscv64-linux-ptest/lib/gcc/riscv64-unknown-elf/10.2.0/../../../../riscv64-unknown-elf/bin/ld: failed to merge target specific data of file /lhome/gengq/riscv64-linux-ptest/lib/gcc/riscv64-unknown-elf/10.2.0/../../../../riscv64-unknown-elf/lib/crt0.o
/lhome/gengq/riscv64-linux-ptest/lib/gcc/riscv64-unknown-elf/10.2.0/../../../../riscv64-unknown-elf/bin/ld: /lhome/gengq/riscv64-linux-ptest/lib/gcc/riscv64-unknown-elf/10.2.0/crtbegin.o: ABI is incompatible with that of the selected emulation:
target emulation `elf64-littleriscv' does not match `elf32-littleriscv'
/lhome/gengq/riscv64-linux-ptest/lib/gcc/riscv64-unknown-elf/10.2.0/../../../../riscv64-unknown-elf/bin/ld: failed to merge target specific data of file /lhome/gengq/riscv64-linux-ptest/lib/gcc/riscv64-unknown-elf/10.2.0/crtbegin.o
......
This patch fix it. And the DIVER would prune the extra '-march' and '-mabi'
options and keep only the last one valid.
gcc/ChangeLog:
* config/riscv/riscv.opt (march=,mabi=): Negative itself.
---
gcc/config/riscv/riscv.opt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gcc/config/riscv/riscv.opt b/gcc/config/riscv/riscv.opt
index e294e22..5ff85c2 100644
--- a/gcc/config/riscv/riscv.opt
+++ b/gcc/config/riscv/riscv.opt
@@ -38,7 +38,7 @@ Target Var(TARGET_PLT) Init(1)
When generating -fpic code, allow the use of PLTs. Ignored for fno-pic.
mabi=
-Target RejectNegative Joined Enum(abi_type) Var(riscv_abi) Init(ABI_ILP32)
+Target RejectNegative Joined Enum(abi_type) Var(riscv_abi) Init(ABI_ILP32) Negative(mabi=)
Specify integer and floating-point calling convention.
mpreferred-stack-boundary=
@@ -79,7 +79,7 @@ Target Mask(DIV)
Use hardware instructions for integer division.
march=
-Target RejectNegative Joined
+Target RejectNegative Joined Negative(march=)
-march= Generate code for given RISC-V ISA (e.g. RV64IM). ISA strings must be
lower-case.
--
2.7.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] RISC-V: For '-march' and '-mabi' options, add 'Negative' property mentions itself.
2021-04-28 8:29 [PATCH] RISC-V: For '-march' and '-mabi' options, add 'Negative' property mentions itself Geng Qi
@ 2021-04-30 2:25 ` Jim Wilson
2021-05-11 9:23 ` Kito Cheng
0 siblings, 1 reply; 3+ messages in thread
From: Jim Wilson @ 2021-04-30 2:25 UTC (permalink / raw)
To: Geng Qi; +Cc: GCC Patches
On Wed, Apr 28, 2021 at 1:30 AM Geng Qi via Gcc-patches <
gcc-patches@gcc.gnu.org> wrote:
> gcc/ChangeLog:
> * config/riscv/riscv.opt (march=,mabi=): Negative itself.
>
Thanks. I committed this.
Do we need to backport to release branches? This looks like an uncommon
problem, or we would have noticed this before.
Jim
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] RISC-V: For '-march' and '-mabi' options, add 'Negative' property mentions itself.
2021-04-30 2:25 ` Jim Wilson
@ 2021-05-11 9:23 ` Kito Cheng
0 siblings, 0 replies; 3+ messages in thread
From: Kito Cheng @ 2021-05-11 9:23 UTC (permalink / raw)
To: Jim Wilson; +Cc: Geng Qi, GCC Patches
It seems useful, I've backported to GCC 9/10/11.
Without this patch:
$ riscv64-unknown-elf-gcc -march=rv32imafd ~/hello.c -march=rv64gc
/scratch1/kitoc/riscv-gnu-workspace/rv64gc/install/bin/../lib/gcc/riscv64-unknown-elf/11.1.0/../../../../riscv64-unknown-elf/bin/ld:
unrecognised
emulation mode: elf3264lriscv
Supported emulations: elf64lriscv elf32lriscv elf64briscv elf32briscv
collect2: error: ld returned 1 exit status
With this patch:
$ riscv64-unknown-elf-gcc -march=rv32imafd ~/hello.c -march=rv64gc
// No error!
On Fri, Apr 30, 2021 at 11:42 AM Jim Wilson <jimw@sifive.com> wrote:
>
> On Wed, Apr 28, 2021 at 1:30 AM Geng Qi via Gcc-patches <
> gcc-patches@gcc.gnu.org> wrote:
>
> > gcc/ChangeLog:
> > * config/riscv/riscv.opt (march=,mabi=): Negative itself.
> >
>
> Thanks. I committed this.
>
> Do we need to backport to release branches? This looks like an uncommon
> problem, or we would have noticed this before.
>
> Jim
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-05-11 9:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-28 8:29 [PATCH] RISC-V: For '-march' and '-mabi' options, add 'Negative' property mentions itself Geng Qi
2021-04-30 2:25 ` Jim Wilson
2021-05-11 9:23 ` Kito Cheng
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).