public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Bernd Edlinger <bernd.edlinger@hotmail.de>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: [PATCH] Fix build with GNU Make 3.81
Date: Sat, 14 Dec 2019 08:15:00 -0000	[thread overview]
Message-ID: <AM0PR08MB371457ACA4789DFC701C088EE4570@AM0PR08MB3714.eurprd08.prod.outlook.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 347 bytes --]

Hi,

I have a minor problem with building the gdbserver, alloc-ipa.o
on ubuntu 14.04 which still uses GNU Make 3.81.

Since several quirks for this GNU Make version exist, I suppose
this version is still intended to be supported.

This patch fixes the build with this make version, and works
also for newer versions.


Thanks
Bernd.

[-- Attachment #2: changelog.txt --]
[-- Type: text/plain, Size: 117 bytes --]

gdb/gdbserver:
2019-12-14  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	* Makefile.in: Fix build with GNU Make 3.81

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0001-Fix-build-with-GNU-Make-3.81.patch --]
[-- Type: text/x-patch; name="0001-Fix-build-with-GNU-Make-3.81.patch", Size: 2607 bytes --]

From 324a036bd552186baa9ea16d7ac0072d74220f35 Mon Sep 17 00:00:00 2001
From: Bernd Edlinger <bernd.edlinger@hotmail.de>
Date: Fri, 13 Dec 2019 17:21:21 +0100
Subject: [PATCH] Fix build with GNU Make 3.81

GNU Make 3.81 is apparently confused when the same
source file is processed by a pattern rule and an
explicit rule at the same time with different output file.
The pattern %.o: ../%.c and alloc-ipa.o: ../alloc.c
both have the source ../alloc.c but two independent
object files alloc.o and alloc-ipa.o, so
while building gdbserver I see the following message:

make[4]: Circular alloc-ipa.o <- ../alloc.c dependency dropped.
  CXX    alloc-ipa.o
g++: warning: '-x c++' after last input file has no effect
g++: fatal error: no input files
compilation terminated.

In the make debug output I see the pattern is first correct:

alloc-ipa.o: ../alloc.c | config.h build-gnulib-gdbserver/import/string.h
        $(IPAGENT_COMPILE) $(WARN_CFLAGS_NO_FORMAT) $<
        $(POSTCOMPILE)

But after the "Circular" dependency is dropped, the pattern
is changed to:

alloc-ipa.o: | config.h build-gnulib-gdbserver/import/string.h
        $(IPAGENT_COMPILE) $(WARN_CFLAGS_NO_FORMAT) $<
        $(POSTCOMPILE)

So indeed now $< is empty, and the build step fails.

This happens only when alloc.o needs to be built, when alloc.o
was already built, the build succeeds, but it takes often
several attempts until the build succeeds.
By rewriting the alloc-ipa.c: ../alloc.c rule into a pattern
rule, the problem goes away.

While already at it, this patch removes also the
$(WARN_CFLAGS_NO_FORMAT) from the build rule, which is just a
copy/paste thing that is not necessary for alloc.c at all.
---
 gdb/gdbserver/Makefile.in | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index 10e0040..9e8c213 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -580,10 +580,6 @@ ax.o: ax.c
 	$(COMPILE) $(WARN_CFLAGS_NO_FORMAT) $<
 	$(POSTCOMPILE)
 
-alloc-ipa.o: ../alloc.c
-	$(IPAGENT_COMPILE) $(WARN_CFLAGS_NO_FORMAT) $<
-	$(POSTCOMPILE)
-
 # Rules for objects that go in the in-process agent.
 
 arch/%-ipa.o: ../arch/%.c
@@ -602,6 +598,10 @@ gdbsupport/%-ipa.o: ../gdbsupport/%.c
 	$(IPAGENT_COMPILE) $<
 	$(POSTCOMPILE)
 
+%-ipa.o: ../%.c
+	$(IPAGENT_COMPILE) $<
+	$(POSTCOMPILE)
+
 # 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.
-- 
1.9.1


             reply	other threads:[~2019-12-14  8:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-14  8:15 Bernd Edlinger [this message]
2019-12-14 18:21 ` Simon Marchi
2019-12-19 17:29   ` Tom Tromey
2019-12-23  7:30     ` Joel Brobecker
2020-07-15  8:19   ` Tom de Vries
2020-07-15 13:44     ` Simon Marchi
2020-07-15 18:30       ` Tom de Vries

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AM0PR08MB371457ACA4789DFC701C088EE4570@AM0PR08MB3714.eurprd08.prod.outlook.com \
    --to=bernd.edlinger@hotmail.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).