Ping?
On 23/06/2026 08:54, Nathan Sidwell wrote:
the riscv backend creates a generator file, and attempts to add it to genprogs
variable. But that fails as the target make fragments are included earlier than
gcc's Makefile.in sets genprogs and related variables.
So, t-riscv works around this by copying the generator file link rule.
Changing gcc/Makefile.in to append, rather than set, the various generator
variables means we no longer need that special rule.
I also tweaked the spacing of t-riscv's appending to genprogs, as whitespace is
more conventional there.
nathan
--
Nathan Sidwell
From b90288c3d17a6696bf9bc24a168cbfab1267b8ef Mon Sep 17 00:00:00 2001
From: Nathan Sidwell <[email protected]>
Date: Mon, 22 Jun 2026 14:26:07 -0400
Subject: [PATCH] Allow tm files to add generator programs
gcc/
* Makefile.in (genprogrtl, genprogmd, genprogerr, genprog): Append,
rather than set.
* config/riscv/t-riscv: Delete genrvv-type-indexer workaround rule,
it is no longer needed.
---
gcc/Makefile.in | 12 ++++++++----
gcc/config/riscv/t-riscv | 6 +-----
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 536e2faaaf8..2347f140bc8 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3372,21 +3372,25 @@ build/gencfn-macros.o : gencfn-macros.cc $(BCONFIG_H) $(SYSTEM_H) \
# since they need to run on this machine
# even if GCC is being compiled to run on some other machine.
+# We append to the genFOO variables so that target make ftagments can
+# add programs to them (those includes have already been included).
+# Example: riscv/t-riscv
+
# All these programs use the RTL reader ($(BUILD_RTL)).
-genprogrtl = attr attr-common attrtab automata codes conditions config emit \
+genprogrtl += attr attr-common attrtab automata codes conditions config emit \
extract flags mddump opinit output peep preds recog target-def
$(genprogrtl:%=build/gen%$(build_exeext)): $(BUILD_RTL)
# All these programs use the MD reader ($(BUILD_MD)).
-genprogmd = $(genprogrtl) mddeps constants enums
+genprogmd += $(genprogrtl) mddeps constants enums
$(genprogmd:%=build/gen%$(build_exeext)): $(BUILD_MD)
# All these programs need to report errors.
-genprogerr = $(genprogmd) genrtl modes gtype hooks cfn-macros condmd
+genprogerr += $(genprogmd) genrtl modes gtype hooks cfn-macros condmd
$(genprogerr:%=build/gen%$(build_exeext)): $(BUILD_ERRORS)
# Remaining build programs.
-genprog = $(genprogerr) check checksum match
+genprog += $(genprogerr) check checksum match
# These programs need libs over and above what they get from the above list.
build/genautomata$(build_exeext) : BUILD_LIBS += -lm
diff --git a/gcc/config/riscv/t-riscv b/gcc/config/riscv/t-riscv
index 1f06a3697b6..2a4a2ccab50 100644
--- a/gcc/config/riscv/t-riscv
+++ b/gcc/config/riscv/t-riscv
@@ -203,10 +203,6 @@ $(common_out_file): $(srcdir)/config/riscv/riscv-cores.def \
build/genrvv-type-indexer.o: $(srcdir)/config/riscv/genrvv-type-indexer.cc $(BCONFIG_H) $(SYSTEM_H) \
$(CORETYPES_H) $(GTM_H) errors.h $(GENSUPPORT_H)
-build/genrvv-type-indexer$(build_exeext): build/genrvv-type-indexer.o
- +$(LINKER_FOR_BUILD) $(BUILD_LINKERFLAGS) $(BUILD_LDFLAGS) -o $@ \
- $(filter-out $(BUILD_LIBDEPS), $^) $(BUILD_LIBS)
-
$(srcdir)/config/riscv/riscv-vector-builtins.def: riscv-vector-type-indexer.gen.def
$(srcdir)/config/riscv/riscv-vector-builtins.h: $(srcdir)/config/riscv/riscv-vector-builtins.def
$(srcdir)/config/riscv/sifive-vector-builtins-functions.def: riscv-vector-type-indexer.gen.def
@@ -219,7 +215,7 @@ s-riscv-vector-type-indexer.gen.defs: build/genrvv-type-indexer$(build_exeext)
$(SHELL) $(srcdir)/../move-if-change tmp-riscv-vector-type-indexer.gen.def riscv-vector-type-indexer.gen.def
$(STAMP) s-riscv-vector-type-indexer.gen.defs
-genprog+=rvv-type-indexer
+genprog += rvv-type-indexer
RISCV_EXT_DEFS = \
$(srcdir)/config/riscv/riscv-ext.def \
--
2.54.0