- 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(+)

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     "."
-- 
2.27.0

Reply via email to