From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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> From: "H.J. Lu" 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 Cc: GNU C Library , Florian Weimer Content-Type: multipart/mixed; boundary="0000000000002f183805d0e0a6ed" 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-List-Received-Date: Tue, 16 Nov 2021 04:49:28 -0000 --0000000000002f183805d0e0a6ed Content-Type: text/plain; charset="UTF-8" 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. -- H.J. --0000000000002f183805d0e0a6ed Content-Type: text/x-patch; charset="US-ASCII"; name="0001-elf-Use-a-temporary-file-to-generate-Makefile-fragme.patch" Content-Disposition: attachment; filename="0001-elf-Use-a-temporary-file-to-generate-Makefile-fragme.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_kw1m7fjy0 RnJvbSBhOTI4YjUyYzAzNmJiODg4Nzk3YjNlODEwMTRmNDQxZjBkODc2YjY1IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiAiSC5KLiBMdSIgPGhqbC50b29sc0BnbWFpbC5jb20+CkRhdGU6 IE1vbiwgMTUgTm92IDIwMjEgMTY6Mjg6MzkgLTA4MDAKU3ViamVjdDogW1BBVENIXSBlbGY6IFVz ZSBhIHRlbXBvcmFyeSBmaWxlIHRvIGdlbmVyYXRlIE1ha2VmaWxlIGZyYWdtZW50cyBbQloKICMy ODU1MF0KClVzZSBhIHRlbXBvcmFyeSBmaWxlIHRvIGdlbmVyYXRlIE1ha2VmaWxlIGZyYWdtZW50 cyBmb3IgRFNPIHNvcnRpbmcgdGVzdHMKYW5kIHVzZSAtaW5jbHVkZSBvbiB0aGVtLgoKVGhpcyBw YXJ0aWFsbHkgZml4ZXMgQlogIzI4NTUwLgotLS0KIGVsZi9NYWtlZmlsZSB8IDUgKysrLS0KIDEg ZmlsZSBjaGFuZ2VkLCAzIGluc2VydGlvbnMoKyksIDIgZGVsZXRpb25zKC0pCgpkaWZmIC0tZ2l0 IGEvZWxmL01ha2VmaWxlIGIvZW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