From patchwork Wed May 7 23:41:54 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 888143 Delivered-To: patch@linaro.org Received: by 2002:a5d:4683:0:b0:38f:210b:807b with SMTP id u3csp632929wrq; Wed, 7 May 2025 16:46:11 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV/GLbf1n/oCqYL4n9j0hPk7lTWKc5UbuDyanx9bXgz/AbEsooyMQRRgTfrkaVzwtkLD4REPw==@linaro.org X-Google-Smtp-Source: AGHT+IGy3eHOKFufw66/PnJWOmfdbdt5yRcEHLMZrsPu4fOm9xwR1BAw1iLAjJ9i+X/m6VtjOsWq X-Received: by 2002:a05:622a:144e:b0:48a:582a:64f6 with SMTP id d75a77b69052e-494496215a4mr16368061cf.40.1746661571273; Wed, 07 May 2025 16:46:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1746661571; cv=none; d=google.com; s=arc-20240605; b=RtC7EviLaH1kzJVsHPme1lHCsLf9ixfyKdo9WF8ICyeZ1mGuCPPut3u67gMS6lg862 akMwlEGm3HjXiEGJu2dZ+PcgIsLPCDD6AQCXP8y77EaEHc2a7EPAFUMyoroHnIxogwSe UBQpuAbuRP3gnjaAOOdUIfOPIPwRTGWZUDXXMCCiO7lY9gv/ld1Wuc+tD8sZ/AOLQyJD RAuxDsIhJwup+eRRER2LtmA6R6mCBkrF+0x4EXuib0wBGFvmJJAAZIguL4sKBgWvEljU uhGIBtUFi8H63iMl422bcXddhNkP38nNS5q9VGMkuKAude/Vp5rBJ3fskRAUhgngPDQy PjTg== 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=HNFwc4Kkoc5DDFWduHklRzCXnbc7NeJWvJ231SivMc0=; fh=Zbxy5TRiDd+Eff0zsN+2XmZYe/TihsWpxb97dHV4h78=; b=k6phF05UoYqOoWMnbyOmIsDLyYJ/td93wDJkh25RaeElD2GFZSw+5qcpnqV3/QNyPO DlvoOcG4+LbEaZf4yVGhTwwkTw3U7hZ+9SPIuQ4iNnQ2oBIzkpPlwy5LBDL1soJWlGK7 W8kdjXrC7wzmioQkzXy1P/YdRIJDma1LIq83vAZp9dEWK8EAZ2FmGWKVFffFMjx63iox JzXkYCbKcaR+Zjz02c1s+pt7S7+CaBLubrXd4E0d93l9EF9Bk/Kj56VOX9NWPmTQxR7A lmjA5AxAHiFC+jR7lvdP345Fb5rKzB4dP/r91ZifWK8eDvMe95UkA1goCxxkqs+7O+HS MghQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ig5F4CFb; 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-492229a6a09si31192441cf.308.2025.05.07.16.46.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 07 May 2025 16:46:11 -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=ig5F4CFb; 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 1uCoPh-0008H5-Eg; Wed, 07 May 2025 19:42: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 1uCoPa-00083f-Oz for qemu-devel@nongnu.org; Wed, 07 May 2025 19:42:50 -0400 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uCoPX-0002QJ-Ep for qemu-devel@nongnu.org; Wed, 07 May 2025 19:42:50 -0400 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-22e4d235811so6439645ad.2 for ; Wed, 07 May 2025 16:42:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1746661366; x=1747266166; 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=HNFwc4Kkoc5DDFWduHklRzCXnbc7NeJWvJ231SivMc0=; b=ig5F4CFbu13KYY5xwpYyxsAQXnTDznkQcGBaYN0+gFLPbZJ8yDD+97csC9jyw1/oM8 PBtSBS5yDXc7Dhk70iWtFMmToIG5vEO8YheHYT107MPQUTW36n6XumErK4tjRWaxKkRq fHybV4yTLle3vRFmeu1bPlKkZr4IkA0vlLB/Iqog/D2WukZ+7Mz95wY2VXcsZzX8IgzC JSr9MZe8OhsRfRQ5aGWj3qsbOLME1qG8KomFIdrNvPfPG50H3sVF8oYGLEYqtgMeurcW xygsSHoFl0PRy4QsLDtHyR2NAv5eODjussR4Jb3vHma7rCp+8uzkPOS7sE74iynX4iHx kb8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746661366; x=1747266166; 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=HNFwc4Kkoc5DDFWduHklRzCXnbc7NeJWvJ231SivMc0=; b=D2ZYJwpleM2ocWWaFD3Lfgfu5uzUBVIIIfMm3KrcGuIe2W5MAOnMlwt8DIUr0GUrWg d6zQftEyAYzRaz0rY9N2ml3G1frmm1SJgrl4XjKTTxO1PYUD7Sacgb6jSHQ2+zVBYGa3 2GkPYq6yd25I5533OrRQgJjvC+TgAPgAiGDrFeDfRExApMdv9kDPN3Q/5Zfz016ddBEx vpLgY3LdLYlCnqRSA5T1RyHVTF7isQmaJNlL/FYQOP/QklNYk+dSaBWRaGhtAL7hy1+f Wl09sHy370xq9MzWcSOQWf4xhBGRLZ0AqD38hUqQZsSDXbD7iiy2mI+oUbnkdleT70Pq 57aA== X-Gm-Message-State: AOJu0Ywu2eT+HECqh9fjnfLyhEirsxefG/e2w8jHWFFPsX29QtEVMlrG PvLjzd/FRpNQaolVgc1/eRs+DjLteyp2/tMD7WkFgFQZ+eYU5k1SmN6XiVkzUFr9SydHm+MQWZc VeRnu7A== X-Gm-Gg: ASbGncuGtmFxVKIQZrHkyHgPWPRve8tsVDbssjiqazjeK2R9rgmpAfl/VD87lwy/ecn i/ZIZaTB/MTwgAt0QJu9pAAIfKahyBtRAVoQCWI67WSFPsQLa75S6Ejb9Dodsy7Hs9lgbHEkTKg fL76W0G+18KylXLmluBHlkjx1WxIU8TnpvI53NWFS6aFHRjzYzF5uznGqu/uJ+oCenNuwgdhrfB Fm1roJGbORXVGiMyNPQSZnJyMov3nISJIaW0onxTykIG6RtuM3fPsiZElLjSGYev1WF5TAVl51l uNO3/L89XrrFLn1LE5de5zZ1Fo1d72d9/1FVAxRi X-Received: by 2002:a17:902:f682:b0:224:13a4:d61e with SMTP id d9443c01a7336-22e9d1e2bf5mr15945275ad.51.1746661366112; Wed, 07 May 2025 16:42:46 -0700 (PDT) Received: from pc.. ([38.41.223.211]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-22e815806fdsm6491325ad.17.2025.05.07.16.42.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 May 2025 16:42:45 -0700 (PDT) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, anjo@rev.ng, Peter Maydell , Richard Henderson , alex.bennee@linaro.org, Paolo Bonzini , kvm@vger.kernel.org, =?utf-8?q?Philipp?= =?utf-8?q?e_Mathieu-Daud=C3=A9?= , Pierrick Bouvier Subject: [PATCH v7 03/49] meson: add common libs for target and target_system Date: Wed, 7 May 2025 16:41:54 -0700 Message-ID: <20250507234241.957746-4-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250507234241.957746-1-pierrick.bouvier@linaro.org> References: <20250507234241.957746-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::632; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pl1-x632.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=unavailable 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 320dcb3da19..0609d586a74 100644 --- a/meson.build +++ b/meson.build @@ -3688,6 +3688,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/. @@ -4091,29 +4093,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 @@ -4286,12 +4318,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()