[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC] Avoiding --whole-archive
From: |
Avi Kivity |
Subject: |
Re: [Qemu-devel] [RFC] Avoiding --whole-archive |
Date: |
Sun, 14 Jun 2009 12:15:54 +0300 |
User-agent: |
Thunderbird 2.0.0.21 (X11/20090320) |
Andreas Färber wrote:
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?
Way too clever, IMO. The danger here is that people will fear to edit
the makefiles after this.
Better ideas?
Maybe a little bit better:
+libqemu_common.a-OBJS:
+ @for o in $(OBJS); do echo ../$$o; done
+
libqemu_common.objlist: $(OBJS)
echo $(sort $(foreach obj, $^, $(shell readlink -f $(obj)))) > $@
$(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)))
Here, depend on libqemu_common.objlist, and link it by including its
contents in the link command line.
Oh, we could even make .objlist a linker script, except that's probably
platform specific.
The real fix is building everything from a single makefile.
--
error compiling committee.c: too many arguments to function