From patchwork Tue Nov 16 04:48:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 47746 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 925113857823 for ; Tue, 16 Nov 2021 04:49:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 925113857823 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1637038187; bh=4ojvTTdDdZmAzN0K7VZXj/2AbK8wZlk0AGny4tny/Nw=; h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=o7kV+epB/domHtOeiPFFTKsIJ+JI57ecBBmzRvgDKDjqCNExm0jkzjpBEejaMTNeN LCMaEdXhTXYbbFc4wIl9eiRlpaftJwvJXuXEriMRQJ3v0nJFe+nXumNons+11lBugL cpYAKPaW72dssZu7WPuvEuivew1YG5cLmc7vStCc= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by sourceware.org (Postfix) with ESMTPS id CF9CA3858430 for ; Tue, 16 Nov 2021 04:49:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CF9CA3858430 Received: by mail-pj1-x1035.google.com with SMTP id gx15-20020a17090b124f00b001a695f3734aso1784659pjb.0 for ; Mon, 15 Nov 2021 20:49:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4ojvTTdDdZmAzN0K7VZXj/2AbK8wZlk0AGny4tny/Nw=; b=sGyogzPm7tw7YQoy0ZcfnmGXPG31afAX8HnSP7nHThhlorlhzKwinb9uAtCvHOSnRT Wek1DIv4Fdwr3iZAzr4ZnmIxtjnPLsM4GpufPZOYEcUAp61GTfXPH2tCpnLVEpjRGd2v kEI1szW8++SnxB16d8GnbWZogz7A5Jvl82Fpp0yDsGkhXWvDT5laOx9j/AibfC4120YL gHi0t/8LN8to07u9JsYXoCT5Vs/Z+qJzu7jmS4ICFOkKsbg/oKdEGO/1UYMVBrKzIZNd 2syGmR8oqsQbW2OBcut64/ArFZLOKJLkQvRb1uUW2Df6Qs9aoSTPbO8FqiPqjSWo5nyP tNAg== X-Gm-Message-State: AOAM53202rA3F69YEQVTwn5s7f86Huu0LdAPcl4TSFMk6IBrxj05r2+H VbvvOxvhP6J8U6xQds+yehQo5KBlseAqh4BqRGsNlO8L X-Google-Smtp-Source: ABdhPJyOIf0OnWbNeru12l+hR0lciZTDcZDYn/nc3tfF/CEqf2kupxeKH5v0Ki1nuLJrApz960COfJ3Y1ZoQv5k4aHU= X-Received: by 2002:a17:902:904b:b0:143:73ff:eb7d with SMTP id w11-20020a170902904b00b0014373ffeb7dmr40933987plz.85.1637038162854; Mon, 15 Nov 2021 20:49:22 -0800 (PST) MIME-Version: 1.0 References: <20211108154211.167829-1-hjl.tools@gmail.com> <20211108154211.167829-3-hjl.tools@gmail.com> <95b7c1f9-406b-9711-d056-461e657c26b1@linaro.org> In-Reply-To: <95b7c1f9-406b-9711-d056-461e657c26b1@linaro.org> Date: Mon, 15 Nov 2021 20:48:47 -0800 Message-ID: Subject: [PATCH] elf: Use a temporary file to generate Makefile fragments [BZ #28550] To: Adhemerval Zanella X-Spam-Status: No, score=-3029.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: "H.J. Lu via Libc-alpha" From: "H.J. Lu" Reply-To: "H.J. Lu" Cc: Florian Weimer , GNU C Library Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" On Mon, Nov 15, 2021 at 12:18 PM Adhemerval Zanella wrote: > > > > On 15/11/2021 16:51, H.J. Lu wrote: > > On Mon, Nov 15, 2021 at 10:59 AM Adhemerval Zanella > > wrote: > >> > >> > >> > >> On 08/11/2021 12:42, H.J. Lu via Libc-alpha wrote: > >>> Generate Makefile fragment for DSO sorting tests at configure time. > >>> > >>> This partially fixes BZ #28550. > >> > >> I am not sure if configure.ac is the right place to generate the Makefile > >> fragment required for tests. Can we use 'avoid-generated' instead? > >> > >> > >> diff --git a/elf/Makefile b/elf/Makefile > >> index a311c3e23c..8556105a20 100644 > >> --- a/elf/Makefile > >> +++ b/elf/Makefile > >> @@ -491,6 +491,7 @@ tests-special += $(objpfx)order-cmp.out $(objpfx)tst-array1-cmp.out \ > >> $(objpfx)tst-unused-dep-cmp.out > >> endif > >> > >> +ifndef avoid-generated > >> # DSO sorting tests: > >> # The dso-ordering-test.py script generates testcase source files in $(objpfx), > >> # creating a $(objpfx)-dir for each testcase, and creates a > >> @@ -507,6 +508,7 @@ ifeq (yes,$(have-tunables)) > >> $(eval $(call include_dsosort_tests,dso-sort-tests-1.def)) > >> $(eval $(call include_dsosort_tests,dso-sort-tests-2.def)) > >> endif > >> +endif > > > > It doesn't work. "make check -j28" on a machine with 112 cores failed: > > > > /export/users/hjl/build/gnu/tools-build/glibc-cet-gitlab/build-x86_64-linux/elf/dso-sort-tests-1.def.generated-makefile:938: > > warning: ignoring old recipe for target > > '/export/users/hjl/build/gnu/tools-build/glibc-cet-gitlab/build-x86_64-linux/elf/tst-dso-ordering9-dir/tst-dso-ordering9_25-bacde-b.so' > > ... > > make[3]: *** [Makefile:483: elf/tests] Error 2 > > > > I couldn't find the exact error message in a very long make log file. > This is usual way to create other auto-generated Makefile fragments, such as > sysd-sycalls and time64-compat.mk. Maybe the below helps (I forgot to use > '-include' and add the fragments on postclean-generated). > > > diff --git a/elf/Makefile b/elf/Makefile > index a311c3e23c..0e6d7ffb51 100644 > --- a/elf/Makefile > +++ b/elf/Makefile > @@ -491,6 +491,7 @@ tests-special += $(objpfx)order-cmp.out $(objpfx)tst-array1-cmp.out \ > $(objpfx)tst-unused-dep-cmp.out > endif > > +ifndef avoid-generated > # DSO sorting tests: > # The dso-ordering-test.py script generates testcase source files in $(objpfx), > # creating a $(objpfx)-dir for each testcase, and creates a > @@ -499,7 +500,7 @@ define include_dsosort_tests > $(objpfx)$(1).generated-makefile: $(1) > $(PYTHON) $(..)scripts/dso-ordering-test.py \ > --description-file $$< --objpfx $(objpfx) --output-makefile $$@ > -include $(objpfx)$(1).generated-makefile > +-include $(objpfx)$(1).generated-makefile > endef > > # Generate from each testcase description file > @@ -507,6 +508,10 @@ ifeq (yes,$(have-tunables)) > $(eval $(call include_dsosort_tests,dso-sort-tests-1.def)) > $(eval $(call include_dsosort_tests,dso-sort-tests-2.def)) > endif > +endif > + > +postclean-generated += $(objpfx)/dso-sort-tests-2.generated-makefile \ > + $(objpfx)/dso-sort-tests-2.generated-makefile > > check-abi: $(objpfx)check-abi-ld.out > tests-special += $(objpfx)check-abi-ld.out This works for me. Thanks. From a928b52c036bb888797b3e81014f441f0d876b65 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Mon, 15 Nov 2021 16:28:39 -0800 Subject: [PATCH] elf: Use a temporary file to generate Makefile fragments [BZ #28550] Use a temporary file to generate Makefile fragments for DSO sorting tests and use -include on them. This partially fixes BZ #28550. --- elf/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/elf/Makefile b/elf/Makefile index a311c3e23c..57374fc690 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -498,8 +498,9 @@ endif define include_dsosort_tests $(objpfx)$(1).generated-makefile: $(1) $(PYTHON) $(..)scripts/dso-ordering-test.py \ - --description-file $$< --objpfx $(objpfx) --output-makefile $$@ -include $(objpfx)$(1).generated-makefile + --description-file $$< --objpfx $(objpfx) --output-makefile $$@T + mv $$@T $$@ +-include $(objpfx)$(1).generated-makefile endef # Generate from each testcase description file -- 2.33.1