[1/2] LoongArch: respect the with values in config.gcc

Message ID 20221209024349.845948-2-uwu@icenowy.me
State New
Headers
Series [1/2] LoongArch: respect the with values in config.gcc |

Commit Message

Icenowy Zheng Dec. 9, 2022, 2:43 a.m. UTC
  In config.gcc, there's a long code snippet that handles
--with-{arch,tune,abi,fpu} and give them default values; however these
"with" values are not used at all.

Use these "with" values to initialize these variables in specs.

gcc/ChangeLog:

	* config/loongarch/loongarch.h (OPTION_DEFAULT_SPECS):
	New macro that simply injects configure --with values.

Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
---
 gcc/config/loongarch/loongarch.h | 11 +++++++++++
 1 file changed, 11 insertions(+)
  

Patch

diff --git a/gcc/config/loongarch/loongarch.h b/gcc/config/loongarch/loongarch.h
index a402d3ba35a..5e2f4158f70 100644
--- a/gcc/config/loongarch/loongarch.h
+++ b/gcc/config/loongarch/loongarch.h
@@ -50,6 +50,17 @@  along with GCC; see the file COPYING3.  If not see
 /* Driver native functions for SPEC processing in the GCC driver.  */
 #include "loongarch-driver.h"
 
+/* Support for a compile-time default CPU, et cetera.  The rules are:
+   --with-arch is ignored if -march is specified.
+   --with-tune is ignored if -mtune is specified.
+   --with-abi is ignored if -mabi is specified.
+   --with-fpu is ignored if -mfpu is specified. */
+#define OPTION_DEFAULT_SPECS \
+  {"arch", "%{!march=*:-march=%(VALUE)}" }, \
+  {"tune", "%{!mtune=*:-mtune=%(VALUE)}" }, \
+  {"abi", "%{!mabi=*:-mabi=%(VALUE)}" }, \
+  {"fpu", "%{!mfpu=*:-mfpu=%(VALUE)}" }, \
+
 /* This definition replaces the formerly used 'm' constraint with a
    different constraint letter in order to avoid changing semantics of
    the 'm' constraint when accepting new address formats in