From: Avi Kivity <avi@redhat.com>
To: "Andreas Färber" <andreas.faerber@web.de>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [RFC] Avoiding --whole-archive
Date: Sun, 14 Jun 2009 12:15:54 +0300 [thread overview]
Message-ID: <4A34BFCA.9040403@redhat.com> (raw)
In-Reply-To: <9E275697-0576-4CD3-AEB2-68734B720FA3@web.de>
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
next prev parent reply other threads:[~2009-06-14 9:16 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 ` Avi Kivity [this message]
2009-11-29 14:17 ` [Qemu-devel] [RFC] Avoiding --whole-archive Andreas Färber
2009-11-29 18:53 ` Andreas Färber
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=4A34BFCA.9040403@redhat.com \
--to=avi@redhat.com \
--cc=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.