public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix make 3.81 build errors
@ 2018-02-19 14:32 Alan Hayward
  2018-02-19 16:11 ` Andreas Schwab
  2018-02-19 16:16 ` Simon Marchi
  0 siblings, 2 replies; 7+ messages in thread
From: Alan Hayward @ 2018-02-19 14:32 UTC (permalink / raw)
  To: gdb-patches; +Cc: nd

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  <alan.hayward@arm.com>

	* Makefile.in: Switch order of make rules. 

---
 gdb/gdbserver/Makefile.in | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index fcb6e1e817f521385de3986861c430c31a1b7eec..e19885c7fef7c82bd2808cfcaa990dbfc5d40c18 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -541,6 +541,14 @@ arch/%.o: ../arch/%.c
 	$(COMPILE) $<
 	$(POSTCOMPILE)

+common/%.o: ../common/%.c
+	$(COMPILE) $<
+	$(POSTCOMPILE)
+
+common/%-ipa.o: ../common/%.c
+	$(IPAGENT_COMPILE) $<
+	$(POSTCOMPILE)
+
 # Rules for objects that go in the in-process agent.

 %-ipa.o: %-generated.c
@@ -562,10 +570,6 @@ arch/%.o: ../arch/%.c
 	$(IPAGENT_COMPILE) $<
 	$(POSTCOMPILE)

-common/%-ipa.o: ../common/%.c
-	$(IPAGENT_COMPILE) $<
-	$(POSTCOMPILE)
-
 arch/%-ipa.o: ../arch/%.c
 	$(IPAGENT_COMPILE) $<
 	$(POSTCOMPILE)
@@ -580,10 +584,6 @@ arch/%-ipa.o: ../arch/%.c
 	$(COMPILE) $<
 	$(POSTCOMPILE)

-common/%.o: ../common/%.c
-	$(COMPILE) $<
-	$(POSTCOMPILE)
-
 %.o: ../nat/%.c
 	$(COMPILE) $<
 	$(POSTCOMPILE)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Fix make 3.81 build errors
  2018-02-19 14:32 [PATCH] Fix make 3.81 build errors Alan Hayward
@ 2018-02-19 16:11 ` Andreas Schwab
  2018-02-19 16:39   ` Alan Hayward
  2018-02-19 16:16 ` Simon Marchi
  1 sibling, 1 reply; 7+ messages in thread
From: Andreas Schwab @ 2018-02-19 16:11 UTC (permalink / raw)
  To: Alan Hayward; +Cc: gdb-patches, nd

On Feb 19 2018, Alan Hayward <Alan.Hayward@arm.com> wrote:

> Make rules in make 3.81 are parsed slightly different than newer
> versions of make.

Probably this change:

* WARNING: Backward-incompatibility!
  The pattern-specific variables and pattern rules are now applied in the
  shortest stem first order instead of the definition order (variables
  and rules with the same stem length are still applied in the definition
  order). This produces the usually-desired behavior where more specific
  patterns are preferred. To detect this feature search for 'shortest-stem'
  in the .FEATURES special variable.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Fix make 3.81 build errors
  2018-02-19 14:32 [PATCH] Fix make 3.81 build errors Alan Hayward
  2018-02-19 16:11 ` Andreas Schwab
@ 2018-02-19 16:16 ` Simon Marchi
  1 sibling, 0 replies; 7+ messages in thread
From: Simon Marchi @ 2018-02-19 16:16 UTC (permalink / raw)
  To: Alan Hayward, gdb-patches; +Cc: nd

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  <alan.hayward@arm.com>
> 
> 	* 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 <Alan.Hayward@arm.com>
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  <alan.hayward@arm.com>

	* 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)

-- 
2.16.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Fix make 3.81 build errors
  2018-02-19 16:11 ` Andreas Schwab
