qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [RFC] Avoiding --whole-archive (was: [COMMIT 5efa9d5] Conve


From: Andreas Färber
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


Am 13.06.2009 um 22:40 schrieb Andreas Färber:

Am 31.05.2009 um 15:29 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.
[...]
your assumption was actually right.
[...]
it seems linking object files works while linking static libraries does not.

Architecturally the problem appears to be that the set of objects to link is determined in Makefile and Makefile.hw but is unknown to Makefile.target, where the problematic linking happens. As a workaround, I've written the respective set of $(OBJS) to a file when linking and appending them to the LINK command. Except for two warnings (../aio.h and ../cache-utils.o linked twice) this works fine and makes BeOS boot up again.

I came up with another workaround myself, that is using Makefile pseudotargets plus some Makefile magic to fetch the contents of $ (OBJS) from Makefile.target. I then misuse the $(sort ) function to 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 += $(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


Attachment: wholearchive-workaround2.diff
Description: Binary data



reply via email to

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