From: Kito Cheng Date: Wed, 28 May 2025 09:59:11 +0000 (+0800) Subject: RISC-V: Adjust build rule for gen-riscv-ext-opt and gen-riscv-ext-texi X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b0dc2324980bbb600ab178dacfe5455365a52645;p=thirdparty%2Fgcc.git RISC-V: Adjust build rule for gen-riscv-ext-opt and gen-riscv-ext-texi Separate the build rules to compile and link stage to make sure BUILD_LINKERFLAGS and BUILD_LDFLAGS are applied correctly. We hit this issue when we try to build GCC with non-system-default g++, and it use newer libstdc++, and then got error from using older libstdc++ from system, that should not happened if we link with -static-libgcc and -static-libstdc++. gcc/ChangeLog: * config/riscv/t-riscv: Adjust build rule for gen-riscv-ext-opt and gen-riscv-ext-texi. --- diff --git a/gcc/config/riscv/t-riscv b/gcc/config/riscv/t-riscv index 854daa96e73..32092d85687 100644 --- a/gcc/config/riscv/t-riscv +++ b/gcc/config/riscv/t-riscv @@ -198,19 +198,24 @@ RISCV_EXT_DEFS = \ $(srcdir)/config/riscv/riscv-ext.opt: $(RISCV_EXT_DEFS) -build/gen-riscv-ext-opt$(build_exeext): $(srcdir)/config/riscv/gen-riscv-ext-opt.cc \ +build/gen-riscv-ext-opt.o: $(srcdir)/config/riscv/gen-riscv-ext-opt.cc \ $(RISCV_EXT_DEFS) - $(CXX_FOR_BUILD) $(CXXFLAGS_FOR_BUILD) $< -o $@ + $(CXX_FOR_BUILD) $(CXXFLAGS_FOR_BUILD) -c $< -o $@ + +build/gen-riscv-ext-opt$(build_exeext): build/gen-riscv-ext-opt.o + $(LINKER_FOR_BUILD) $(BUILD_LINKERFLAGS) $(BUILD_LDFLAGS) -o $@ $< s-riscv-ext.opt: build/gen-riscv-ext-opt$(build_exeext) $(RUN_GEN) build/gen-riscv-ext-opt$(build_exeext) > tmp-riscv-ext.opt $(SHELL) $(srcdir)/../move-if-change tmp-riscv-ext.opt $(srcdir)/config/riscv/riscv-ext.opt $(STAMP) s-riscv-ext.opt -build/gen-riscv-ext-texi$(build_exeext): $(srcdir)/config/riscv/gen-riscv-ext-texi.cc \ +build/gen-riscv-ext-texi.o: $(srcdir)/config/riscv/gen-riscv-ext-texi.cc \ $(RISCV_EXT_DEFS) - $(CXX_FOR_BUILD) $(CXXFLAGS_FOR_BUILD) $< -o $@ + $(CXX_FOR_BUILD) $(CXXFLAGS_FOR_BUILD) -c $< -o $@ +build/gen-riscv-ext-texi$(build_exeext): build/gen-riscv-ext-texi.o + $(LINKER_FOR_BUILD) $(BUILD_LINKERFLAGS) $(BUILD_LDFLAGS) -o $@ $< $(srcdir)/doc/riscv-ext.texi: $(RISCV_EXT_DEFS) $(srcdir)/doc/riscv-ext.texi: s-riscv-ext.texi ; @true