From 3bc2f570ec9fc930619a8ef26a22dd6d03c25dac Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Fri, 16 Nov 2012 18:35:27 +0100 Subject: build: replace weak symbols with a static library Weak symbols were a nice idea, but they turned out not to be a good one. Toolchain support is just too sparse, in particular llvm-gcc is totally broken. This patch uses a surprisingly low-tech approach: a static library. 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). Thus, all stubs are placed in separate object files and put together in a static library. The library then is linked to all programs. Signed-off-by: Paolo Bonzini Tested-by: Peter Maydell Reviewed-by: Peter Maydell Tested-by: Stefan Weil Signed-off-by: Blue Swirl --- Makefile.target | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Makefile.target') diff --git a/Makefile.target b/Makefile.target index 3822bc5ac3..8b658c0d13 100644 --- a/Makefile.target +++ b/Makefile.target @@ -162,12 +162,12 @@ endif #CONFIG_LINUX_USER ifdef QEMU_PROGW # The linker builds a windows executable. Make also a console executable. -$(QEMU_PROGW): $(all-obj-y) +$(QEMU_PROGW): $(all-obj-y) ../libqemustub.a $(call LINK,$^) $(QEMU_PROG): $(QEMU_PROGW) $(call quiet-command,$(OBJCOPY) --subsystem console $(QEMU_PROGW) $(QEMU_PROG)," GEN $(TARGET_DIR)$(QEMU_PROG)") else -$(QEMU_PROG): $(all-obj-y) +$(QEMU_PROG): $(all-obj-y) ../libqemustub.a $(call LINK,$^) endif -- cgit v1.2.1