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.objs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Makefile.objs') diff --git a/Makefile.objs b/Makefile.objs index dc1e699914..3c7abca433 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -1,3 +1,7 @@ +####################################################################### +# Stub library, linked in tools +stub-obj-y = stubs/ + ####################################################################### # Target-independent parts used in system and user emulation universal-obj-y = @@ -239,6 +243,7 @@ vl.o: QEMU_CFLAGS+=$(SDL_CFLAGS) QEMU_CFLAGS+=$(GLIB_CFLAGS) nested-vars += \ + stub-obj-y \ qga-obj-y \ qom-obj-y \ qapi-obj-y \ -- cgit v1.2.1