[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 033/132] build-sys hack: link with whole .fa archives
From: |
Paolo Bonzini |
Subject: |
[PATCH 033/132] build-sys hack: link with whole .fa archives |
Date: |
Thu, 12 Dec 2019 13:51:17 +0100 |
From: Marc-André Lureau <address@hidden>
In order to link the *-obj-y files into tests, we will make static
libraries of them in Meson, and then link them as whole archives
into the tests. To separate regular static libraries from link-whole
libraries, give them a different file extension.
Signed-off-by: Marc-André Lureau <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
rules.mak | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/rules.mak b/rules.mak
index 5289184..a10a972 100644
--- a/rules.mak
+++ b/rules.mak
@@ -39,6 +39,13 @@ find-symbols = $(if $1, $(sort $(shell $(NM) -P -g $1 | $2)))
defined-symbols = $(call find-symbols,$1,awk '$$2!="U"{print $$1}')
undefined-symbols = $(call find-symbols,$1,awk '$$2=="U"{print $$1}')
+WL := -Wl,
+ifdef CONFIG_DARWIN
+whole-archive = $(WL)-force_load,$1
+else
+whole-archive = $(WL)--whole-archive $1 $(WL)--no-whole-archive
+endif
+
# All the .mo objects in -m variables are also added into corresponding -y
# variable in unnest-vars, but filtered out here, when LINK is called.
#
@@ -54,11 +61,12 @@ undefined-symbols = $(call find-symbols,$1,awk
'$$2=="U"{print $$1}')
# This is necessary because the exectuable itself may not use the function, in
# which case the function would not be linked in. Then the DSO loading will
# fail because of the missing symbol.
-process-archive-undefs = $(filter-out %.a %.mo,$1) \
+process-archive-undefs = $(filter-out %.a %.fa %.mo,$1) \
$(addprefix $(WL_U), \
- $(filter $(call defined-symbols,$(filter %.a, $1)), \
+ $(filter $(call defined-symbols,$(filter %.a %.fa, $1)), \
$(call undefined-symbols,$(filter %.mo,$1)))) \
- $(filter %.a,$1)
+ $(foreach l,$(filter %.fa,$1),$(call whole-archive,$l)) \
+ $(filter %.a,$1)
extract-libs = $(strip $(foreach o,$(filter-out %.mo,$1),$($o-libs)))
expand-objs = $(strip $(sort $(filter %.o,$1)) \
@@ -122,7 +130,7 @@ LD_REL := $(CC) -nostdlib $(LD_REL_FLAGS)
modules:
%$(EXESUF): %.o
- $(call LINK,$(filter %.o %.a %.mo, $^))
+ $(call LINK,$(filter %.o %.a %.mo %.fa, $^))
%.a:
$(call quiet-command,rm -f $@ && $(AR) rcs $@ $^,"AR","$(TARGET_DIR)$@")
@@ -378,7 +386,7 @@ define unnest-vars
$(error $o added in $v but $o-objs is not set)))
$(shell mkdir -p ./ $(sort $(dir $($v))))
# Include all the .d files
- $(eval -include $(patsubst %.o,%.d,$(patsubst %.mo,%.d,$($v))))
+ $(eval -include $(patsubst %.o,%.d,$(patsubst %.mo,%.d,$(filter
%.o,$($v)))))
$(eval $v := $(filter-out %/,$($v))))
endef
--
1.8.3.1
- [PATCH 024/132] meson: add qemu-keymap, (continued)
- [PATCH 024/132] meson: add qemu-keymap, Paolo Bonzini, 2019/12/12
- [PATCH 025/132] meson: add qemu-edid, Paolo Bonzini, 2019/12/12
- [PATCH 009/132] libqemuutil: convert to meson, Paolo Bonzini, 2019/12/12
- [PATCH 027/132] meson: keymap-gen, Paolo Bonzini, 2019/12/12
- [PATCH 029/132] meson: generate shader headers, Paolo Bonzini, 2019/12/12
- [PATCH 026/132] meson: add virtfs-proxy-helper, Paolo Bonzini, 2019/12/12
- [PATCH 028/132] meson: generate qemu-version.h, Paolo Bonzini, 2019/12/12
- [PATCH 030/132] meson: generate hxtool files, Paolo Bonzini, 2019/12/12
- [PATCH 031/132] meson: configure 50-qemu-gpu.json, Paolo Bonzini, 2019/12/12
- [PATCH 032/132] meson: uncompress edk2 bios, Paolo Bonzini, 2019/12/12
- [PATCH 033/132] build-sys hack: link with whole .fa archives,
Paolo Bonzini <=
- [PATCH 035/132] meson: convert authz directory to Meson, Paolo Bonzini, 2019/12/12
- [PATCH 034/132] meson: convert qom directory to Meson, Paolo Bonzini, 2019/12/12
- [PATCH 036/132] meson: convert crypto directory to Meson, Paolo Bonzini, 2019/12/12
- [PATCH 037/132] meson: convert io directory to Meson, Paolo Bonzini, 2019/12/12
- [PATCH 039/132] meson: add macos dependencies, Paolo Bonzini, 2019/12/12
- [PATCH 038/132] meson: infrastructure for building emulators, Paolo Bonzini, 2019/12/12
- [PATCH 041/132] meson: convert chardev directory to Meson (tools part), Paolo Bonzini, 2019/12/12
- [PATCH 043/132] meson: qemu-{img,io,nbd}, Paolo Bonzini, 2019/12/12
- [PATCH 042/132] meson: convert block, Paolo Bonzini, 2019/12/12
- [PATCH 044/132] meson: qemu-pr-helper, Paolo Bonzini, 2019/12/12