Rather than unconditional linkage via system_ss, conditinally include the static library via specific_ss. This will elide the code when CONFIG_TCG is disabled for a specific target.
Signed-off-by: Richard Henderson <richard.hender...@linaro.org> --- tcg/meson.build | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tcg/meson.build b/tcg/meson.build index 2977df5862..8266bcb324 100644 --- a/tcg/meson.build +++ b/tcg/meson.build @@ -49,4 +49,8 @@ libtcg_system = static_library('tcg_system', tcg_system = declare_dependency(objects: libtcg_system.extract_all_objects(recursive: false), dependencies: tcg_ss.dependencies()) -system_ss.add(tcg_system) + +specific_ss.add(when: ['CONFIG_SYSTEM_ONLY', 'CONFIG_TCG'], if_true: tcg_system) +if host_os == 'linux' + specific_ss.add(when: 'CONFIG_TCG', if_false: files('perf-stubs.c')) +endif -- 2.43.0