diff mbox series

RISC-V: Add the option "-mno-multilib-check" to disable multilib checks.

Message ID 20230526061354.282-1-jinma@linux.alibaba.com
State New
Headers show
Series RISC-V: Add the option "-mno-multilib-check" to disable multilib checks. | expand

Commit Message

Jin Ma May 26, 2023, 6:13 a.m. UTC
When testing a extension, it is often necessary for a certain program not to
need some kind of extension, such as the bitmanip extension, to evaluate the
performance or codesize of the extension. However, the current multilib rules
will report an error when it is not a superset of the MULTILIB_REQUIRED list,
which will cause the program to be unable to link normally, thus failing to
achieve the expected purpose.

Therefore, the compilation option is added to avoi interruption of compilation
by multilib checks.

gcc/ChangeLog:

	* config/riscv/elf.h (LIB_SPEC): Do not run riscv_multi_lib_check() when
	-mno-multilib-check
	* config/riscv/riscv.opt: New.
	* doc/invoke.texi: New.
---
 gcc/config/riscv/elf.h     | 2 +-
 gcc/config/riscv/riscv.opt | 5 +++++
 gcc/doc/invoke.texi        | 9 ++++++++-
 3 files changed, 14 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/gcc/config/riscv/elf.h b/gcc/config/riscv/elf.h
index 4b7e5c988ca..cb3ac903a3d 100644
--- a/gcc/config/riscv/elf.h
+++ b/gcc/config/riscv/elf.h
@@ -29,7 +29,7 @@  along with GCC; see the file COPYING3.  If not see
 #undef  LIB_SPEC
 #define LIB_SPEC \
   "--start-group -lc %{!specs=nosys.specs:-lgloss} --end-group " \
-  "%{!nostartfiles:%{!nodefaultlibs:%{!nolibc:%{!nostdlib:%:riscv_multi_lib_check()}}}}"
+  "%{!mno-multilib-check:%{!nostartfiles:%{!nodefaultlibs:%{!nolibc:%{!nostdlib:%:riscv_multi_lib_check()}}}}}"
 
 #undef  STARTFILE_SPEC
 #define STARTFILE_SPEC "crt0%O%s crtbegin%O%s"
diff --git a/gcc/config/riscv/riscv.opt b/gcc/config/riscv/riscv.opt
index 63d4710cb15..41a817eb774 100644
--- a/gcc/config/riscv/riscv.opt
+++ b/gcc/config/riscv/riscv.opt
@@ -295,3 +295,8 @@  Enum(riscv_autovec_lmul) String(m8) Value(RVV_M8)
 -param=riscv-autovec-lmul=
 Target RejectNegative Joined Enum(riscv_autovec_lmul) Var(riscv_autovec_lmul) Init(RVV_M1)
 -param=riscv-autovec-lmul=<string>	Set the RVV LMUL of auto-vectorization in the RISC-V port.
+
+mno-multilib-check
+Target RejectNegative
+Disable multilib checking; use the default multilib if a compatible
+one is not found.
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index ee78591c73e..bc1ab34d5a7 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -1228,7 +1228,8 @@  See RS/6000 and PowerPC Options.
 -mstack-protector-guard=@var{guard}  -mstack-protector-guard-reg=@var{reg}
 -mstack-protector-guard-offset=@var{offset}
 -mcsr-check -mno-csr-check
--minline-atomics  -mno-inline-atomics}
+-minline-atomics  -mno-inline-atomics
+-mno-multilib-check}
 
 @emph{RL78 Options}
 @gccoptlist{-msim  -mmul=none  -mmul=g13  -mmul=g14  -mallregs
@@ -29131,6 +29132,12 @@  which register to use as base register for reading the canary,
 and from what offset from that base register. There is no default
 register or offset as this is entirely for use within the Linux
 kernel.
+
+@opindex mno-multilib-check
+@item -mno-multilib-check
+Disable the check on the correctness of multilib. When the correct multilib
+is notmatched, the default multilib will be used. This has certain risks
+and is not recommended in a production environment.
 @end table
 
 @node RL78 Options