Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp1299015rwb; Fri, 28 Jul 2023 07:33:53 -0700 (PDT) X-Google-Smtp-Source: APBJJlGMLwR/3WikyUAqZGHkHxEb9UcjONO1AWN7OlQTLu8zW0AIODJsNDq0XAZyVdfiI3BkOaLJ X-Received: by 2002:a05:6a21:4843:b0:126:a5e3:3938 with SMTP id au3-20020a056a21484300b00126a5e33938mr2126677pzc.19.1690554833165; Fri, 28 Jul 2023 07:33:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690554833; cv=none; d=google.com; s=arc-20160816; b=lifrEy9SAvpcm04OKIYxiXDYSEW9fIWysxgCrM8gtlCiFRQ9pufuiHIfQY/xKk6hMH oY5YVwSf7WMdLfRlMWNWHsmOY5dq7zK3N+4hJLz8bWFzg5hWR3Tg1cQgdzO4OgtwiDXL 7pDp2Eou0KCKKaniqvcnduq3FX3DHAEs8lKWd52t1Petn7bsDgnnJvihi2zIuNglF6Fc AC6DTE6vlD6cmhV8USoBtM9Z+lCczFdTpVFNdiDYnW/t9ipwn6OMxC2571ZgMO/ZNry6 26/OySXjAPygWv0mmPoSjdmTjDSimX+LpiibvZ9yNQrublkqfNe9h7mdEBo4jFpY6JVn MJtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=0GoHn3mEzGeFIbY9/ejhvX/xXkxw+Kw7My637uPxlCc=; fh=8g3jwNFPgwpAsEMNkxXr8x6Sf1ChKao1DdkillSWx5c=; b=pQIVtIxOoYvFBzJ1gjAGnuk6qAbxYb/7K6NCPT++s1WMzIrJLxOkTUHBgvchsrBmEW m+3J5VKg6KLlv2A4tzw1vwMc8TvLyYh/pxgIE4Rud1Mbl9ykPFB1AuAZQ4hbYXGedHwD SrZsfkIe8mX4dk0gGvyJkjFGrjrgIqTpiYxgJ4TROmVF14y+HBnAQHp2FuzbzqCj48Ab z0G4BOwGbaWLkB+WVJ1tz2kWSmARw+cu2TMXWCgTyymuHYDlhVUyMLAIIwCWVG5k62yy eGLRLTkMw6zpRVyyS9vgnaCfV9E0BD0DCxxseOuv2/6HYnZ/Cyv2yPyyy7oO7+3fO/2x zeww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=t1etBMMW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n127-20020a632785000000b0055c7eb346e1si3160296pgn.757.2023.07.28.07.33.37; Fri, 28 Jul 2023 07:33:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=t1etBMMW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236774AbjG1OJi (ORCPT + 99 others); Fri, 28 Jul 2023 10:09:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232825AbjG1OJg (ORCPT ); Fri, 28 Jul 2023 10:09:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA0BB35A8; Fri, 28 Jul 2023 07:09:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 477326214B; Fri, 28 Jul 2023 14:09:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7FCC2C433C8; Fri, 28 Jul 2023 14:09:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690553374; bh=KLjExLhXnoctgt1F9lPT4E5ymQFk/shVtkceDCu/DEw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=t1etBMMWEBHJC08coP28YOQwC8VVdJesVcfvy18HnTq4G3U1ROuBFX3sNmyhnlKTl wzoA/DYjJ9eVCXjIoEXKzN04peXut9x/9jSSA7B5xCwZsMzPTHo90weaB40QoBvyld uQk112OiQI6MIxJprD1k1RhOn5ktNfrkPrD8vBnsS3PjIaVFvXg9U+vWyl4e81df8f flm6vvxxn/AdxotNwvTgG3a4NQ9YzWxOBMIojxnRRBZOG+Vez+N0ASvKC0jf5k5S3U u28l5ip/GchiYuL7gT1qqst1buMHlNuF6xlr1ijT4wdC3CrUJvKzQob07kx4kyawIR MHlq42gPSy/bA== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 37CD740096; Fri, 28 Jul 2023 11:09:32 -0300 (-03) Date: Fri, 28 Jul 2023 11:09:32 -0300 From: Arnaldo Carvalho de Melo To: Namhyung Kim Cc: Jiri Olsa , Ian Rogers , Adrian Hunter , Peter Zijlstra , Ingo Molnar , LKML , linux-perf-users@vger.kernel.org, Anup Sharma , stable@vger.kernel.org Subject: Re: [PATCH v2 1/2] perf build: Update build rule for generated files Message-ID: References: <20230728022447.1323563-1-namhyung@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230728022447.1323563-1-namhyung@kernel.org> X-Url: http://acmel.wordpress.com X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Thu, Jul 27, 2023 at 07:24:46PM -0700, Namhyung Kim escreveu: > The bison and flex generate C files from the source (.y and .l) > files. When O= option is used, they are saved in a separate directory > but the default build rule assumes the .C files are in the source > directory. So it might read invalid file if there are generated files > from an old version. The same is true for the pmu-events files. > > For example, the following command would cause a build failure: > > $ git checkout v6.3 > $ make -C tools/perf # build in the same directory > > $ git checkout v6.5-rc2 > $ mkdir build # create a build directory > $ make -C tools/perf O=build # build in a different directory but it > # refers files in the source directory > > Let's update the build rule to specify those cases explicitly to depend > on the files in the output directory. > > Note that it's not a complete fix and it needs the next patch for the > include path too. Applied, testing it on the container builds. - Arnaldo > Fixes: 80eeb67fe577 ("perf jevents: Program to convert JSON file") > Cc: stable@vger.kernel.org > Signed-off-by: Namhyung Kim > --- > tools/build/Makefile.build | 10 ++++++++++ > tools/perf/pmu-events/Build | 6 ++++++ > 2 files changed, 16 insertions(+) > > diff --git a/tools/build/Makefile.build b/tools/build/Makefile.build > index 89430338a3d9..fac42486a8cf 100644 > --- a/tools/build/Makefile.build > +++ b/tools/build/Makefile.build > @@ -117,6 +117,16 @@ $(OUTPUT)%.s: %.c FORCE > $(call rule_mkdir) > $(call if_changed_dep,cc_s_c) > > +# bison and flex files are generated in the OUTPUT directory > +# so it needs a separate rule to depend on them properly > +$(OUTPUT)%-bison.o: $(OUTPUT)%-bison.c FORCE > + $(call rule_mkdir) > + $(call if_changed_dep,$(host)cc_o_c) > + > +$(OUTPUT)%-flex.o: $(OUTPUT)%-flex.c FORCE > + $(call rule_mkdir) > + $(call if_changed_dep,$(host)cc_o_c) > + > # Gather build data: > # obj-y - list of build objects > # subdir-y - list of directories to nest > diff --git a/tools/perf/pmu-events/Build b/tools/perf/pmu-events/Build > index 150765f2baee..1d18bb89402e 100644 > --- a/tools/perf/pmu-events/Build > +++ b/tools/perf/pmu-events/Build > @@ -35,3 +35,9 @@ $(PMU_EVENTS_C): $(JSON) $(JSON_TEST) $(JEVENTS_PY) $(METRIC_PY) $(METRIC_TEST_L > $(call rule_mkdir) > $(Q)$(call echo-cmd,gen)$(PYTHON) $(JEVENTS_PY) $(JEVENTS_ARCH) $(JEVENTS_MODEL) pmu-events/arch $@ > endif > + > +# pmu-events.c file is generated in the OUTPUT directory so it needs a > +# separate rule to depend on it properly > +$(OUTPUT)pmu-events/pmu-events.o: $(PMU_EVENTS_C) > + $(call rule_mkdir) > + $(call if_changed_dep,cc_o_c) > -- > 2.41.0.487.g6d72f3e995-goog > -- - Arnaldo