On 16 November 2012 15:50, Paolo Bonzini <pbonz...@redhat.com> wrote: > Weak symbols were a nice idea, but they turned out not to be > a good one. Toolchain support is just too sparse. > > This patch uses a surprisingly low-tech approach, i.e. static > libraries. Symbols in a static library are always overridden > by symbols in an object file. Furthermore, if you place each > function in a separate source file, object files for unused > functions will not be taken in. This means that each function > can use all the dependencies that it needs (especially QAPI > stuff such as error_setg). > > All stubs are placed in separate object files and put together > in a static library. The library then is linked to all > programs.
I think this is definitely a better approach; thanks for taking the time to implement it. That said, this patch doesn't build on MacOS: manooth$ make V=1 make BUILD_DIR=/Users/pm215/src/qemu -C libdis V="1" TARGET_DIR="libdis/" all make BUILD_DIR=/Users/pm215/src/qemu -C arm-softmmu V="1" TARGET_DIR="arm-softmmu/" all rm -f libqemustub.a && ar rcs libqemustub.a ar: no archive members specified usage: ar -d [-TLsv] archive file ... ar -m [-TLsv] archive file ... ar -m [-abiTLsv] position archive file ... ar -p [-TLsv] archive [file ...] ar -q [-cTLsv] archive file ... ar -r [-cuTLsv] archive file ... ar -r [-abciuTLsv] position archive file ... ar -t [-TLsv] archive [file ...] ar -x [-ouTLsv] archive [file ...] make[1]: *** [libqemustub.a] Error 1 make: *** [subdir-arm-softmmu] Error 2 And it doesn't build on Linux: ccache gcc -Wl,--warn-common -Wl,-z,relro -Wl,-z,now -pie -m64 -g -o vscclient libcacard/cac.o libcacard/event.o libcacard/vcard.o libcacard/vreader.o libcacard/vcard_emul_nss.o libcacard/vcard_emul_type.o libcacard/card_7816.o osdep.o cutils.o qemu-timer-common.o oslib-posix.o qemu-thread-posix.o trace.o trace/default.o trace/control.o libcacard/vscclient.o -lnss3 -lnssutil3 -lsmime3 -lssl3 -lplds4 -lplc4 -lnspr4 -lpthread -ldl -pthread -lgthread-2.0 -lrt -lglib-2.0 -lrt -pthread -lgthread-2.0 -lrt -lglib-2.0 -lz -lrbd -lrados -lcurl -lvdeplug -luuid -laio osdep.o: In function `qemu_open': /home/petmay01/linaro/qemu-from-laptop/qemu/osdep.c:166: undefined reference to `monitor_fdset_get_fd' /home/petmay01/linaro/qemu-from-laptop/qemu/osdep.c:176: undefined reference to `monitor_fdset_dup_fd_add' osdep.o: In function `qemu_close': /home/petmay01/linaro/qemu-from-laptop/qemu/osdep.c:212: undefined reference to `monitor_fdset_dup_fd_find' /home/petmay01/linaro/qemu-from-laptop/qemu/osdep.c:218: undefined reference to `monitor_fdset_dup_fd_remove' collect2: ld returned 1 exit status make: *** [vscclient] Error 1 -- PMM