From patchwork Mon Feb 19 16:16:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 25970 Received: (qmail 22212 invoked by alias); 19 Feb 2018 16:16:53 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 22194 invoked by uid 89); 19 Feb 2018 16:16:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 19 Feb 2018 16:16:50 +0000 Received: from [10.0.0.11] (192-222-251-162.qc.cable.ebox.net [192.222.251.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 0E2941E059; Mon, 19 Feb 2018 11:16:45 -0500 (EST) Subject: Re: [PATCH] Fix make 3.81 build errors To: Alan Hayward , "gdb-patches@sourceware.org" Cc: nd References: <2254C28C-A28A-4720-A573-CFC2BA60C5A1@arm.com> From: Simon Marchi Message-ID: Date: Mon, 19 Feb 2018 11:16:39 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <2254C28C-A28A-4720-A573-CFC2BA60C5A1@arm.com> On 2018-02-19 09:32 AM, Alan Hayward wrote: > Make rules in make 3.81 are parsed slightly different than newer > versions of make. > > Patch b5884fa7101cc528f07fd57c3de445a3680964a6 caused build errors > on the older 3.81: > make[4]: *** No rule to make target `../../../binutils-gdb/gdb/gdbserver/common/btrace-common.c'. Stop. > > This is because make 3.81 was using the wrong rule to build btrace-common.c, > causing it to look in the wrong source directory. > > This fix simply re-orders the make rules in gdbserver. However, for reasons > I am unsure of, this requires moving the corresponding ipa rule. I've tried > many many different combinations, and this is the only one that works. > Therefore, not pushing as obvious and asking for review first. > > Tested on x86 and Ubuntu-AArch32-native-extended-gdbserver-m32 builds using > both make 4.1 and make 3.81 > > gdbserver/ > > 2018-02-19 Alan Hayward > > * Makefile.in: Switch order of make rules. Hi Alan, I hit this problem with GNU Make 3.81 before, there's a comment in the gdbserver Makefile: # Note: Between two matching pattern rules, GNU Make 3.81 chooses the first one. # Therefore, this one needs to be before "%.o: %.c" for it to be considered for # files such as linux-amd64-ipa.o generated from linux-amd64-ipa.c. # # Later versions of GNU Make choose the rule with the shortest stem, so it would # work in any order. So to please Make 3.81, you need to order rules from the more specific (shorter stem) to the more general (longer stem) if you want it to pick up the more specific rule. That means putting "common/%.o: ../common/%.c" before "%.o: %.c". I think there's a way to do it while keeping related rules a bit more together. What about the patch below? I moved a bit more than necessary (e.g. the arch/ rule) to put all rules for things that go into the gdbserver binary together and have a similar order for both gdbserver and the IPA. From ac84e284d818b3e6e58f87e5cb5ceb5152cdd8ca Mon Sep 17 00:00:00 2001 From: Alan Hayward Date: Mon, 19 Feb 2018 14:32:07 +0000 Subject: [PATCH] Fix make 3.81 build errors Make rules in make 3.81 are parsed slightly different than newer versions of make. Patch b5884fa7101cc528f07fd57c3de445a3680964a6 caused build errors on the older 3.81: make[4]: *** No rule to make target `../../../binutils-gdb/gdb/gdbserver/common/btrace-common.c'. Stop. This is because make 3.81 was using the wrong rule to build btrace-common.c, causing it to look in the wrong source directory. This fix simply re-orders the make rules in gdbserver. However, for reasons I am unsure of, this requires moving the corresponding ipa rule. I've tried many many different combinations, and this is the only one that works. Therefore, not pushing as obvious and asking for review first. Tested on x86 and Ubuntu-AArch32-native-extended-gdbserver-m32 builds using both make 4.1 and make 3.81 gdbserver/ 2018-02-19 Alan Hayward * Makefile.in: Switch order of make rules. --- gdb/gdbserver/Makefile.in | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in index fcb6e1e817..55796ac8da 100644 --- a/gdb/gdbserver/Makefile.in +++ b/gdb/gdbserver/Makefile.in @@ -537,11 +537,15 @@ ax.o: ax.c $(COMPILE) $(WARN_CFLAGS_NO_FORMAT) $< $(POSTCOMPILE) -arch/%.o: ../arch/%.c - $(COMPILE) $< +# Rules for objects that go in the in-process agent. + +arch/%-ipa.o: ../arch/%.c + $(IPAGENT_COMPILE) $< $(POSTCOMPILE) -# Rules for objects that go in the in-process agent. +common/%-ipa.o: ../common/%.c + $(IPAGENT_COMPILE) $< + $(POSTCOMPILE) %-ipa.o: %-generated.c $(IPAGENT_COMPILE) $< @@ -562,25 +566,21 @@ arch/%.o: ../arch/%.c $(IPAGENT_COMPILE) $< $(POSTCOMPILE) -common/%-ipa.o: ../common/%.c - $(IPAGENT_COMPILE) $< - $(POSTCOMPILE) - -arch/%-ipa.o: ../arch/%.c - $(IPAGENT_COMPILE) $< - $(POSTCOMPILE) - # Rules for objects that go in the gdbserver binary. -%.o: %-generated.c +arch/%.o: ../arch/%.c $(COMPILE) $< $(POSTCOMPILE) -%.o: %.c +common/%.o: ../common/%.c + $(COMPILE) $< + $(POSTCOMPILE) + +%.o: %-generated.c $(COMPILE) $< $(POSTCOMPILE) -common/%.o: ../common/%.c +%.o: %.c $(COMPILE) $< $(POSTCOMPILE)