@ 2018-02-19 16:39   ` Alan Hayward
  2018-02-19 16:44     ` Simon Marchi
  2018-02-20 10:32     ` Szabolcs Nagy
  0 siblings, 2 replies; 7+ messages in thread
From: Alan Hayward @ 2018-02-19 16:39 UTC (permalink / raw)
  To: Andreas Schwab, Simon Marchi; +Cc: gdb-patches, nd



> On 19 Feb 2018, at 16:11, Andreas Schwab <schwab@suse.de> wrote:
> 
> On Feb 19 2018, Alan Hayward <Alan.Hayward@arm.com> wrote:
> 
>> Make rules in make 3.81 are parsed slightly different than newer
>> versions of make.
> 
> Probably this change:
> 
> * WARNING: Backward-incompatibility!
>  The pattern-specific variables and pattern rules are now applied in the
>  shortest stem first order instead of the definition order (variables
>  and rules with the same stem length are still applied in the definition
>  order). This produces the usually-desired behavior where more specific
>  patterns are preferred. To detect this feature search for 'shortest-stem'
>  in the .FEATURES special variable.
> 

Make sense. But I’m still confused as to exactly why the IPA rules are
getting hit.
Thanks for the explanation.


> On 19 Feb 2018, at 16:16, Simon Marchi <simark@simark.ca> wrote:
> 
> 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.
> 

Thanks for the patch.
I’m happy with this. It’s makes the makefile tidier than with my fix.
I’ve tested it on my builds and it works fine for me (make 3.81, make 4) x (x86, aarch32).
I would have made my patch look a little neater, but I really didn’t want to touch more than I had to.

Alan.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Fix make 3.81 build errors
  2018-02-19 16:39   ` Alan Hayward
@ 2018-02-19 16:44     ` Simon Marchi
  2018-02-20 10:59       ` Alan Hayward
  2018-02-20 10:32     ` Szabolcs Nagy
  1 sibling, 1 reply; 7+ messages in thread
From: Simon Marchi @ 2018-02-19 16:44 UTC (permalink / raw)
  To: Alan Hayward; +Cc: Andreas Schwab, gdb-patches, nd

On 2018-02-19 11:39, Alan Hayward wrote:
> Thanks for the patch.
> I’m happy with this. It’s makes the makefile tidier than with my fix.
> I’ve tested it on my builds and it works fine for me (make 3.81, make
> 4) x (x86, aarch32).
> I would have made my patch look a little neater, but I really didn’t
> want to touch more than I had to.
> 
> Alan.

Thanks for testing.  Can you take care of pushing it?

Simon

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Fix make 3.81 build errors
  2018-02-19 16:39   ` Alan Hayward
  2018-02-19 16:44     ` Simon Marchi
@ 2018-02-20 10:32     ` Szabolcs Nagy
  1 sibling, 0 replies; 7+ messages in thread
From: Szabolcs Nagy @ 2018-02-20 10:32 UTC (permalink / raw)
  To: Alan Hayward, Andreas Schwab, Simon Marchi; +Cc: nd, gdb-patches

On 19/02/18 16:39, Alan Hayward wrote:
>> On 19 Feb 2018, at 16:16, Simon Marchi <simark@simark.ca> wrote:
> Thanks for the patch.
> I’m happy with this. It’s makes the makefile tidier than with my fix.
> I’ve tested it on my builds and it works fine for me (make 3.81, make 4) x (x86, aarch32).
> I would have made my patch look a little neater, but I really didn’t want to touch more than I had to.

can you please commit one of the fixes or revert the breaking change..

our toolchain builds are broken because of this.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Fix make 3.81 build errors
  2018-02-19 16:44     ` Simon Marchi
@ 2018-02-20 10:59       ` Alan Hayward
  0 siblings, 0 replies; 7+ messages in thread
From: Alan Hayward @ 2018-02-20 10:59 UTC (permalink / raw)
  To: Simon Marchi; +Cc: Andreas Schwab, gdb-patches, nd


> On 19 Feb 2018, at 16:44, Simon Marchi <simark@simark.ca> wrote:
> 
> On 2018-02-19 11:39, Alan Hayward wrote:
>> Thanks for the patch.
>> I’m happy with this. It’s makes the makefile tidier than with my fix.
>> I’ve tested it on my builds and it works fine for me (make 3.81, make
>> 4) x (x86, aarch32).
>> I would have made my patch look a little neater, but I really didn’t
>> want to touch more than I had to.
>> Alan.
> 
> Thanks for testing.  Can you take care of pushing it?
> 
> Simon

Pushed as requested.


Thanks,
Alan.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-02-20 10:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-19 14:32 [PATCH] Fix make 3.81 build errors Alan Hayward
2018-02-19 16:11 ` Andreas Schwab
2018-02-19 16:39   ` Alan Hayward
2018-02-19 16:44     ` Simon Marchi
2018-02-20 10:59       ` Alan Hayward
2018-02-20 10:32     ` Szabolcs Nagy
2018-02-19 16:16 ` Simon Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).