qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 3/3] Workaround --whole-archive on Solaris


From: Andreas Färber
Subject: [Qemu-devel] [PATCH 3/3] Workaround --whole-archive on Solaris
Date: Sat, 12 Dec 2009 20:10:57 +0100

From: Andreas Färber <address@hidden>

On OpenSolaris, neither --whole-archive nor -z allextract
appear to work as expected, causing runtime errors. For example:

qemu: could not open disk image [...]

Fix this by extracting archives and linking their object files individually.

libqemu_common.a contains object files from different subdirectories,
leading to name clashes, e.g., nbd.o vs. block/nbd.o.

Archive a renamed copy of the affected files instead, this avoids
duplicating %.c -> %.o compilation rules. Two dashes are used for the copy
to avoid name clashes between, e.g., block-qcow.c and block/qcow.c.

Contain this behavior to Solaris to avoid speed regressions on Linux.

Signed-off-by: Andreas Färber <address@hidden>
Cc: Palle Lyckegaard <address@hidden>
Cc: Ben Taylor <address@hidden>
---
 Makefile  |   14 ++++++++++++++
 rules.mak |    4 ++++
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile
index a662d96..cb57c61 100644
--- a/Makefile
+++ b/Makefile
@@ -102,7 +102,14 @@ block-nested-$(CONFIG_WIN32) += raw-win32.o
 block-nested-$(CONFIG_POSIX) += raw-posix.o
 block-nested-$(CONFIG_CURL) += curl.o
 
+ifneq ($(CONFIG_SOLARIS),y)
 block-obj-y +=  $(addprefix block/, $(block-nested-y))
+else
+block-obj-y +=  $(addprefix block--, $(block-nested-y))
+
+block--%.o: block/%.o
+       $(call quiet-command,cp $< $@,"  CP    $(TARGET_DIR)$@")
+endif
 
 net-obj-y = net.o
 net-nested-y = queue.o checksum.o util.o
@@ -116,7 +123,14 @@ net-nested-$(CONFIG_SOLARIS) += tap-solaris.o
 net-nested-$(CONFIG_AIX) += tap-aix.o
 net-nested-$(CONFIG_SLIRP) += slirp.o
 net-nested-$(CONFIG_VDE) += vde.o
+ifneq ($(CONFIG_SOLARIS),y)
 net-obj-y += $(addprefix net/, $(net-nested-y))
+else
+net-obj-y += $(addprefix net--, $(net-nested-y))
+
+net--%.o: net/%.o
+       $(call quiet-command,cp $< $@,"  CP    $(TARGET_DIR)$@")
+endif
 
 ######################################################################
 # libqemu_common.a: Target independent part of system emulation. The
diff --git a/rules.mak b/rules.mak
index 5d9f684..d0e3a2d 100644
--- a/rules.mak
+++ b/rules.mak
@@ -23,7 +23,11 @@ QEMU_DGFLAGS += -MMD -MP -MT $@
 %.o: %.m
        $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c 
-o $@ $<,"  OBJC  $(TARGET_DIR)$@")
 
+ifeq ($(CONFIG_SOLARIS),y)
+LINK = $(call quiet-command,{ rm -rf .tmpobjs;mkdir .tmpobjs$(foreach 
arlib,$(ARLIBS),;(mkdir .tmpobjs/$(notdir $(arlib));cd .tmpobjs/$(notdir 
$(arlib)) && ar x ../../$(arlib)));$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o 
$@ $(1) $(foreach arlib,$(ARLIBS),$(foreach obj,$(shell $(AR) t 
$(arlib)),.tmpobjs/$(notdir $(arlib))/$(obj))) $(LIBS);},"  LINK  
$(TARGET_DIR)$@")
+else
 LINK = $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ 
$(1) $(ARLIBS_BEGIN) $(ARLIBS) $(ARLIBS_END) $(LIBS),"  LINK  $(TARGET_DIR)$@")
+endif
 
 %$(EXESUF): %.o
        $(call LINK,$^)
-- 
1.6.5.3





reply via email to

[Prev in Thread] Current Thread [Next in Thread]