diff mbox series

RISC-V: Normalize arch string in driver time

Message ID 20200619095345.46238-1-kito.cheng@sifive.com
State New
Headers show
Series RISC-V: Normalize arch string in driver time | expand

Commit Message

Kito Cheng June 19, 2020, 9:53 a.m. UTC
- Normalize arch string would help the multi-lib handling, e.g. rv64gc and
   rv64g_c are both valid and same arch, but latter one would confuse
   the detection of multi-lib, earlier normalize can resolve this issue.

gcc/ChangeLog:

	* config/riscv/riscv.h (DRIVER_SELF_SPECS): New.
---
 gcc/config/riscv/riscv.h | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Jim Wilson June 20, 2020, 9:36 p.m. UTC | #1
On Fri, Jun 19, 2020 at 2:53 AM Kito Cheng <kito.cheng@sifive.com> wrote:
>         * config/riscv/riscv.h (DRIVER_SELF_SPECS): New.

This looks good to me.  This has the side effect that we are now
passing -march twice to cc1 and as, but that should be harmless as the
last one wins.  I think this makes the riscv_expand_arch call in
ASM_SPECS redundant, but it isn't really hurting anything if we end up
with extra unnecessary calls to riscv_expand_arch so that is an
optional possible cleanup.

Jim
Kito Cheng June 22, 2020, 3:32 a.m. UTC | #2
Hi Jim:

Thanks for your review, committed with ASM_SPECS clean up.

> This has the side effect that we are now passing -march twice to cc1 and as, but that should be harmless as the last one wins.
Yeah, I tried to find a way to remove the duplication but have not
found a good solution yet.

On Sun, Jun 21, 2020 at 5:37 AM Jim Wilson <jimw@sifive.com> wrote:
>
> On Fri, Jun 19, 2020 at 2:53 AM Kito Cheng <kito.cheng@sifive.com> wrote:
> >         * config/riscv/riscv.h (DRIVER_SELF_SPECS): New.
>
> This looks good to me.  This has the side effect that we are now
> passing -march twice to cc1 and as, but that should be harmless as the
> last one wins.  I think this makes the riscv_expand_arch call in
> ASM_SPECS redundant, but it isn't really hurting anything if we end up
> with extra unnecessary calls to riscv_expand_arch so that is an
> optional possible cleanup.
>
> Jim
diff mbox series

Patch

diff --git a/gcc/config/riscv/riscv.h b/gcc/config/riscv/riscv.h
index 6119e6350620..1f2fe7e10e05 100644
--- a/gcc/config/riscv/riscv.h
+++ b/gcc/config/riscv/riscv.h
@@ -68,6 +68,10 @@  extern const char *riscv_expand_arch (int argc, const char **argv);
 %{mabi=*} \
 %(subtarget_asm_spec)"
 
+#undef DRIVER_SELF_SPECS
+#define DRIVER_SELF_SPECS \
+"%{march=*:-march=%:riscv_expand_arch(%*)}"
+
 #define TARGET_DEFAULT_CMODEL CM_MEDLOW
 
 #define LOCAL_LABEL_PREFIX	"."