All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Andreas Färber" <andreas.faerber@web.de>
To: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [RFC] Avoiding --whole-archive
Date: Sun, 29 Nov 2009 19:53:07 +0100	[thread overview]
Message-ID: <3CD8BD2D-67A4-4C30-B835-059565B2E24C@web.de> (raw)
In-Reply-To: <31D358FF-E8DB-43E2-967A-1A27C17E482A@web.de>

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


Am 29.11.2009 um 15:17 schrieb Andreas Färber:

> Am 14.06.2009 um 00:15 schrieb Andreas Färber:
>
>>>> Am 31.05.2009 um 12:15 schrieb Anthony Liguori:
>>>>
>>>>>>> Starting with this commit, qemu-system-sparc segfaults  
>>>>>>> immediately;
>>>>>>> you later fixed it in c833ab7351f2ebac46740380a81e34482e208dcc  
>>>>>>> (Fix
>>>>>>> segv when passing an unknown protocol) to no longer segfault,  
>>>>>>> now
>>>>>>> printing "qemu: could not read disk image /path/to/image".
>>>>>
>>>>> I would assume -z,allextract isn't doing what we would like it  
>>>>> to do on
>>>>> OpenSolaris.
>
> This problem is still around after Juan's Makefile reorganizations.
>
> Before, I had provided two alternative patches:
>
> * The first version wrote the list of libqemu_common.a's and $ 
> (HWLIB)'s object files into a text file from Makefile[.hw] that was  
> later read in Makefile.target.
>
> * The second version was using dedicated Makefile[.hw] targets for  
> printing the object files to stdout for use by Makefile.target,  
> avoiding the need to write an intermediate file.
>
> Avi had preferred a variation of the first version for reduced  
> complexity.
>
> Other ideas that crossed my mind were:
> * using GNU ld directly instead of gcc for linking (broken by -Wl  
> and some other LDFLAGS)
> * extracting the .a archive to a temporary directory from the target  
> Makefile and obtaining the names by `ls *.o` (similar to libtool)

The attached patches showcase the latter. $(ARLIBS) are extracted  
to .tmpobjs/<libname>/ and their *.o objects are linked individually.  
Filtering to *.o was necessary because on OSX archives contain non-.o  
files that otherwise break compilation.
The extraction showed that libqemu_common.a contains two nbd.o files,  
one from ./nbd.c and one from ./block/nbd.c. The second patch thus  
renames block/nbd.o to distinguish the two and to avoid linker errors.  
A more permanent solution would be to rename the nbd.c file.
With those two patches once again QEMU works on both OpenSolaris and  
Mac OS X, for in-tree and out-of-tree builds.

Andreas

[-- Attachment #2: arlibs-extract.diff --]
[-- Type: application/octet-stream, Size: 1194 bytes --]

diff --git a/rules.mak b/rules.mak
index 59cb185..6bbd292 100644
--- a/rules.mak
+++ b/rules.mak
@@ -23,7 +23,7 @@ QEMU_CFLAGS += -MMD -MP -MT $@
 	$(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) -c -o $@ $<,"  OBJC  $(TARGET_DIR)$@")
 
 #LINK = $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $(1) $(ARLIBS_BEGIN) $(ARLIBS) $(ARLIBS_END) $(LIBS),"  LINK  $(TARGET_DIR)$@")
-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)$@")
+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,$(filter %.o,$(shell $(AR) t $(arlib))),.tmpobjs/$(notdir $(arlib))/$(obj))) $(LIBS);},"  LINK  $(TARGET_DIR)$@")
 
 %$(EXESUF): %.o
 	$(call LINK,$^)

[-- Attachment #3: arlibs-nbd.diff --]
[-- Type: application/octet-stream, Size: 746 bytes --]

diff --git a/Makefile b/Makefile
index 63a7128..69df44c 100644
--- a/Makefile
+++ b/Makefile
@@ -91,11 +91,14 @@ block-obj-$(CONFIG_LINUX_AIO) += linux-aio.o
 
 block-nested-y += cow.o qcow.o vdi.o vmdk.o cloop.o dmg.o bochs.o vpc.o vvfat.o
 block-nested-y += qcow2.o qcow2-refcount.o qcow2-cluster.o qcow2-snapshot.o
-block-nested-y += parallels.o nbd.o
+block-nested-y += parallels.o nbd--.o
 block-nested-$(CONFIG_WIN32) += raw-win32.o
 block-nested-$(CONFIG_POSIX) += raw-posix.o
 block-nested-$(CONFIG_CURL) += curl.o
 
+block/nbd--.o: block/nbd.c $(GENERATED_HEADERS)
+	$(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) -c -o $@ $<,"  CC    $(TARGET_DIR)$@")
+
 block-obj-y +=  $(addprefix block/, $(block-nested-y))
 
 net-obj-y = net.o

  reply	other threads:[~2009-11-29 18:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <616D744F-F31E-4E96-9A23-1664C78313FD@web.de>
2009-05-30 17:49 ` [Qemu-devel] Fwd: [Qemu-commits] [COMMIT 5efa9d5] Convert block infrastructure to use new module init functionality Andreas Färber
2009-05-31 10:15   ` Anthony Liguori
2009-05-31 11:26     ` Avi Kivity
2009-05-31 13:29     ` [Qemu-devel] " Andreas Färber
2009-06-13 20:40       ` Andreas Färber
2009-06-13 22:15         ` [Qemu-devel] [RFC] Avoiding --whole-archive (was: [COMMIT 5efa9d5] Convert block infrastructure to use new module init functionality) Andreas Färber
2009-06-14  9:15           ` [Qemu-devel] [RFC] Avoiding --whole-archive Avi Kivity
2009-11-29 14:17           ` Andreas Färber
2009-11-29 18:53             ` Andreas Färber [this message]
2009-11-30  9:00             ` Avi Kivity

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=3CD8BD2D-67A4-4C30-B835-059565B2E24C@web.de \
    --to=andreas.faerber@web.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.