Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MFbVw-000141-NM for qemu-devel@nongnu.org; Sat, 13 Jun 2009 18:15:52 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MFbVs-0000uA-Qv for qemu-devel@nongnu.org; Sat, 13 Jun 2009 18:15:52 -0400 Received: from [199.232.76.173] (port=53048 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MFbVs-0000tn-M5 for qemu-devel@nongnu.org; Sat, 13 Jun 2009 18:15:48 -0400 Received: from fmmailgate03.web.de ([217.72.192.234]:33781) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MFbVs-00059X-3h for qemu-devel@nongnu.org; Sat, 13 Jun 2009 18:15:48 -0400 Message-Id: <9E275697-0576-4CD3-AEB2-68734B720FA3@web.de> From: =?ISO-8859-1?Q?Andreas_F=E4rber?= In-Reply-To: <03B6CD6A-6CD3-4D60-97BE-8CFABA82F835@web.de> Content-Type: multipart/mixed; boundary=Apple-Mail-45-336146852 Mime-Version: 1.0 (Apple Message framework v935.3) Subject: [Qemu-devel] [RFC] Avoiding --whole-archive (was: [COMMIT 5efa9d5] Convert block infrastructure to use new module init functionality) Date: Sun, 14 Jun 2009 00:15:19 +0200 References: <616D744F-F31E-4E96-9A23-1664C78313FD@web.de> <64FD5BFF-581C-4202-97EA-48BC96A2211C@web.de> <4A2258D7.5020002@codemonkey.ws> <03B6CD6A-6CD3-4D60-97BE-8CFABA82F835@web.de> Sender: andreas.faerber@web.de List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori , QEMU Developers --Apple-Mail-45-336146852 Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable Am 13.06.2009 um 22:40 schrieb Andreas F=E4rber: > Am 31.05.2009 um 15:29 schrieb Andreas F=E4rber: > >> Am 31.05.2009 um 12:15 schrieb Anthony Liguori: >> >>>>> Starting with this commit, qemu-system-sparc segfaults =20 >>>>> immediately; >>>>> you later fixed it in c833ab7351f2ebac46740380a81e34482e208dcc =20 >>>>> (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 =20= >>> do on >>> OpenSolaris. [...] > your assumption was actually right. [...] > it seems linking object files works while linking static libraries =20 > does not. > > Architecturally the problem appears to be that the set of objects to =20= > link is determined in Makefile and Makefile.hw but is unknown to =20 > Makefile.target, where the problematic linking happens. > As a workaround, I've written the respective set of $(OBJS) to a =20 > file when linking and appending them to the LINK command. Except for =20= > two warnings (../aio.h and ../cache-utils.o linked twice) this works =20= > fine and makes BeOS boot up again. I came up with another workaround myself, that is using Makefile =20 pseudotargets plus some Makefile magic to fetch the contents of $=20 (OBJS) from Makefile.target. I then misuse the $(sort ) function to =20 eliminate duplicates and thus linker warnings. Linux/sparc and BeOS/i386 still boot okay despite the reordering. Comments? Better ideas? Andreas diff --git a/Makefile b/Makefile index 3177616..0e7359c 100644 --- a/Makefile +++ b/Makefile @@ -230,6 +230,9 @@ bt-host.o: CFLAGS +=3D $(CONFIG_BLUEZ_CFLAGS) libqemu_common.a: $(OBJS) +libqemu_common.a-OBJS: + @for o in $(OBJS); do echo ../$$o; done + =20 ####################################################################### # USER_OBJS is code used by qemu userspace emulation USER_OBJS=3Dcutils.o cache-utils.o diff --git a/Makefile.hw b/Makefile.hw index 6accb3b..a3ba6f7 100644 --- a/Makefile.hw +++ b/Makefile.hw @@ -34,6 +34,9 @@ all: $(HWLIB) $(HWLIB): $(OBJS) +$(HWLIB)-OBJS: + @for o in $(OBJS); do echo ../$(notdir $(abspath .))/$$o; done + clean: rm -f *.o *.d *.a *~ diff --git a/Makefile.target b/Makefile.target index 27de4b9..71b6133 100644 --- a/Makefile.target +++ b/Makefile.target @@ -735,9 +735,9 @@ vl.o: qemu-options.h monitor.o: qemu-monitor.h $(QEMU_PROG): LIBS +=3D $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $=20 (BRLAPI_LIBS) $(VDE_LIBS) $(CURL_LIBS) -$(QEMU_PROG): ARLIBS=3D../libqemu_common.a libqemu.a $(HWLIB) +$(QEMU_PROG): ARLIBS=3Dlibqemu.a $(QEMU_PROG): $(OBJS) ../libqemu_common.a libqemu.a $(HWLIB) - $(call LINK,$(OBJS)) + $(call LINK,$(sort $(OBJS) $(shell $(MAKE) -C .. --no-print-=20 directory libqemu_common.a-OBJS) $(shell $(MAKE) -C $(dir $(HWLIB)) --=20= no-print-directory $(notdir $(HWLIB))-OBJS))) endif # !CONFIG_USER_ONLY --Apple-Mail-45-336146852 Content-Disposition: attachment; filename=wholearchive-workaround2.diff Content-Type: application/octet-stream; x-unix-mode=0644; name="wholearchive-workaround2.diff" Content-Transfer-Encoding: 7bit diff --git a/Makefile b/Makefile index 3177616..0e7359c 100644 --- a/Makefile +++ b/Makefile @@ -230,6 +230,9 @@ bt-host.o: CFLAGS += $(CONFIG_BLUEZ_CFLAGS) libqemu_common.a: $(OBJS) +libqemu_common.a-OBJS: + @for o in $(OBJS); do echo ../$$o; done + ####################################################################### # USER_OBJS is code used by qemu userspace emulation USER_OBJS=cutils.o cache-utils.o diff --git a/Makefile.hw b/Makefile.hw index 6accb3b..a3ba6f7 100644 --- a/Makefile.hw +++ b/Makefile.hw @@ -34,6 +34,9 @@ all: $(HWLIB) $(HWLIB): $(OBJS) +$(HWLIB)-OBJS: + @for o in $(OBJS); do echo ../$(notdir $(abspath .))/$$o; done + clean: rm -f *.o *.d *.a *~ diff --git a/Makefile.target b/Makefile.target index 27de4b9..71b6133 100644 --- a/Makefile.target +++ b/Makefile.target @@ -735,9 +735,9 @@ vl.o: qemu-options.h monitor.o: qemu-monitor.h $(QEMU_PROG): LIBS += $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS) $(CURL_LIBS) -$(QEMU_PROG): ARLIBS=../libqemu_common.a libqemu.a $(HWLIB) +$(QEMU_PROG): ARLIBS=libqemu.a $(QEMU_PROG): $(OBJS) ../libqemu_common.a libqemu.a $(HWLIB) - $(call LINK,$(OBJS)) + $(call LINK,$(sort $(OBJS) $(shell $(MAKE) -C .. --no-print-directory libqemu_common.a-OBJS) $(shell $(MAKE) -C $(dir $(HWLIB)) --no-print-directory $(notdir $(HWLIB))-OBJS))) endif # !CONFIG_USER_ONLY --Apple-Mail-45-336146852 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit --Apple-Mail-45-336146852--