From 404d7421d2344b3988b74a92675854bcb963a0b5185fd0a75beca52aa4b6a7e4 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Tue, 27 Sep 2022 11:25:54 +0000 Subject: [PATCH] Accepting request 1006015 from home:Andreas_Schwab:Factory - makefile-bison-rule.patch: Makefile: fix infinite recursion by dropping non-existent `%.output` OBS-URL: https://build.opensuse.org/request/show/1006015 OBS-URL: https://build.opensuse.org/package/show/Base:System/dtc?expand=0&rev=59 --- dtc.changes | 6 +++++ dtc.spec | 2 ++ makefile-bison-rule.patch | 50 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 makefile-bison-rule.patch diff --git a/dtc.changes b/dtc.changes index 8bce562..747d7e6 100644 --- a/dtc.changes +++ b/dtc.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Sep 26 07:37:52 UTC 2022 - Andreas Schwab + +- makefile-bison-rule.patch: Makefile: fix infinite recursion by dropping + non-existent `%.output` + ------------------------------------------------------------------- Sat Oct 16 13:06:58 UTC 2021 - Dirk Müller diff --git a/dtc.spec b/dtc.spec index 141e3f9..35b1a9d 100644 --- a/dtc.spec +++ b/dtc.spec @@ -27,6 +27,7 @@ Source0: https://mirrors.edge.kernel.org/pub/software/utils/dtc/dtc-%{ver Source1: https://mirrors.edge.kernel.org/pub/software/utils/dtc/dtc-%{version}.tar.sign Source20: baselibs.conf Source21: dtc.keyring +Patch0: makefile-bison-rule.patch BuildRequires: bison BuildRequires: flex BuildRequires: libyaml-devel @@ -59,6 +60,7 @@ This package provides development files for libfdt %prep %setup -q +%patch0 -p1 %build %make_build EXTRA_CFLAGS="%{optflags} -pie" LDFLAGS="%{optflags}" diff --git a/makefile-bison-rule.patch b/makefile-bison-rule.patch new file mode 100644 index 0000000..138eb32 --- /dev/null +++ b/makefile-bison-rule.patch @@ -0,0 +1,50 @@ +From 98a07006c48dc0bc3f42b3b3ce75b7f03e87e724 Mon Sep 17 00:00:00 2001 +From: Sergei Trofimovich +Date: Sun, 25 Sep 2022 11:42:03 +0100 +Subject: [PATCH] Makefile: fix infinite recursion by dropping non-existent + `%.output` + +Without the change GNU `make-4.4` falls into infinite recursion of trying +to generate %.output files (bison is not passed flags to generate debug +output). + +This happens on GNU `make-4.4` only after GNU make change to more eagerly +rebuild all target outputs in multiple targets: + https://savannah.gnu.org/bugs/index.php?63098 + +The recursion here is the following: + +- Makefile depends on *.d files +- *.d files depend on *.c files +- *.c files are generated by bison +- bison is triggered whenever some of it's multiple targets are missing + +In our case `%.output` is always missing and bison is always reran. +*.d files are always regenerated on `make` run. And make is always +restarted as *.d files are always regenerated. + +The fix removes infeasible `%.output`. + +Signed-off-by: Sergei Trofimovich +Message-Id: <20220925104203.648449-2-slyich@gmail.com> +Signed-off-by: David Gibson +--- + Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index e7a0dcb..d4e7551 100644 +--- a/Makefile ++++ b/Makefile +@@ -384,7 +384,7 @@ clean: libfdt_clean pylibfdt_clean tests_clean + @$(VECHO) LEX $@ + $(LEX) -o$@ $< + +-%.tab.c %.tab.h %.output: %.y ++%.tab.c %.tab.h: %.y + @$(VECHO) BISON $@ + $(BISON) -b $(basename $(basename $@)) -d $< + +-- +2.37.3 +