From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: patches@linaro.org, "Stefan Weil" <sw@weilnetz.de>,
"Alexander Graf" <agraf@suse.de>,
"Blue Swirl" <blauwirbel@gmail.com>,
"Claudio Fontana" <claudio.fontana@linaro.org>,
"Aurelien Jarno" <aurelien@aurel32.net>,
"Anthony Liguori" <aliguori@amazon.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
kvmarm@lists.cs.columbia.edu,
"Christoffer Dall" <christoffer.dall@linaro.org>,
"Richard Henderson" <rth@twiddle.net>
Subject: [Qemu-devel] [PATCH 2/4] rules.mak: Link with C++ if we have a C++ compiler
Date: Tue, 7 Jan 2014 16:51:26 +0000 [thread overview]
Message-ID: <1389113488-18005-3-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1389113488-18005-1-git-send-email-peter.maydell@linaro.org>
If we have a C++ compiler available, link with it, because we might be
linking some C++ files in. This allows us to include C++ object files
in the QEMU binary proper.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
rules.mak | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/rules.mak b/rules.mak
index cd9187e..391d6eb 100644
--- a/rules.mak
+++ b/rules.mak
@@ -27,8 +27,12 @@ QEMU_INCLUDES += -I$(<D) -I$(@D)
%.o: %.rc
$(call quiet-command,$(WINDRES) -I. -o $@ $<," RC $(TARGET_DIR)$@")
+# If we have a CXX we might have some C++ objects, in which case we
+# must link with the C++ compiler, not the plain C compiler.
+LINKPROG = $(or $(CXX),$(CC))
+
ifeq ($(LIBTOOL),)
-LINK = $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ \
+LINK = $(call quiet-command,$(LINKPROG) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ \
$(sort $(filter %.o, $1)) $(filter-out %.o, $1) $(version-obj-y) \
$(LIBS)," LINK $(TARGET_DIR)$@")
else
@@ -42,7 +46,7 @@ LIBTOOL += $(if $(V),,--quiet)
LINK = $(call quiet-command,\
$(if $(filter %.lo %.la,$^),$(LIBTOOL) --mode=link --tag=CC \
- )$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ \
+ )$(LINKPROG) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ \
$(sort $(filter %.o, $1)) $(filter-out %.o, $1) \
$(if $(filter %.lo %.la,$^),$(version-lobj-y),$(version-obj-y)) \
$(if $(filter %.lo %.la,$^),$(LIBTOOLFLAGS)) \
--
1.8.5
next prev parent reply other threads:[~2014-01-07 16:51 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-07 16:51 [Qemu-devel] [PATCH 0/4] disas: add libvixl to support A64 disassembly Peter Maydell
2014-01-07 16:51 ` [Qemu-devel] [PATCH 1/4] rules.mak: Support .cc as a C++ source file suffix Peter Maydell
2014-01-07 16:51 ` Peter Maydell [this message]
2014-01-07 16:51 ` [Qemu-devel] [PATCH 3/4] disas: add libvixl source code for AArch64 A64 disassembler Peter Maydell
2014-01-07 16:51 ` [Qemu-devel] [PATCH 4/4] disas: Implement disassembly output for A64 Peter Maydell
2014-01-07 22:30 ` [Qemu-devel] [PATCH 0/4] disas: add libvixl to support A64 disassembly Stefan Weil
2014-01-07 23:00 ` Peter Maydell
2014-01-08 6:55 ` Stefan Weil
2014-01-08 10:07 ` Peter Maydell
2014-01-07 22:53 ` Stefan Weil
2014-01-08 14:51 ` Alex Bennée
2014-01-08 15:31 ` Peter Maydell
2014-01-08 16:19 ` Alexander Graf
2014-01-07 23:46 ` Peter Maydell
2014-01-08 14:48 ` Alex Bennée
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=1389113488-18005-3-git-send-email-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=agraf@suse.de \
--cc=alex.bennee@linaro.org \
--cc=aliguori@amazon.com \
--cc=aurelien@aurel32.net \
--cc=blauwirbel@gmail.com \
--cc=christoffer.dall@linaro.org \
--cc=claudio.fontana@linaro.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=patches@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
--cc=sw@weilnetz.de \
/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 NNTP newsgroup(s).