mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 14:53:54 -06:00
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 <pbonzini@redhat.com> Tested-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Tested-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
This commit is contained in:
parent
2c5c4451e6
commit
3bc2f570ec
18 changed files with 89 additions and 89 deletions
11
compiler.h
11
compiler.h
|
@ -50,20 +50,9 @@
|
|||
# define __printf__ __gnu_printf__
|
||||
# endif
|
||||
# endif
|
||||
# if defined(__APPLE__)
|
||||
# define QEMU_WEAK_ALIAS(newname, oldname) \
|
||||
static typeof(oldname) weak_##newname __attribute__((unused, weakref(#oldname)))
|
||||
# define QEMU_WEAK_REF(newname, oldname) (weak_##newname ? weak_##newname : oldname)
|
||||
# else
|
||||
# define QEMU_WEAK_ALIAS(newname, oldname) \
|
||||
typeof(oldname) newname __attribute__((weak, alias (#oldname)))
|
||||
# define QEMU_WEAK_REF(newname, oldname) newname
|
||||
# endif
|
||||
#else
|
||||
#define GCC_ATTR /**/
|
||||
#define GCC_FMT_ATTR(n, m)
|
||||
#define QEMU_WEAK_ALIAS(newname, oldname) \
|
||||
_Pragma("weak " #newname "=" #oldname)
|
||||
#endif
|
||||
|
||||
#endif /* COMPILER_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue