Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MFa2K-0002iB-U4 for qemu-devel@nongnu.org; Sat, 13 Jun 2009 16:41:12 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MFa2G-0002gn-Uk for qemu-devel@nongnu.org; Sat, 13 Jun 2009 16:41:12 -0400 Received: from [199.232.76.173] (port=38985 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MFa2G-0002gU-Jo for qemu-devel@nongnu.org; Sat, 13 Jun 2009 16:41:08 -0400 Received: from fmmailgate01.web.de ([217.72.192.221]:53926) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MFa2G-0008D5-00 for qemu-devel@nongnu.org; Sat, 13 Jun 2009 16:41:08 -0400 Message-Id: <03B6CD6A-6CD3-4D60-97BE-8CFABA82F835@web.de> From: =?ISO-8859-1?Q?Andreas_F=E4rber?= In-Reply-To: Content-Type: multipart/mixed; boundary=Apple-Mail-39-330473140 Mime-Version: 1.0 (Apple Message framework v935.3) Subject: Re: [Qemu-devel] [COMMIT 5efa9d5] Convert block infrastructure to use new module init functionality Date: Sat, 13 Jun 2009 22:40:45 +0200 References: <616D744F-F31E-4E96-9A23-1664C78313FD@web.de> <64FD5BFF-581C-4202-97EA-48BC96A2211C@web.de> <4A2258D7.5020002@codemonkey.ws> Sender: andreas.faerber@web.de List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: QEMU Developers --Apple-Mail-39-330473140 Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable 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 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 =20 >> do on >> OpenSolaris. > > It's actually using -Wl,--whole-archive (GNU ld version 2.15 on =20 > OpenSolaris 2009.06 snv_111b). Sorry, your assumption was actually right. The above version string is from `ld` (/usr/gnu/bin/ld), but gcc is =20 configured to use /usr/ccs/bin/ld instead, the usual suspect. Sun documents it to support both --whole-archive and -z allextract, =20 which explains the detection and use of --Wl,--whole-archive. Reordering the checks, so that -Wl,-z,allextract is preferred, does =20 not help. > `qemu-img` correctly lists all the formats, which I thought was a =20 > test case for the linker option. `qemu -drive format=3D?` appears to better mirror the actual block =20 format support. Trying to use `ld` directly for the LINK rule didn't work due to =20 architectural mismatches - it kept the output format as i386 despite =20 any -A or -b elf64-x86-64 flags I set (-m64 didn't seem to be valid). If I manually link ../block/raw-posix.o into i386-softmmu's $=20 (QEMU_PROG), then instead of the original error message I get "qemu: =20 hardware error: Unknown device 'smbus-eeprom'" followed by a segfault. =20= I assume this is due to libqemuhw64.a. With upstream qemu, the Supported formats list is empty, with ../block/=20= raw-posix.o linked in, it reads "host_device raw". So 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 file =20= when linking and appending them to the LINK command. Except for two =20 warnings (../aio.h and ../cache-utils.o linked twice) this works fine =20= and makes BeOS boot up again. Most likely someone will have a more efficient idea how to get the =20 list of objects to Makefile.target and how to make the list unique to =20= avoid warnings. Andreas diff --git a/Makefile b/Makefile index 3177616..8fca061 100644 --- a/Makefile +++ b/Makefile @@ -229,6 +229,8 @@ curses.o: curses.c keymaps.h curses_keys.h bt-host.o: CFLAGS +=3D $(CONFIG_BLUEZ_CFLAGS) libqemu_common.a: $(OBJS) + rm libqemu_common.mak + for o in $(OBJS); do echo ../$$o >> libqemu_common.mak; done =20 ####################################################################### # USER_OBJS is code used by qemu userspace emulation diff --git a/Makefile.hw b/Makefile.hw index 6accb3b..9555a86 100644 --- a/Makefile.hw +++ b/Makefile.hw @@ -33,6 +33,8 @@ all: $(HWLIB) @true $(HWLIB): $(OBJS) + -rm -f $(HWLIB).list + for o in $(OBJS); do echo ../libhw64/$$o >> $(HWLIB).list; done clean: rm -f *.o *.d *.a *~ diff --git a/Makefile.target b/Makefile.target index 27de4b9..8b86b62 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,$(OBJS) `cat ../libqemu_common.mak` `cat = $(HWLIB).list`) endif # !CONFIG_USER_ONLY --Apple-Mail-39-330473140 Content-Disposition: attachment; filename=wholearchive-workaround.diff Content-Type: application/octet-stream; x-unix-mode=0644; name="wholearchive-workaround.diff" Content-Transfer-Encoding: 7bit diff --git a/Makefile b/Makefile index 3177616..8fca061 100644 --- a/Makefile +++ b/Makefile @@ -229,6 +229,8 @@ curses.o: curses.c keymaps.h curses_keys.h bt-host.o: CFLAGS += $(CONFIG_BLUEZ_CFLAGS) libqemu_common.a: $(OBJS) + rm libqemu_common.mak + for o in $(OBJS); do echo ../$$o >> libqemu_common.mak; done ####################################################################### # USER_OBJS is code used by qemu userspace emulation diff --git a/Makefile.hw b/Makefile.hw index 6accb3b..9555a86 100644 --- a/Makefile.hw +++ b/Makefile.hw @@ -33,6 +33,8 @@ all: $(HWLIB) @true $(HWLIB): $(OBJS) + -rm -f $(HWLIB).list + for o in $(OBJS); do echo ../libhw64/$$o >> $(HWLIB).list; done clean: rm -f *.o *.d *.a *~ diff --git a/Makefile.target b/Makefile.target index 27de4b9..8b86b62 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,$(OBJS) `cat ../libqemu_common.mak` `cat $(HWLIB).list`) endif # !CONFIG_USER_ONLY --Apple-Mail-39-330473140 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit --Apple-Mail-39-330473140--