qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <andreas.faerber@web.de>
To: qemu-devel@nongnu.org
Cc: "Andreas Färber" <afaerber@opensolaris.org>,
	"Palle Lyckegaard" <palle@lyckegaard.dk>
Subject: [Qemu-devel] [PATCH 3/3] Workaround --whole-archive on Solaris
Date: Sat, 12 Dec 2009 20:10:57 +0100	[thread overview]
Message-ID: <1260645057-19819-4-git-send-email-andreas.faerber@web.de> (raw)
In-Reply-To: <1260645057-19819-3-git-send-email-andreas.faerber@web.de>

From: Andreas Färber <afaerber@opensolaris.org>

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 <afaerber@opensolaris.org>
Cc: Palle Lyckegaard <palle@lyckegaard.dk>
Cc: Ben Taylor <bentaylor.solx86@gmail.com>
---
 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	other threads:[~2009-12-12 19:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-12 19:10 [Qemu-devel] Build fixes for OpenSolaris x86 hosts Andreas Färber
2009-12-12 19:10 ` [Qemu-devel] [PATCH 1/3] tap: Compilation fix for Solaris Andreas Färber
2009-12-12 19:10   ` [Qemu-devel] [PATCH 2/3] Silence softfloat warnings on OpenSolaris Andreas Färber
2009-12-12 19:10     ` Andreas Färber [this message]
     [not found]       ` <m3fx7fzz8v.fsf@neno.neno>
2009-12-12 23:07         ` [Qemu-devel] Re: [PATCH 3/3] Workaround --whole-archive on Solaris Andreas Färber
2009-12-13  8:16           ` Andreas Färber
2009-12-13 10:21           ` Avi Kivity
2009-12-13  8:02         ` [Qemu-devel] [PATCH] Drop --whole-archive and static libraries Andreas Färber
2009-12-13 15:40           ` [Qemu-devel] [PATCH] Quickfix for libuser.a drop Andreas Färber
2009-12-13 15:55             ` Andreas Färber
2009-12-19 17:32           ` [Qemu-devel] [PATCH] Drop --whole-archive and static libraries Andreas Färber

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=1260645057-19819-4-git-send-email-andreas.faerber@web.de \
    --to=andreas.faerber@web.de \
    --cc=afaerber@opensolaris.org \
    --cc=palle@lyckegaard.dk \
    --cc=qemu-devel@nongnu.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 NNTP newsgroup(s).