From patchwork Mon May 5 23:19:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 887504 Delivered-To: patch@linaro.org Received: by 2002:a5d:430f:0:b0:38f:210b:807b with SMTP id h15csp2291464wrq; Mon, 5 May 2025 16:28:23 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWVUeXriExkGjmRP9ofqxsgwK7uaLP6mOHllku2qwRwEPzSjE337giKbBro+mLpE5BAwfcgTQ==@linaro.org X-Google-Smtp-Source: AGHT+IESSgeGKi2WD8+uIV/d9prWR2sqk6zZtQAqa0LnUKYQWSHRCrQMgW26YVSHFX3lMjgQXusW X-Received: by 2002:a05:622a:1a90:b0:476:7018:9ae4 with SMTP id d75a77b69052e-4910c48ae4dmr13852871cf.16.1746487703554; Mon, 05 May 2025 16:28:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1746487703; cv=none; d=google.com; s=arc-20240605; b=XwSr9no9m1iqp81E/vJAKQbWX9R2+5D44wCZWgP6oFejaIrwKuR4EMOUZnKY9tOesS SA65nUIeI2Y19rxkftC53MRN5phdroMau2bda0A7q1bbpUM+6tSvg+8z2PvOZwHv/vLe 08ptKyktC9L58oyuhHtqXmjyveOcH7Gkw1707GSA53wzTlPxO2b40abU1tq6to5hc/Na r7IsNxe/iOHtG8iVoc1G3kYrX/wJ7y1U31uDD9bunKLVZ0UpRXW25Lk3htbswLgyXyJm dDah0L/T7V7eJXq+1KjEP34SFxojSMTNkff1xQ4S/kQZt/l3Wa6aAsxzhDBRoLfgo5Y1 uFAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1mHjwLOmCSZb7+SiNUT87VRUe5PiKHdCHDdwE+42+GQ=; fh=sKdX4/MHbRvqsf1uWWiw/b4mRzIm0SRNXacICL4/ZgI=; b=H179enxsbfUyXxGBWwsuSwtLA/9f3s3PpmQ8xEDtYxFm5KUEJkljA1F/0ZrC6I4iBw bHLywToqdJKztpJtTuM2AJ5yNvTQh3Mcc518llMFTKFAlmVu4vRt3RvENXZ3/gSojxcd NRWgcSWV0HzNKJGXVFNED9Rq8sRggJVIJkSHCcTnst1GXxLKl3ZRzc81VkosNvcyn2jI 6vZrfj4N6v2QqNYKP8iELZrIFJwOeiTf8tF5RobBjKZ7r9OYbTh18lbOUjWrYPC/y9ku 01nCTbVHYGu1QmyWGhcm8Rz/bwgu9ljyTbzctp1+TfL+yd/hHXegQ3S0l6wpubV+nPTF TmDw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=j6QlwMny; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-490dbd05402si8896311cf.278.2025.05.05.16.28.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 05 May 2025 16:28:23 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=j6QlwMny; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uC56v-0006BV-B6; Mon, 05 May 2025 19:20:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uC56r-00067k-Ft for qemu-devel@nongnu.org; Mon, 05 May 2025 19:20:29 -0400 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uC56n-0003Ui-8c for qemu-devel@nongnu.org; Mon, 05 May 2025 19:20:28 -0400 Received: by mail-pj1-x1031.google.com with SMTP id 98e67ed59e1d1-2ff6cf448b8so6479818a91.3 for ; Mon, 05 May 2025 16:20:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1746487223; x=1747092023; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1mHjwLOmCSZb7+SiNUT87VRUe5PiKHdCHDdwE+42+GQ=; b=j6QlwMnySWnRLtI9Jh5fnoIGvJwrGdbqQ7xHKPw3/+7aJCU+uu+td7KhdCwtF5xaUK r7VfBTh9MojcgathubCvuHY2AfLQtaykx4/XrdO1jtJ/1oREkR9bXuEXfYt11T70Y+8Z JRT0IBbGxdOGb6yi7dfZeSZNOsyAMNuNEtAJLLAH5e+ldUENxcQFrpGQb99TzEP3ZWqc PGXL+KV6GA0DmVjmmBONO5Y/2nizA453/ACQSJpnNeTXJ5Sur1KT8fWP2ZvZ8r0cQmVI wNMzEnneAZAl8d2Y7HO9bvAzebhmwjKcUweHwbNOz46GT7MiN1pLJnw+sHtDoJRa9jon an0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746487223; x=1747092023; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1mHjwLOmCSZb7+SiNUT87VRUe5PiKHdCHDdwE+42+GQ=; b=CQE/808BfMGwJVwuf63YeOthgJOVltqszR63gqzl05Bi1aizyLZgJTMZWekNhUXN35 /1Y4ZwYrB7bJ5eRyg0Ly+467lL/C2KHrzOZecRc+5ytsssn/qPvkKQd0nc77+ahnib6k Ns9wDYt84kjA7WRU+5GMUmGokMnk5dPurGNCrsa5dDRXVlYDL+KEENPZaUDT1+CDtykB vJHv2v8TVHT9C/A7F6vnaUaxkibkIwGMRNjJvFk0j5p8n2xE4XcjM0xTlKXUM4i1g6of xh1b7ESGsBNEEOkNKeLs3S/xUKgY643MkKg2C6xjPvk9lHScS92mjLaIY8XAizNnoDYj yqtg== X-Gm-Message-State: AOJu0Yx7Mvn7zBxS62KaWeChHRlDBPJumGdOcIVvRmtilFPx+GPAxhNL uJzKQpZZsxlCPSHBbefPUYYL/DqdoUSd6cb/4zX3OTvsVSLveX4m+eZT0G+IMe3bBgX4PoInwZt Yxig= X-Gm-Gg: ASbGncskc7bddY6IVPwIOwhNIaF2indDhCvk5Tu29a/q+iFKU1dexpEtTik5+eHCtGd 907u6NRzMaJkyrxn7sdBH6H8FUYBlF2CB0QQhY5RiZRZvUnxGcejM0B1yBltnC+7TAGTEccBjRo yef3UnLyPv5QjJiUa2xhhoBuyicI1HUksFbvygLC+lJTm0Dt1xEBLYtDbCC8faKnA33Cpl23KCR PV9Z0RYRIx23app4O1xNaW9Q9jvHFI8s2KrHBU820KdaLUf8kpi2GYKO2lCqhsA6AcfT/NNrKkp 7yQgFGdPtmdz7jCvxISL7N+V9WOm2n5B2rNhxLnQ X-Received: by 2002:a17:90b:3e45:b0:301:98fc:9b5a with SMTP id 98e67ed59e1d1-30a7dac8b0dmr876783a91.6.1746487223333; Mon, 05 May 2025 16:20:23 -0700 (PDT) Received: from pc.. ([38.41.223.211]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-22e1522917asm60981715ad.201.2025.05.05.16.20.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 May 2025 16:20:22 -0700 (PDT) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org, anjo@rev.ng, Peter Maydell , alex.bennee@linaro.org, kvm@vger.kernel.org, Paolo Bonzini , =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Pierrick Bouvier Subject: [PATCH v6 03/50] meson: add common libs for target and target_system Date: Mon, 5 May 2025 16:19:28 -0700 Message-ID: <20250505232015.130990-4-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250505232015.130990-1-pierrick.bouvier@linaro.org> References: <20250505232015.130990-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1031; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pj1-x1031.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Following what we did for hw/, we need target specific common libraries for target. We need 2 different libraries: - code common to a base architecture - system code common to a base architecture For user code, it can stay compiled per target for now. Reviewed-by: Richard Henderson Signed-off-by: Pierrick Bouvier --- meson.build | 78 +++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 61 insertions(+), 17 deletions(-) diff --git a/meson.build b/meson.build index abdb2cc33ea..b2c79a7a928 100644 --- a/meson.build +++ b/meson.build @@ -3678,6 +3678,8 @@ target_arch = {} target_system_arch = {} target_user_arch = {} hw_common_arch = {} +target_common_arch = {} +target_common_system_arch = {} # NOTE: the trace/ subdirectory needs the qapi_trace_events variable # that is filled in by qapi/. @@ -4081,29 +4083,59 @@ common_all = static_library('common', # construct common libraries per base architecture hw_common_arch_libs = {} +target_common_arch_libs = {} +target_common_system_arch_libs = {} foreach target : target_dirs 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] - # check if already generated - if target_base_arch in hw_common_arch_libs - continue - endif + # 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 - target_inc = [include_directories('target' / target_base_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: common_user_inc + target_inc, - implicit_include_directories: false, - # prevent common code to access cpu compile time - # definition, but still allow access to cpu.h - c_args: ['-DCPU_DEFS_H', '-DCOMPILING_SYSTEM_VS_USER', '-DCONFIG_SOFTMMU'], - dependencies: src.all_dependencies()) - hw_common_arch_libs += {target_base_arch: lib} + 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 + 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 + 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 endif endforeach @@ -4276,12 +4308,24 @@ foreach target : target_dirs target_common = common_ss.apply(config_target, strict: false) objects = [common_all.extract_objects(target_common.sources())] arch_deps += target_common.dependencies() + if target_base_arch in target_common_arch_libs + src = target_common_arch[target_base_arch].apply(config_target, strict: false) + lib = target_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 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] + objects += lib.extract_objects(src.sources()) + arch_deps += src.dependencies() + endif target_specific = specific_ss.apply(config_target, strict: false) arch_srcs += target_specific.sources()