From: Akihiko Odaki <akihiko.odaki@daynix.com>
To: "Michael Tokarev" <mjt@tls.msk.ru>,
"Laurent Vivier" <laurent@vivier.eu>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
"Beraldo Leal" <bleal@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Laurent Vivier" <lvivier@redhat.com>
Cc: qemu-devel@nongnu.org, Akihiko Odaki <akihiko.odaki@daynix.com>
Subject: [PATCH RFC 1/2] meson: Pass objects to declare_dependency()
Date: Fri, 24 May 2024 17:00:22 +0900 [thread overview]
Message-ID: <20240524-objects-v1-1-07cbbe96166b@daynix.com> (raw)
In-Reply-To: <20240524-objects-v1-0-07cbbe96166b@daynix.com>
We used to request declare_dependency() to link_whole static libraries.
If a static library is a thin archive, GNU ld needs to open all object
files referenced by the archieve, and sometimes reaches to the open
file limit.
Another problem with link_whole is that it does not propagate
dependencies. In particular, gnutls, a dependency of crypto, is not
propagated to its users, and we currently workaround the issue by
declaring gnutls as a dependency for each crypto user.
Instead of using link_whole, extract objects included in static
libraries and pass them to declare_dependency(). This requires Meson
1.1.0 or later.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
docs/devel/build-system.rst | 2 +-
meson.build | 27 ++++++++++++++-------------
gdbstub/meson.build | 4 ++--
subprojects/libvhost-user/meson.build | 2 +-
tests/qtest/libqos/meson.build | 2 +-
5 files changed, 19 insertions(+), 18 deletions(-)
diff --git a/docs/devel/build-system.rst b/docs/devel/build-system.rst
index 5baf027b7614..36ad40c76d2a 100644
--- a/docs/devel/build-system.rst
+++ b/docs/devel/build-system.rst
@@ -238,7 +238,7 @@ Subsystem sourcesets:
libchardev = static_library('chardev', chardev_ss.sources(),
build_by_default: false)
- chardev = declare_dependency(link_whole: libchardev)
+ chardev = declare_dependency(objects: libchardev.extract_all_objects(recursive: false))
Target-independent emulator sourcesets:
Various general purpose helper code is compiled only once and
diff --git a/meson.build b/meson.build
index d6549722b50d..0e6fa2e4b777 100644
--- a/meson.build
+++ b/meson.build
@@ -1,4 +1,4 @@
-project('qemu', ['c'], meson_version: '>=0.63.0',
+project('qemu', ['c'], meson_version: '>=1.1.0',
default_options: ['warning_level=1', 'c_std=gnu11', 'cpp_std=gnu++11', 'b_colorout=auto',
'b_staticpic=false', 'stdsplit=false', 'optimization=2', 'b_pie=true'],
version: files('VERSION'))
@@ -3456,20 +3456,20 @@ subdir('gdbstub')
if enable_modules
libmodulecommon = static_library('module-common', files('module-common.c') + genh, pic: true, c_args: '-DBUILD_DSO')
- modulecommon = declare_dependency(link_whole: libmodulecommon, compile_args: '-DBUILD_DSO')
+ modulecommon = declare_dependency(objects: libmodulecommon.extract_all_objects(recursive: false), compile_args: '-DBUILD_DSO')
endif
qom_ss = qom_ss.apply({})
libqom = static_library('qom', qom_ss.sources() + genh,
dependencies: [qom_ss.dependencies()],
build_by_default: false)
-qom = declare_dependency(link_whole: libqom)
+qom = declare_dependency(objects: libqom.extract_all_objects(recursive: false))
event_loop_base = files('event-loop-base.c')
event_loop_base = static_library('event-loop-base',
sources: event_loop_base + genh,
build_by_default: false)
-event_loop_base = declare_dependency(link_whole: event_loop_base,
+event_loop_base = declare_dependency(objects: event_loop_base.extract_all_objects(recursive: false),
dependencies: [qom])
stub_ss = stub_ss.apply({})
@@ -3703,7 +3703,7 @@ libauthz = static_library('authz', authz_ss.sources() + genh,
dependencies: [authz_ss.dependencies()],
build_by_default: false)
-authz = declare_dependency(link_whole: libauthz,
+authz = declare_dependency(objects: libauthz.extract_all_objects(recursive: false),
dependencies: qom)
crypto_ss = crypto_ss.apply({})
@@ -3711,7 +3711,7 @@ libcrypto = static_library('crypto', crypto_ss.sources() + genh,
dependencies: [crypto_ss.dependencies()],
build_by_default: false)
-crypto = declare_dependency(link_whole: libcrypto,
+crypto = declare_dependency(objects: libcrypto.extract_all_objects(recursive: false),
dependencies: [authz, qom])
io_ss = io_ss.apply({})
@@ -3720,7 +3720,8 @@ libio = static_library('io', io_ss.sources() + genh,
link_with: libqemuutil,
build_by_default: false)
-io = declare_dependency(link_whole: libio, dependencies: [crypto, qom])
+io = declare_dependency(objects: libio.extract_all_objects(recursive: false),
+ dependencies: [crypto, qom])
libmigration = static_library('migration', sources: migration_files + genh,
build_by_default: false)
@@ -3734,7 +3735,7 @@ libblock = static_library('block', block_ss.sources() + genh,
link_depends: block_syms,
build_by_default: false)
-block = declare_dependency(link_whole: [libblock],
+block = declare_dependency(objects: libblock.extract_all_objects(recursive: false),
link_args: '@block.syms',
dependencies: [crypto, io])
@@ -3743,7 +3744,7 @@ libblockdev = static_library('blockdev', blockdev_ss.sources() + genh,
dependencies: blockdev_ss.dependencies(),
build_by_default: false)
-blockdev = declare_dependency(link_whole: [libblockdev],
+blockdev = declare_dependency(objects: libblockdev.extract_all_objects(recursive: false),
dependencies: [block, event_loop_base])
qmp_ss = qmp_ss.apply({})
@@ -3751,18 +3752,18 @@ libqmp = static_library('qmp', qmp_ss.sources() + genh,
dependencies: qmp_ss.dependencies(),
build_by_default: false)
-qmp = declare_dependency(link_whole: [libqmp])
+qmp = declare_dependency(objects: libqmp.extract_all_objects(recursive: false))
libchardev = static_library('chardev', chardev_ss.sources() + genh,
dependencies: chardev_ss.dependencies(),
build_by_default: false)
-chardev = declare_dependency(link_whole: libchardev)
+chardev = declare_dependency(objects: libchardev.extract_all_objects(recursive: false))
hwcore_ss = hwcore_ss.apply({})
libhwcore = static_library('hwcore', sources: hwcore_ss.sources() + genh,
build_by_default: false)
-hwcore = declare_dependency(link_whole: libhwcore)
+hwcore = declare_dependency(objects: libhwcore.extract_all_objects(recursive: false))
common_ss.add(hwcore)
###########
@@ -3774,7 +3775,7 @@ foreach m : block_mods + system_mods
emulator_modules += shared_module(m.name(),
build_by_default: true,
name_prefix: '',
- link_whole: m,
+ objects: m.extract_all_objects(recursive: false),
install: true,
install_dir: qemu_moddir)
endforeach
diff --git a/gdbstub/meson.build b/gdbstub/meson.build
index c91e398ae726..dff741ddd4d7 100644
--- a/gdbstub/meson.build
+++ b/gdbstub/meson.build
@@ -26,9 +26,9 @@ libgdb_system = static_library('gdb_system',
gdb_system_ss.sources() + genh,
build_by_default: false)
-gdb_user = declare_dependency(link_whole: libgdb_user)
+gdb_user = declare_dependency(objects: libgdb_user.extract_all_objects(recursive: false))
user_ss.add(gdb_user)
-gdb_system = declare_dependency(link_whole: libgdb_system)
+gdb_system = declare_dependency(objects: libgdb_system.extract_all_objects(recursive: false))
system_ss.add(gdb_system)
common_ss.add(files('syscalls.c'))
diff --git a/subprojects/libvhost-user/meson.build b/subprojects/libvhost-user/meson.build
index a18014e7f26f..b3a2a3abf6be 100644
--- a/subprojects/libvhost-user/meson.build
+++ b/subprojects/libvhost-user/meson.build
@@ -17,7 +17,7 @@ vhost_user = static_library('vhost-user',
c_args: '-D_GNU_SOURCE')
executable('link-test', files('link-test.c'),
- link_whole: vhost_user)
+ objects: vhost_user.extract_all_objects(recursive: false))
vhost_user_glib = static_library('vhost-user-glib',
files('libvhost-user-glib.c'),
diff --git a/tests/qtest/libqos/meson.build b/tests/qtest/libqos/meson.build
index 45b81c83ade3..5b18aa4eaeb9 100644
--- a/tests/qtest/libqos/meson.build
+++ b/tests/qtest/libqos/meson.build
@@ -70,4 +70,4 @@ endif
libqos = static_library('qos', libqos_srcs + genh,
build_by_default: false)
-qos = declare_dependency(link_whole: libqos)
+qos = declare_dependency(objects: libqos.extract_all_objects(recursive: false))
--
2.45.1
next prev parent reply other threads:[~2024-05-24 8:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-24 8:00 [PATCH RFC 0/2] meson: Pass objects to declare_dependency() Akihiko Odaki
2024-05-24 8:00 ` Akihiko Odaki [this message]
2024-05-27 10:05 ` [PATCH RFC 1/2] " Philippe Mathieu-Daudé
2024-05-24 8:00 ` [PATCH RFC 2/2] Revert "meson: Propagate gnutls dependency" Akihiko Odaki
2024-05-24 9:14 ` [PATCH RFC 0/2] meson: Pass objects to declare_dependency() Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240524-objects-v1-1-07cbbe96166b@daynix.com \
--to=akihiko.odaki@daynix.com \
--cc=alex.bennee@linaro.org \
--cc=berrange@redhat.com \
--cc=bleal@redhat.com \
--cc=laurent@vivier.eu \
--cc=lvivier@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=mjt@tls.msk.ru \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=thuth@redhat.com \
--cc=wainersm@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.