From patchwork Tue Apr 29 05:00:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 885714 Delivered-To: patch@linaro.org Received: by 2002:a5d:4884:0:b0:38f:210b:807b with SMTP id g4csp144061wrq; Mon, 28 Apr 2025 22:04:25 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU3q1D1BMnB0BCa1sJMWfr7C2Ll18riLBY8QOwlYgwR1oVCoTaAnY2NuiXhDt7I65F4NMj2sQ==@linaro.org X-Google-Smtp-Source: AGHT+IHikS1KE1NIJ4BtzfFGP/gGi9zeRVomP8M4YX2OXD89xKLURnB4tJSzmgnK0PxMN04bWK+S X-Received: by 2002:a05:620a:2a0b:b0:7c5:65ab:5001 with SMTP id af79cd13be357-7cabddaf233mr299807485a.39.1745903064761; Mon, 28 Apr 2025 22:04:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1745903064; cv=none; d=google.com; s=arc-20240605; b=iwGtS81GG8odXD28VmrjxF+eTRhwvuenWaX1Ls4l5Bg6uo7pjghdhsdLezdMnx2WIB KCsB6rcn0ixaSpDgBiInOC2pNTeM2yp4br6Q86BopKv0VfetF4DSacpuAb+twgOcTY6+ 6kMNvwI4n3ucAnWE1HOjpfWmR0VLw9hSBnJ2IqBE9Y+6tUZKrX/AfzT6KOACbIc1Qahq MWL6gX0p4vpZKTF+61xCHYrzjEDKTAlEog9u2Zmn9NQC5ANOSubLk0B9Az8h0uVFs+/R JvlWVjkRCzzb4ofHAzqBZ5ErrCmj7F+kTSR6N6j6ajNmD+KRPvE7zPRmn4TFXFYL/Z0K PWBw== 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=8aXdmB6f6CJf71wSR2HMNjOPhUhdvY7cV28foawZJTI=; fh=O4yhk4V8tvPJDnLnyAX1De4ll2cui8YfCZlHtNTUPp4=; b=Zpw5+aiUFlS2LonaxYkPtFc3+0wYD2ZG1hgXgidWfjrj2MWpCXPXpXJSps1rJBW4lX tGZZGnSQ9n3lvRnWQ/v8ci4Fi06kS7HHDja1l1pOe/u8PQG1UqoQxZPGWHxeT55WdMPZ kRS5flXORoy04JCaHEKlCWD+bGMRW7KWpQZS/tqCw/R3Uc8V+aU89pU/pLRgNz9OaSbC Na+EerctvvlyvSJHELs5rJCkmMk8lqYcrdnU4d98wIexjDRpHWoMySF++zC+iTRv0eW4 u3lJbagFGAmVjSmHck1ROetRk2XBpPUuGhTp2MY/cNGm7C9SgmN5BkHWwUZzGvI04PVi DFSg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pGdyrq50; 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 af79cd13be357-7c958ebf669si1135211285a.582.2025.04.28.22.04.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Apr 2025 22:04:24 -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=pGdyrq50; 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 1u9d5V-0008GN-BO; Tue, 29 Apr 2025 01:00:57 -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 1u9d4y-0007YT-A4 for qemu-devel@nongnu.org; Tue, 29 Apr 2025 01:00:24 -0400 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u9d4u-0005yh-NZ for qemu-devel@nongnu.org; Tue, 29 Apr 2025 01:00:23 -0400 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-2254e0b4b79so83235965ad.2 for ; Mon, 28 Apr 2025 22:00:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1745902819; x=1746507619; 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=8aXdmB6f6CJf71wSR2HMNjOPhUhdvY7cV28foawZJTI=; b=pGdyrq50SHI3RLHGUFTJcmvGAlIO+wecQZJEOOY11FC7+pex9zdvqdQ4mEttice7+N 8ovxiQn33IB9F97iM19UMt77Og7llW5/gDHr17wrJhcop/8UOP/FiCox11C15vt8nVYX v9PWQf635qpVXNCq0zZoNLmD83XCHhOtNkro2SAvx+qm80WCTjTxFY/9hiVpz30Qg5lb goqvTfAwK23Enu/0TvkTM0t6uQnPiaUXIWugBjZi9hIeftlEcRLc1hVVYvOoHlNXHFH2 zJgkObOROwdhSKDrcN+Ej6eFarvYm0+PVPCAhQTRJseahKJzqCj2Xd6/ILRSG3mkSuaL 7Ybg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745902819; x=1746507619; 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=8aXdmB6f6CJf71wSR2HMNjOPhUhdvY7cV28foawZJTI=; b=AW8xnVM5Zwab3sLu1MBT9tiHtmYTbzXDMnL7j1MA0a3wzJRXEepU0MQ2mdDaWVXlee AmTyhmNe62Q7ujTBwksN1YASs7bOMKw9Sdc8YahlhWfb/OSj58fdRfCCNZ4AiCsOunqY vJOA+iPTKY++QvwXN2pkDBogUllULuXgv0o8WSkmexnMJbp22c+bnBskyka3mUlocSmH oONIiolmSASusp8MdrXnxAY1O7IFsuzx4XzTTK3qjZaSf5Chb2hNHLy51uIqB0nUqLZ5 UYTZvMfrMzxUOOSt5Je7+svnp0jMqmXIwNeVCtJDmItDAjMGjjkQHZYJFxjE8Tp9lhMW dxDw== X-Gm-Message-State: AOJu0YylP4hOEnmeI+El23u1dgRvftCj37ucqMjem9nHSJP2eYZ4bZYi IvegfBWm/H8pQ1p5KeRRWEdGZWBytK0J1vhgv1RCeS9XWsD7XEtdj5btiCXSjp4ped79AE67+EN z X-Gm-Gg: ASbGncvZAslBbsLRJ7MjVOkKr5QHSXvGN6jfoKe7MVJzNIcgC++a4PP8L8GpgPIVm7q CABQP8ViJlsAqgvB/Romr4x0iIuiwrY0I1y02DEf0FpKwbJMEO3lcca4alcE2NT2NSjaYW4BLWb 9BGL/DXEpHIascNLeBo6pnKj1TJ32yRFzOQ3N8WW8Gcp4ZoHJStTirfTGVEFstha/tAahMR5s9T U5rj62s/aCwSTNRy0TwivQX/LmeJVS9zU0OkHKD4qZtje5+U9/YmKOr/JFwosL9PK9x+hkdNkZ4 s58oE6H66vQ5KULQ1BGqQpb8gGU/cSvxSJ6D7Z73 X-Received: by 2002:a17:902:e5c1:b0:223:377f:9795 with SMTP id d9443c01a7336-22de5debd13mr36357395ad.0.1745902819112; Mon, 28 Apr 2025 22:00:19 -0700 (PDT) Received: from pc.. ([38.41.223.211]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-22db4dbd6f7sm93004015ad.76.2025.04.28.22.00.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Apr 2025 22:00:18 -0700 (PDT) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Peter Maydell , kvm@vger.kernel.org, alex.bennee@linaro.org, Paolo Bonzini , =?utf-8?q?Phil?= =?utf-8?q?ippe_Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, anjo@rev.ng, richard.henderson@linaro.org, Pierrick Bouvier Subject: [PATCH 03/13] meson: add common libs for target and target_system Date: Mon, 28 Apr 2025 22:00:00 -0700 Message-ID: <20250429050010.971128-4-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250429050010.971128-1-pierrick.bouvier@linaro.org> References: <20250429050010.971128-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62c; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pl1-x62c.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. Signed-off-by: Pierrick Bouvier --- meson.build | 78 +++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 61 insertions(+), 17 deletions(-) diff --git a/meson.build b/meson.build index 68d36ac140f..7b2cf3cd7d1 100644 --- a/meson.build +++ b/meson.build @@ -3684,6 +3684,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/. @@ -4087,29 +4089,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 @@ -4282,12 +4314,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()