[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 2/5] rules.mak: Link with C++ if we have a C++ co
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [PATCH v3 2/5] rules.mak: Link with C++ if we have a C++ compiler |
Date: |
Wed, 5 Feb 2014 17:28:34 +0000 |
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 <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
---
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
- [Qemu-devel] [PATCH v3 0/5] disas: add libvixl to support A64 disassembly, Peter Maydell, 2014/02/05
- [Qemu-devel] [PATCH v3 4/5] disas/libvixl: Fix upstream libvixl compilation issues, Peter Maydell, 2014/02/05
- [Qemu-devel] [PATCH v3 1/5] rules.mak: Support .cc as a C++ source file suffix, Peter Maydell, 2014/02/05
- [Qemu-devel] [PATCH v3 2/5] rules.mak: Link with C++ if we have a C++ compiler,
Peter Maydell <=
- [Qemu-devel] [PATCH v3 5/5] disas: Implement disassembly output for A64, Peter Maydell, 2014/02/05
- [Qemu-devel] [PATCH v3 3/5] disas: Add subset of libvixl sources for A64 disassembler, Peter Maydell, 2014/02/05
- Re: [Qemu-devel] [PATCH v3 0/5] disas: add libvixl to support A64 disassembly, Michael Matz, 2014/02/06