* [PATCH v2 0/7] single-binary: build target common libraries with dependencies
@ 2025-05-21 22:34 Pierrick Bouvier
2025-05-21 22:34 ` [PATCH v2 1/7] meson: build target libraries with common dependencies Pierrick Bouvier
` (8 more replies)
0 siblings, 9 replies; 14+ messages in thread
From: Pierrick Bouvier @ 2025-05-21 22:34 UTC (permalink / raw)
To: qemu-devel
Cc: Pierrick Bouvier, Philippe Mathieu-Daudé, Richard Henderson,
Peter Maydell, Paolo Bonzini, thuth, Alex Bennée,
Daniel P. Berrangé
Recently, common libraries per target base architecture were introduced in order
to compile those files only once. However, it was missing common dependencies
(which include external libraries), so it failed to build on some hosts.
This series fixes this, inspired by Thomas fix [1], and applied to other
libraries introduced very recently with [2].
As well, we do further cleanup by removing lib{system, user} source sets that
were recently introduced, by merging them in system/user libraries, thus
simplifying the work on single-binary.
This series was built on {linux, macos, windows} x {x86_64, aarch64} and
freebsd on x86_64. Fully tested on linux x {x86_64, aarch64}.
In addition to that, it was checked that compilation units compiled per binary
stayed the same, and that their size was identical.
[1] https://lore.kernel.org/qemu-devel/20250513115637.184940-1-thuth@redhat.com/
[2] https://gitlab.com/qemu-project/qemu/-/commit/b2bb3f3576e5dc99218607dde09e25ac0e55693c
v2
--
- Additional patch to merge hw_common_arch_libs in
target_common_system_arch libs (Paolo)
- Better commit description for merging lib{system, user}_ss with
{system, user}_ss (Paolo)
Pierrick Bouvier (7):
meson: build target libraries with common dependencies
hw/arm: remove explicit dependencies listed
target/arm: remove explicit dependencies listed
meson: apply target config for picking files from lib{system, user}
meson: merge lib{system, user}_ss with {system, user}_ss
meson: remove lib{system, user}_ss aliases
meson: merge hw_common_arch in target_common_system_arch
meson.build | 124 +++++++++++++++++++++--------------------
accel/tcg/meson.build | 8 +--
gdbstub/meson.build | 4 +-
hw/arm/meson.build | 4 +-
hw/core/meson.build | 4 +-
plugins/meson.build | 4 +-
system/meson.build | 2 +-
target/arm/meson.build | 2 +-
tcg/meson.build | 4 +-
9 files changed, 80 insertions(+), 76 deletions(-)
--
2.47.2
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v2 1/7] meson: build target libraries with common dependencies
2025-05-21 22:34 [PATCH v2 0/7] single-binary: build target common libraries with dependencies Pierrick Bouvier
@ 2025-05-21 22:34 ` Pierrick Bouvier
2025-05-21 22:34 ` [PATCH v2 2/7] hw/arm: remove explicit dependencies listed Pierrick Bouvier
` (7 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Pierrick Bouvier @ 2025-05-21 22:34 UTC (permalink / raw)
To: qemu-devel
Cc: Pierrick Bouvier, Philippe Mathieu-Daudé, Richard Henderson,
Peter Maydell, Paolo Bonzini, thuth, Alex Bennée,
Daniel P. Berrangé
As mentioned in [1], dependencies
were missing when compiling per target libraries, thus breaking
compilation on certain host systems.
We now explicitly add common dependencies to those libraries, so it
solves the problem.
[1] https://lore.kernel.org/qemu-devel/20250513115637.184940-1-thuth@redhat.com/
Tested-by: Thomas Huth <thuth@redhat.com>
Fixes: 6f4e8a92bbd ("hw/arm: make most of the compilation units common")
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
meson.build | 75 ++++++++++++++++++++++++++++-------------------------
1 file changed, 40 insertions(+), 35 deletions(-)
diff --git a/meson.build b/meson.build
index 49c8b0e5f6a..d803ec47221 100644
--- a/meson.build
+++ b/meson.build
@@ -3259,6 +3259,7 @@ config_devices_mak_list = []
config_devices_h = {}
config_target_h = {}
config_target_mak = {}
+config_base_arch_mak = {}
disassemblers = {
'alpha' : ['CONFIG_ALPHA_DIS'],
@@ -3451,6 +3452,11 @@ foreach target : target_dirs
config_all_devices += config_devices
endif
config_target_mak += {target: config_target}
+
+ # build a merged config for all targets with the same TARGET_BASE_ARCH
+ target_base_arch = config_target['TARGET_BASE_ARCH']
+ config_base_arch = config_base_arch_mak.get(target_base_arch, {}) + config_target
+ config_base_arch_mak += {target_base_arch: config_base_arch}
endforeach
target_dirs = actual_target_dirs
@@ -4131,57 +4137,56 @@ common_all = static_library('common',
hw_common_arch_libs = {}
target_common_arch_libs = {}
target_common_system_arch_libs = {}
-foreach target : target_dirs
+foreach target_base_arch, config_base_arch : config_base_arch_mak
config_target = config_target_mak[target]
- target_base_arch = config_target['TARGET_BASE_ARCH']
target_inc = [include_directories('target' / target_base_arch)]
inc = [common_user_inc + target_inc]
+ target_common = common_ss.apply(config_target, strict: false)
+ common_deps = []
+ foreach dep: target_common.dependencies()
+ common_deps += dep.partial_dependency(compile_args: true, includes: true)
+ endforeach
+
# prevent common code to access cpu compile time definition,
# but still allow access to cpu.h
target_c_args = ['-DCPU_DEFS_H']
target_system_c_args = target_c_args + ['-DCOMPILING_SYSTEM_VS_USER', '-DCONFIG_SOFTMMU']
if target_base_arch in hw_common_arch
- if target_base_arch not in hw_common_arch_libs
- src = hw_common_arch[target_base_arch]
- lib = static_library(
- 'hw_' + target_base_arch,
- build_by_default: false,
- sources: src.all_sources() + genh,
- include_directories: inc,
- c_args: target_system_c_args,
- dependencies: src.all_dependencies())
- hw_common_arch_libs += {target_base_arch: lib}
- endif
+ src = hw_common_arch[target_base_arch]
+ lib = static_library(
+ 'hw_' + target_base_arch,
+ build_by_default: false,
+ sources: src.all_sources() + genh,
+ include_directories: inc,
+ c_args: target_system_c_args,
+ dependencies: src.all_dependencies() + common_deps)
+ hw_common_arch_libs += {target_base_arch: lib}
endif
if target_base_arch in target_common_arch
- if target_base_arch not in target_common_arch_libs
- src = target_common_arch[target_base_arch]
- lib = static_library(
- 'target_' + target_base_arch,
- build_by_default: false,
- sources: src.all_sources() + genh,
- include_directories: inc,
- c_args: target_c_args,
- dependencies: src.all_dependencies())
- target_common_arch_libs += {target_base_arch: lib}
- endif
+ src = target_common_arch[target_base_arch]
+ lib = static_library(
+ 'target_' + target_base_arch,
+ build_by_default: false,
+ sources: src.all_sources() + genh,
+ include_directories: inc,
+ c_args: target_c_args,
+ dependencies: src.all_dependencies() + common_deps)
+ target_common_arch_libs += {target_base_arch: lib}
endif
if target_base_arch in target_common_system_arch
- if target_base_arch not in target_common_system_arch_libs
- src = target_common_system_arch[target_base_arch]
- lib = static_library(
- 'target_system_' + target_base_arch,
- build_by_default: false,
- sources: src.all_sources() + genh,
- include_directories: inc,
- c_args: target_system_c_args,
- dependencies: src.all_dependencies())
- target_common_system_arch_libs += {target_base_arch: lib}
- endif
+ src = target_common_system_arch[target_base_arch]
+ lib = static_library(
+ 'target_system_' + target_base_arch,
+ build_by_default: false,
+ sources: src.all_sources() + genh,
+ include_directories: inc,
+ c_args: target_system_c_args,
+ dependencies: src.all_dependencies() + common_deps)
+ target_common_system_arch_libs += {target_base_arch: lib}
endif
endforeach
--
2.47.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 2/7] hw/arm: remove explicit dependencies listed
2025-05-21 22:34 [PATCH v2 0/7] single-binary: build target common libraries with dependencies Pierrick Bouvier
2025-05-21 22:34 ` [PATCH v2 1/7] meson: build target libraries with common dependencies Pierrick Bouvier
@ 2025-05-21 22:34 ` Pierrick Bouvier
2025-05-22 4:52 ` Thomas Huth
2025-05-21 22:34 ` [PATCH v2 3/7] target/arm: " Pierrick Bouvier
` (6 subsequent siblings)
8 siblings, 1 reply; 14+ messages in thread
From: Pierrick Bouvier @ 2025-05-21 22:34 UTC (permalink / raw)
To: qemu-devel
Cc: Pierrick Bouvier, Philippe Mathieu-Daudé, Richard Henderson,
Peter Maydell, Paolo Bonzini, thuth, Alex Bennée,
Daniel P. Berrangé
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
hw/arm/meson.build | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/arm/meson.build b/hw/arm/meson.build
index 5098795f61d..d90be8f4c94 100644
--- a/hw/arm/meson.build
+++ b/hw/arm/meson.build
@@ -8,7 +8,7 @@ arm_common_ss.add(when: 'CONFIG_HIGHBANK', if_true: files('highbank.c'))
arm_common_ss.add(when: 'CONFIG_INTEGRATOR', if_true: files('integratorcp.c'))
arm_common_ss.add(when: 'CONFIG_MICROBIT', if_true: files('microbit.c'))
arm_common_ss.add(when: 'CONFIG_MPS3R', if_true: files('mps3r.c'))
-arm_common_ss.add(when: 'CONFIG_MUSICPAL', if_true: [pixman, files('musicpal.c')])
+arm_common_ss.add(when: 'CONFIG_MUSICPAL', if_true: [files('musicpal.c')])
arm_common_ss.add(when: 'CONFIG_NETDUINOPLUS2', if_true: files('netduinoplus2.c'))
arm_common_ss.add(when: 'CONFIG_OLIMEX_STM32_H405', if_true: files('olimex-stm32-h405.c'))
arm_common_ss.add(when: 'CONFIG_NPCM7XX', if_true: files('npcm7xx.c', 'npcm7xx_boards.c'))
@@ -79,7 +79,7 @@ arm_common_ss.add(when: 'CONFIG_SX1', if_true: files('omap_sx1.c'))
arm_common_ss.add(when: 'CONFIG_VERSATILE', if_true: files('versatilepb.c'))
arm_common_ss.add(when: 'CONFIG_VEXPRESS', if_true: files('vexpress.c'))
-arm_common_ss.add(fdt, files('boot.c'))
+arm_common_ss.add(files('boot.c'))
hw_arch += {'arm': arm_ss}
hw_common_arch += {'arm': arm_common_ss}
--
2.47.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 3/7] target/arm: remove explicit dependencies listed
2025-05-21 22:34 [PATCH v2 0/7] single-binary: build target common libraries with dependencies Pierrick Bouvier
2025-05-21 22:34 ` [PATCH v2 1/7] meson: build target libraries with common dependencies Pierrick Bouvier
2025-05-21 22:34 ` [PATCH v2 2/7] hw/arm: remove explicit dependencies listed Pierrick Bouvier
@ 2025-05-21 22:34 ` Pierrick Bouvier
2025-05-22 4:53 ` Thomas Huth
2025-05-21 22:34 ` [PATCH v2 4/7] meson: apply target config for picking files from lib{system, user} Pierrick Bouvier
` (5 subsequent siblings)
8 siblings, 1 reply; 14+ messages in thread
From: Pierrick Bouvier @ 2025-05-21 22:34 UTC (permalink / raw)
To: qemu-devel
Cc: Pierrick Bouvier, Philippe Mathieu-Daudé, Richard Henderson,
Peter Maydell, Paolo Bonzini, thuth, Alex Bennée,
Daniel P. Berrangé
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
target/arm/meson.build | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/target/arm/meson.build b/target/arm/meson.build
index b404fa54863..2ff7ed6e98f 100644
--- a/target/arm/meson.build
+++ b/target/arm/meson.build
@@ -28,7 +28,7 @@ arm_user_ss.add(files(
'vfp_fpscr.c',
))
-arm_common_system_ss.add(files('cpu.c'), capstone)
+arm_common_system_ss.add(files('cpu.c'))
arm_common_system_ss.add(when: 'TARGET_AARCH64', if_false: files(
'cpu32-stubs.c'))
arm_common_system_ss.add(when: 'CONFIG_KVM', if_false: files('kvm-stub.c'))
--
2.47.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 4/7] meson: apply target config for picking files from lib{system, user}
2025-05-21 22:34 [PATCH v2 0/7] single-binary: build target common libraries with dependencies Pierrick Bouvier
` (2 preceding siblings ...)
2025-05-21 22:34 ` [PATCH v2 3/7] target/arm: " Pierrick Bouvier
@ 2025-05-21 22:34 ` Pierrick Bouvier
2025-05-21 22:34 ` [PATCH v2 5/7] meson: merge lib{system, user}_ss with {system, user}_ss Pierrick Bouvier
` (4 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Pierrick Bouvier @ 2025-05-21 22:34 UTC (permalink / raw)
To: qemu-devel
Cc: Pierrick Bouvier, Philippe Mathieu-Daudé, Richard Henderson,
Peter Maydell, Paolo Bonzini, thuth, Alex Bennée,
Daniel P. Berrangé
semihosting code needs to be included only if CONFIG_SEMIHOSTING is set.
However, this is a target configuration, so we need to apply it to the
lib{system, user}_ss.
As well, this prepares merging lib{system, user}_ss with
{system, user}_ss.
Acked-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
meson.build | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/meson.build b/meson.build
index d803ec47221..22eb2f04e09 100644
--- a/meson.build
+++ b/meson.build
@@ -4101,27 +4101,19 @@ common_ss.add(qom, qemuutil)
common_ss.add_all(when: 'CONFIG_SYSTEM_ONLY', if_true: [system_ss])
common_ss.add_all(when: 'CONFIG_USER_ONLY', if_true: user_ss)
-libuser_ss = libuser_ss.apply({})
libuser = static_library('user',
- libuser_ss.sources() + genh,
+ libuser_ss.all_sources() + genh,
c_args: ['-DCONFIG_USER_ONLY',
'-DCOMPILING_SYSTEM_VS_USER'],
- dependencies: libuser_ss.dependencies(),
+ dependencies: libuser_ss.all_dependencies(),
build_by_default: false)
-libuser = declare_dependency(objects: libuser.extract_all_objects(recursive: false),
- dependencies: libuser_ss.dependencies())
-common_ss.add(when: 'CONFIG_USER_ONLY', if_true: libuser)
-libsystem_ss = libsystem_ss.apply({})
libsystem = static_library('system',
- libsystem_ss.sources() + genh,
+ libsystem_ss.all_sources() + genh,
c_args: ['-DCONFIG_SOFTMMU',
'-DCOMPILING_SYSTEM_VS_USER'],
- dependencies: libsystem_ss.dependencies(),
+ dependencies: libsystem_ss.all_dependencies(),
build_by_default: false)
-libsystem = declare_dependency(objects: libsystem.extract_all_objects(recursive: false),
- dependencies: libsystem_ss.dependencies())
-common_ss.add(when: 'CONFIG_SYSTEM_ONLY', if_true: libsystem)
# Note that this library is never used directly (only through extract_objects)
# and is not built by default; therefore, source files not used by the build
@@ -4365,6 +4357,16 @@ foreach target : target_dirs
objects += lib.extract_objects(src.sources())
arch_deps += src.dependencies()
endif
+ if target_type == 'system'
+ src = libsystem_ss.apply(config_target, strict: false)
+ objects += libsystem.extract_objects(src.sources())
+ arch_deps += src.dependencies()
+ endif
+ if target_type == 'user'
+ src = libuser_ss.apply(config_target, strict: false)
+ objects += libuser.extract_objects(src.sources())
+ arch_deps += src.dependencies()
+ endif
if target_type == 'system' and target_base_arch in hw_common_arch_libs
src = hw_common_arch[target_base_arch].apply(config_target, strict: false)
lib = hw_common_arch_libs[target_base_arch]
--
2.47.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 5/7] meson: merge lib{system, user}_ss with {system, user}_ss
2025-05-21 22:34 [PATCH v2 0/7] single-binary: build target common libraries with dependencies Pierrick Bouvier
` (3 preceding siblings ...)
2025-05-21 22:34 ` [PATCH v2 4/7] meson: apply target config for picking files from lib{system, user} Pierrick Bouvier
@ 2025-05-21 22:34 ` Pierrick Bouvier
2025-05-21 22:34 ` [PATCH v2 6/7] meson: remove lib{system, user}_ss aliases Pierrick Bouvier
` (3 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Pierrick Bouvier @ 2025-05-21 22:34 UTC (permalink / raw)
To: qemu-devel
Cc: Pierrick Bouvier, Philippe Mathieu-Daudé, Richard Henderson,
Peter Maydell, Paolo Bonzini, thuth, Alex Bennée,
Daniel P. Berrangé
Now that target configuration can be applied to lib{system, user}_ss,
there is no reason to keep that separate from the existing {system,
user}_ss.
The only difference is that we'll now compile those files with
-DCOMPILING_SYSTEM_VS_USER, which removes poison for
CONFIG_USER_ONLY and CONFIG_SOFTMMU, without any other side effect.
We extract existing system/user code common common libraries to
lib{system, user}.
To not break existing meson files, we alias libsystem_ss to system_ss
and libuser_ss to user_ss, so we can do the cleanup in next commit.
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
meson.build | 38 +++++++++++++++++++++++---------------
1 file changed, 23 insertions(+), 15 deletions(-)
diff --git a/meson.build b/meson.build
index 22eb2f04e09..23815c916cb 100644
--- a/meson.build
+++ b/meson.build
@@ -3712,14 +3712,14 @@ io_ss = ss.source_set()
qmp_ss = ss.source_set()
qom_ss = ss.source_set()
system_ss = ss.source_set()
-libsystem_ss = ss.source_set()
+libsystem_ss = system_ss
specific_fuzz_ss = ss.source_set()
specific_ss = ss.source_set()
rust_devices_ss = ss.source_set()
stub_ss = ss.source_set()
trace_ss = ss.source_set()
user_ss = ss.source_set()
-libuser_ss = ss.source_set()
+libuser_ss = user_ss
util_ss = ss.source_set()
# accel modules
@@ -4098,21 +4098,19 @@ common_ss.add(hwcore)
system_ss.add(authz, blockdev, chardev, crypto, io, qmp)
common_ss.add(qom, qemuutil)
-common_ss.add_all(when: 'CONFIG_SYSTEM_ONLY', if_true: [system_ss])
-common_ss.add_all(when: 'CONFIG_USER_ONLY', if_true: user_ss)
-
libuser = static_library('user',
- libuser_ss.all_sources() + genh,
+ user_ss.all_sources() + genh,
c_args: ['-DCONFIG_USER_ONLY',
'-DCOMPILING_SYSTEM_VS_USER'],
- dependencies: libuser_ss.all_dependencies(),
+ include_directories: common_user_inc,
+ dependencies: user_ss.all_dependencies(),
build_by_default: false)
libsystem = static_library('system',
- libsystem_ss.all_sources() + genh,
+ system_ss.all_sources() + genh,
c_args: ['-DCONFIG_SOFTMMU',
'-DCOMPILING_SYSTEM_VS_USER'],
- dependencies: libsystem_ss.all_dependencies(),
+ dependencies: system_ss.all_dependencies(),
build_by_default: false)
# Note that this library is never used directly (only through extract_objects)
@@ -4121,7 +4119,6 @@ libsystem = static_library('system',
common_all = static_library('common',
build_by_default: false,
sources: common_ss.all_sources() + genh,
- include_directories: common_user_inc,
implicit_include_directories: false,
dependencies: common_ss.all_dependencies())
@@ -4135,10 +4132,20 @@ foreach target_base_arch, config_base_arch : config_base_arch_mak
inc = [common_user_inc + target_inc]
target_common = common_ss.apply(config_target, strict: false)
+ target_system = system_ss.apply(config_target, strict: false)
+ target_user = user_ss.apply(config_target, strict: false)
common_deps = []
+ system_deps = []
+ user_deps = []
foreach dep: target_common.dependencies()
common_deps += dep.partial_dependency(compile_args: true, includes: true)
endforeach
+ foreach dep: target_system.dependencies()
+ system_deps += dep.partial_dependency(compile_args: true, includes: true)
+ endforeach
+ foreach dep: target_user.dependencies()
+ user_deps += dep.partial_dependency(compile_args: true, includes: true)
+ endforeach
# prevent common code to access cpu compile time definition,
# but still allow access to cpu.h
@@ -4153,7 +4160,7 @@ foreach target_base_arch, config_base_arch : config_base_arch_mak
sources: src.all_sources() + genh,
include_directories: inc,
c_args: target_system_c_args,
- dependencies: src.all_dependencies() + common_deps)
+ dependencies: src.all_dependencies() + common_deps + system_deps)
hw_common_arch_libs += {target_base_arch: lib}
endif
@@ -4165,7 +4172,8 @@ foreach target_base_arch, config_base_arch : config_base_arch_mak
sources: src.all_sources() + genh,
include_directories: inc,
c_args: target_c_args,
- dependencies: src.all_dependencies() + common_deps)
+ dependencies: src.all_dependencies() + common_deps +
+ system_deps + user_deps)
target_common_arch_libs += {target_base_arch: lib}
endif
@@ -4177,7 +4185,7 @@ foreach target_base_arch, config_base_arch : config_base_arch_mak
sources: src.all_sources() + genh,
include_directories: inc,
c_args: target_system_c_args,
- dependencies: src.all_dependencies() + common_deps)
+ dependencies: src.all_dependencies() + common_deps + system_deps)
target_common_system_arch_libs += {target_base_arch: lib}
endif
endforeach
@@ -4358,12 +4366,12 @@ foreach target : target_dirs
arch_deps += src.dependencies()
endif
if target_type == 'system'
- src = libsystem_ss.apply(config_target, strict: false)
+ src = system_ss.apply(config_target, strict: false)
objects += libsystem.extract_objects(src.sources())
arch_deps += src.dependencies()
endif
if target_type == 'user'
- src = libuser_ss.apply(config_target, strict: false)
+ src = user_ss.apply(config_target, strict: false)
objects += libuser.extract_objects(src.sources())
arch_deps += src.dependencies()
endif
--
2.47.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 6/7] meson: remove lib{system, user}_ss aliases
2025-05-21 22:34 [PATCH v2 0/7] single-binary: build target common libraries with dependencies Pierrick Bouvier
` (4 preceding siblings ...)
2025-05-21 22:34 ` [PATCH v2 5/7] meson: merge lib{system, user}_ss with {system, user}_ss Pierrick Bouvier
@ 2025-05-21 22:34 ` Pierrick Bouvier
2025-05-21 22:34 ` [PATCH v2 7/7] meson: merge hw_common_arch in target_common_system_arch Pierrick Bouvier
` (2 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Pierrick Bouvier @ 2025-05-21 22:34 UTC (permalink / raw)
To: qemu-devel
Cc: Pierrick Bouvier, Philippe Mathieu-Daudé, Richard Henderson,
Peter Maydell, Paolo Bonzini, thuth, Alex Bennée,
Daniel P. Berrangé
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
meson.build | 2 --
accel/tcg/meson.build | 8 ++++----
gdbstub/meson.build | 4 ++--
hw/core/meson.build | 4 ++--
plugins/meson.build | 4 ++--
system/meson.build | 2 +-
tcg/meson.build | 4 ++--
7 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/meson.build b/meson.build
index 23815c916cb..087ce7dd20d 100644
--- a/meson.build
+++ b/meson.build
@@ -3712,14 +3712,12 @@ io_ss = ss.source_set()
qmp_ss = ss.source_set()
qom_ss = ss.source_set()
system_ss = ss.source_set()
-libsystem_ss = system_ss
specific_fuzz_ss = ss.source_set()
specific_ss = ss.source_set()
rust_devices_ss = ss.source_set()
stub_ss = ss.source_set()
trace_ss = ss.source_set()
user_ss = ss.source_set()
-libuser_ss = user_ss
util_ss = ss.source_set()
# accel modules
diff --git a/accel/tcg/meson.build b/accel/tcg/meson.build
index 97d5e5a7112..575e92bb9e8 100644
--- a/accel/tcg/meson.build
+++ b/accel/tcg/meson.build
@@ -18,15 +18,15 @@ if get_option('plugins')
tcg_ss.add(files('plugin-gen.c'))
endif
-libuser_ss.add_all(tcg_ss)
-libsystem_ss.add_all(tcg_ss)
+user_ss.add_all(tcg_ss)
+system_ss.add_all(tcg_ss)
-libuser_ss.add(files(
+user_ss.add(files(
'user-exec.c',
'user-exec-stub.c',
))
-libsystem_ss.add(files(
+system_ss.add(files(
'cputlb.c',
'icount-common.c',
'monitor.c',
diff --git a/gdbstub/meson.build b/gdbstub/meson.build
index b25db86767e..15c666f5752 100644
--- a/gdbstub/meson.build
+++ b/gdbstub/meson.build
@@ -5,13 +5,13 @@
#
# We build two versions of gdbstub, one for each mode
-libuser_ss.add(files(
+user_ss.add(files(
'gdbstub.c',
'syscalls.c',
'user.c'
))
-libsystem_ss.add(files(
+system_ss.add(files(
'gdbstub.c',
'syscalls.c',
'system.c'
diff --git a/hw/core/meson.build b/hw/core/meson.build
index 547de6527cf..b5a545a0edd 100644
--- a/hw/core/meson.build
+++ b/hw/core/meson.build
@@ -26,7 +26,7 @@ system_ss.add(when: 'CONFIG_XILINX_AXI', if_true: files('stream.c'))
system_ss.add(when: 'CONFIG_PLATFORM_BUS', if_true: files('sysbus-fdt.c'))
system_ss.add(when: 'CONFIG_EIF', if_true: [files('eif.c'), zlib, libcbor, gnutls])
-libsystem_ss.add(files(
+system_ss.add(files(
'cpu-system.c',
'fw-path-provider.c',
'gpio.c',
@@ -46,7 +46,7 @@ libsystem_ss.add(files(
'vm-change-state-handler.c',
'clock-vmstate.c',
))
-libuser_ss.add(files(
+user_ss.add(files(
'cpu-user.c',
'qdev-user.c',
))
diff --git a/plugins/meson.build b/plugins/meson.build
index 5383c7b88bf..b20edfbabc1 100644
--- a/plugins/meson.build
+++ b/plugins/meson.build
@@ -61,8 +61,8 @@ endif
user_ss.add(files('user.c', 'api-user.c'))
system_ss.add(files('system.c', 'api-system.c'))
-libuser_ss.add(files('api.c', 'core.c'))
-libsystem_ss.add(files('api.c', 'core.c'))
+user_ss.add(files('api.c', 'core.c'))
+system_ss.add(files('api.c', 'core.c'))
common_ss.add(files('loader.c'))
diff --git a/system/meson.build b/system/meson.build
index c2f00827669..7514bf3455d 100644
--- a/system/meson.build
+++ b/system/meson.build
@@ -7,7 +7,7 @@ system_ss.add(files(
'vl.c',
), sdl, libpmem, libdaxctl)
-libsystem_ss.add(files(
+system_ss.add(files(
'balloon.c',
'bootdevice.c',
'cpus.c',
diff --git a/tcg/meson.build b/tcg/meson.build
index bd2821e4b54..706a6eb260e 100644
--- a/tcg/meson.build
+++ b/tcg/meson.build
@@ -27,5 +27,5 @@ if host_os == 'linux'
tcg_ss.add(files('perf.c'))
endif
-libuser_ss.add_all(tcg_ss)
-libsystem_ss.add_all(tcg_ss)
+user_ss.add_all(tcg_ss)
+system_ss.add_all(tcg_ss)
--
2.47.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 7/7] meson: merge hw_common_arch in target_common_system_arch
2025-05-21 22:34 [PATCH v2 0/7] single-binary: build target common libraries with dependencies Pierrick Bouvier
` (5 preceding siblings ...)
2025-05-21 22:34 ` [PATCH v2 6/7] meson: remove lib{system, user}_ss aliases Pierrick Bouvier
@ 2025-05-21 22:34 ` Pierrick Bouvier
2025-05-26 9:53 ` [PATCH v2 0/7] single-binary: build target common libraries with dependencies Philippe Mathieu-Daudé
2025-05-26 16:04 ` Paolo Bonzini
8 siblings, 0 replies; 14+ messages in thread
From: Pierrick Bouvier @ 2025-05-21 22:34 UTC (permalink / raw)
To: qemu-devel
Cc: Pierrick Bouvier, Philippe Mathieu-Daudé, Richard Henderson,
Peter Maydell, Paolo Bonzini, thuth, Alex Bennée,
Daniel P. Berrangé
No need to keep two different libraries, as both are compiled with exact
same flags. As well, rename target common libraries to common_{arch} and
system_{arch}, to follow what exists for common and system libraries.
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
meson.build | 33 ++++++++++++---------------------
1 file changed, 12 insertions(+), 21 deletions(-)
diff --git a/meson.build b/meson.build
index 087ce7dd20d..f57b051b3d4 100644
--- a/meson.build
+++ b/meson.build
@@ -4121,7 +4121,6 @@ common_all = static_library('common',
dependencies: common_ss.all_dependencies())
# construct common libraries per base architecture
-hw_common_arch_libs = {}
target_common_arch_libs = {}
target_common_system_arch_libs = {}
foreach target_base_arch, config_base_arch : config_base_arch_mak
@@ -4150,22 +4149,10 @@ foreach target_base_arch, config_base_arch : config_base_arch_mak
target_c_args = ['-DCPU_DEFS_H']
target_system_c_args = target_c_args + ['-DCOMPILING_SYSTEM_VS_USER', '-DCONFIG_SOFTMMU']
- if target_base_arch in hw_common_arch
- src = hw_common_arch[target_base_arch]
- lib = static_library(
- 'hw_' + target_base_arch,
- build_by_default: false,
- sources: src.all_sources() + genh,
- include_directories: inc,
- c_args: target_system_c_args,
- dependencies: src.all_dependencies() + common_deps + system_deps)
- hw_common_arch_libs += {target_base_arch: lib}
- endif
-
if target_base_arch in target_common_arch
src = target_common_arch[target_base_arch]
lib = static_library(
- 'target_' + target_base_arch,
+ 'common_' + target_base_arch,
build_by_default: false,
sources: src.all_sources() + genh,
include_directories: inc,
@@ -4175,10 +4162,20 @@ foreach target_base_arch, config_base_arch : config_base_arch_mak
target_common_arch_libs += {target_base_arch: lib}
endif
+ # merge hw_common_arch in target_common_system_arch
+ if target_base_arch in hw_common_arch
+ hw_src = hw_common_arch[target_base_arch]
+ if target_base_arch in target_common_system_arch
+ target_common_system_arch[target_base_arch].add_all(hw_src)
+ else
+ target_common_system_arch += {target_base_arch: hw_src}
+ endif
+ endif
+
if target_base_arch in target_common_system_arch
src = target_common_system_arch[target_base_arch]
lib = static_library(
- 'target_system_' + target_base_arch,
+ 'system_' + target_base_arch,
build_by_default: false,
sources: src.all_sources() + genh,
include_directories: inc,
@@ -4373,12 +4370,6 @@ foreach target : target_dirs
objects += libuser.extract_objects(src.sources())
arch_deps += src.dependencies()
endif
- if target_type == 'system' and target_base_arch in hw_common_arch_libs
- src = hw_common_arch[target_base_arch].apply(config_target, strict: false)
- lib = hw_common_arch_libs[target_base_arch]
- objects += lib.extract_objects(src.sources())
- arch_deps += src.dependencies()
- endif
if target_type == 'system' and target_base_arch in target_common_system_arch_libs
src = target_common_system_arch[target_base_arch].apply(config_target, strict: false)
lib = target_common_system_arch_libs[target_base_arch]
--
2.47.2
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v2 2/7] hw/arm: remove explicit dependencies listed
2025-05-21 22:34 ` [PATCH v2 2/7] hw/arm: remove explicit dependencies listed Pierrick Bouvier
@ 2025-05-22 4:52 ` Thomas Huth
2025-05-22 18:41 ` Pierrick Bouvier
0 siblings, 1 reply; 14+ messages in thread
From: Thomas Huth @ 2025-05-22 4:52 UTC (permalink / raw)
To: Pierrick Bouvier, qemu-devel
Cc: Philippe Mathieu-Daudé, Richard Henderson, Peter Maydell,
Paolo Bonzini, Alex Bennée, Daniel P. Berrangé
On 22/05/2025 00.34, Pierrick Bouvier wrote:
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
> hw/arm/meson.build | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/arm/meson.build b/hw/arm/meson.build
> index 5098795f61d..d90be8f4c94 100644
> --- a/hw/arm/meson.build
> +++ b/hw/arm/meson.build
> @@ -8,7 +8,7 @@ arm_common_ss.add(when: 'CONFIG_HIGHBANK', if_true: files('highbank.c'))
> arm_common_ss.add(when: 'CONFIG_INTEGRATOR', if_true: files('integratorcp.c'))
> arm_common_ss.add(when: 'CONFIG_MICROBIT', if_true: files('microbit.c'))
> arm_common_ss.add(when: 'CONFIG_MPS3R', if_true: files('mps3r.c'))
> -arm_common_ss.add(when: 'CONFIG_MUSICPAL', if_true: [pixman, files('musicpal.c')])
> +arm_common_ss.add(when: 'CONFIG_MUSICPAL', if_true: [files('musicpal.c')])
> arm_common_ss.add(when: 'CONFIG_NETDUINOPLUS2', if_true: files('netduinoplus2.c'))
> arm_common_ss.add(when: 'CONFIG_OLIMEX_STM32_H405', if_true: files('olimex-stm32-h405.c'))
> arm_common_ss.add(when: 'CONFIG_NPCM7XX', if_true: files('npcm7xx.c', 'npcm7xx_boards.c'))
> @@ -79,7 +79,7 @@ arm_common_ss.add(when: 'CONFIG_SX1', if_true: files('omap_sx1.c'))
> arm_common_ss.add(when: 'CONFIG_VERSATILE', if_true: files('versatilepb.c'))
> arm_common_ss.add(when: 'CONFIG_VEXPRESS', if_true: files('vexpress.c'))
>
> -arm_common_ss.add(fdt, files('boot.c'))
> +arm_common_ss.add(files('boot.c'))
Reviewed-by: Thomas Huth <thuth@redhat.com>
There is another bunch of pixmans in hw/display/meson.build and
hw/s390x/meson.build ... I wonder whether we could get rid of those now, too?
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 3/7] target/arm: remove explicit dependencies listed
2025-05-21 22:34 ` [PATCH v2 3/7] target/arm: " Pierrick Bouvier
@ 2025-05-22 4:53 ` Thomas Huth
0 siblings, 0 replies; 14+ messages in thread
From: Thomas Huth @ 2025-05-22 4:53 UTC (permalink / raw)
To: Pierrick Bouvier, qemu-devel
Cc: Philippe Mathieu-Daudé, Richard Henderson, Peter Maydell,
Paolo Bonzini, Alex Bennée, Daniel P. Berrangé
On 22/05/2025 00.34, Pierrick Bouvier wrote:
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
> target/arm/meson.build | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/target/arm/meson.build b/target/arm/meson.build
> index b404fa54863..2ff7ed6e98f 100644
> --- a/target/arm/meson.build
> +++ b/target/arm/meson.build
> @@ -28,7 +28,7 @@ arm_user_ss.add(files(
> 'vfp_fpscr.c',
> ))
>
> -arm_common_system_ss.add(files('cpu.c'), capstone)
> +arm_common_system_ss.add(files('cpu.c'))
> arm_common_system_ss.add(when: 'TARGET_AARCH64', if_false: files(
> 'cpu32-stubs.c'))
> arm_common_system_ss.add(when: 'CONFIG_KVM', if_false: files('kvm-stub.c'))
Reviewed-by: Thomas Huth <thuth@redhat.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 2/7] hw/arm: remove explicit dependencies listed
2025-05-22 4:52 ` Thomas Huth
@ 2025-05-22 18:41 ` Pierrick Bouvier
0 siblings, 0 replies; 14+ messages in thread
From: Pierrick Bouvier @ 2025-05-22 18:41 UTC (permalink / raw)
To: Thomas Huth, qemu-devel
Cc: Philippe Mathieu-Daudé, Richard Henderson, Peter Maydell,
Paolo Bonzini, Alex Bennée, Daniel P. Berrangé
On 5/21/25 9:52 PM, Thomas Huth wrote:
> On 22/05/2025 00.34, Pierrick Bouvier wrote:
>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>> ---
>> hw/arm/meson.build | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> Reviewed-by: Thomas Huth <thuth@redhat.com>
>
> There is another bunch of pixmans in hw/display/meson.build and
> hw/s390x/meson.build ... I wonder whether we could get rid of those now, too?
>
It could, but those files are not (yet) included in target_common
libraries, so I think it can be cleaned up later.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 0/7] single-binary: build target common libraries with dependencies
2025-05-21 22:34 [PATCH v2 0/7] single-binary: build target common libraries with dependencies Pierrick Bouvier
` (6 preceding siblings ...)
2025-05-21 22:34 ` [PATCH v2 7/7] meson: merge hw_common_arch in target_common_system_arch Pierrick Bouvier
@ 2025-05-26 9:53 ` Philippe Mathieu-Daudé
2025-05-27 17:15 ` Pierrick Bouvier
2025-05-26 16:04 ` Paolo Bonzini
8 siblings, 1 reply; 14+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-05-26 9:53 UTC (permalink / raw)
To: Pierrick Bouvier, qemu-devel
Cc: Richard Henderson, Peter Maydell, Paolo Bonzini, thuth,
Alex Bennée, Daniel P. Berrangé
On 22/5/25 00:34, Pierrick Bouvier wrote:
> Pierrick Bouvier (7):
> meson: build target libraries with common dependencies
> hw/arm: remove explicit dependencies listed
> target/arm: remove explicit dependencies listed
> meson: apply target config for picking files from lib{system, user}
> meson: merge lib{system, user}_ss with {system, user}_ss
> meson: remove lib{system, user}_ss aliases
> meson: merge hw_common_arch in target_common_system_arch
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 0/7] single-binary: build target common libraries with dependencies
2025-05-21 22:34 [PATCH v2 0/7] single-binary: build target common libraries with dependencies Pierrick Bouvier
` (7 preceding siblings ...)
2025-05-26 9:53 ` [PATCH v2 0/7] single-binary: build target common libraries with dependencies Philippe Mathieu-Daudé
@ 2025-05-26 16:04 ` Paolo Bonzini
8 siblings, 0 replies; 14+ messages in thread
From: Paolo Bonzini @ 2025-05-26 16:04 UTC (permalink / raw)
To: Pierrick Bouvier
Cc: qemu-devel, Philippe Mathieu-Daudé, Richard Henderson,
Peter Maydell, thuth, Alex Bennée, Daniel P . Berrangé
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 0/7] single-binary: build target common libraries with dependencies
2025-05-26 9:53 ` [PATCH v2 0/7] single-binary: build target common libraries with dependencies Philippe Mathieu-Daudé
@ 2025-05-27 17:15 ` Pierrick Bouvier
0 siblings, 0 replies; 14+ messages in thread
From: Pierrick Bouvier @ 2025-05-27 17:15 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Richard Henderson, Peter Maydell, Paolo Bonzini, thuth,
Alex Bennée, Daniel P. Berrangé
On 5/26/25 2:53 AM, Philippe Mathieu-Daudé wrote:
> On 22/5/25 00:34, Pierrick Bouvier wrote:
>
>> Pierrick Bouvier (7):
>> meson: build target libraries with common dependencies
>> hw/arm: remove explicit dependencies listed
>> target/arm: remove explicit dependencies listed
>> meson: apply target config for picking files from lib{system, user}
>> meson: merge lib{system, user}_ss with {system, user}_ss
>> meson: remove lib{system, user}_ss aliases
>> meson: merge hw_common_arch in target_common_system_arch
>
> Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>
Thanks to you and Thomas for raising the issues this series fixed:
- dependencies for target common libraries
- apply config for target common libraries
We should be good and complete in terms of build system for the single
binary now.
(last step left will be to create the single binary itself, which I have
a patch for, but it will come later, no need to worry people with a new
mysterious binary :)).
Pierrick
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2025-05-27 17:16 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-21 22:34 [PATCH v2 0/7] single-binary: build target common libraries with dependencies Pierrick Bouvier
2025-05-21 22:34 ` [PATCH v2 1/7] meson: build target libraries with common dependencies Pierrick Bouvier
2025-05-21 22:34 ` [PATCH v2 2/7] hw/arm: remove explicit dependencies listed Pierrick Bouvier
2025-05-22 4:52 ` Thomas Huth
2025-05-22 18:41 ` Pierrick Bouvier
2025-05-21 22:34 ` [PATCH v2 3/7] target/arm: " Pierrick Bouvier
2025-05-22 4:53 ` Thomas Huth
2025-05-21 22:34 ` [PATCH v2 4/7] meson: apply target config for picking files from lib{system, user} Pierrick Bouvier
2025-05-21 22:34 ` [PATCH v2 5/7] meson: merge lib{system, user}_ss with {system, user}_ss Pierrick Bouvier
2025-05-21 22:34 ` [PATCH v2 6/7] meson: remove lib{system, user}_ss aliases Pierrick Bouvier
2025-05-21 22:34 ` [PATCH v2 7/7] meson: merge hw_common_arch in target_common_system_arch Pierrick Bouvier
2025-05-26 9:53 ` [PATCH v2 0/7] single-binary: build target common libraries with dependencies Philippe Mathieu-Daudé
2025-05-27 17:15 ` Pierrick Bouvier
2025-05-26 16:04 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).