From patchwork Thu May 1 06:23:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 886303 Delivered-To: patch@linaro.org Received: by 2002:a5d:430f:0:b0:38f:210b:807b with SMTP id h15csp174324wrq; Wed, 30 Apr 2025 23:26:34 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVoMZPpQh84JRLxC46FobUvpHYqvDMsTOZxK5nWegnKsButrDhEyPThpxQsNH/qI5LqesT+jQ==@linaro.org X-Google-Smtp-Source: AGHT+IFh+QrQmoiGLOkirjiLKmXmkXJEM8LRVOkWfedVcZyYJAHTCSIT0VQCdIocc6NcNjueLTUr X-Received: by 2002:a05:6214:234f:b0:6e8:97c0:76f8 with SMTP id 6a1803df08f44-6f4fe088873mr80514106d6.27.1746080794013; Wed, 30 Apr 2025 23:26:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1746080794; cv=none; d=google.com; s=arc-20240605; b=jJSQd3H7RJq5sMCFQ8lKfgKiO2yZRFTsLnv/xB7693DUo05NQzsfOA4OOVs4odWo53 yob+TwtsYTUX+esd8eecJZ+O91lCXiHF3cNKAre4lk5bdp6VomJafYEMLRJwZpdCVtf9 /aTj3Iyq6c7NX1E6+5CoEhk9e5u55JMMDPwRlfIqba7zPNcez5rUilnZWkMNNKeWGPtM PX5B6ijdrK8pYpINQmMvgaH/eGp1GtRZFkCV9EMb6ForVxiLXywtnxlnGkoKQxuKVwoE Dzz17INuOYCcutMmj+t/2S+kXMOLQzQPtgNTKElQDJ22kYnT74VfZ+qrv+mOWyzIc49X 6EEg== 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=wRQcX2zj5rKRmJl38W94XdQVe0UW4OEH2J5EM4DWdNo=; fh=Fszn0PKjr1lTJ9agfldZI0BguDyTJI4MYSL4G/fcmsE=; b=ZF3Hn24FHL3lBt4orNHOugqKtXCRnes608k82TAGq4WeNod1gZYDQLjgRfq2OczbOT J8v6JeOngCNt/pP9mffkIraX1KwcLREAAfaL2++N5w5/WymIdlrw9gVq8BcYsmU7CdUW OoD3/Ns6ozOU2M3XaqQwm/7JzBbbo7XM32iowh3Y4kRUQcbOxcmZqD8DLftfhNHJS/Eq c8GK5fEJut+c//IypWXA2M9xaYfYM9WEP9SAbVPozjEM3u+WEZO2t6mdD/+X6zY8HiMp H5SpU4dMJix8P2PZbBTfrS0S4y3Daow/TGrojie8fUUMaDQV5PTl+LKJgZJC85JpO3xD wzUw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HiTM8Hat; 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 6a1803df08f44-6f50f490746si920996d6.354.2025.04.30.23.26.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 Apr 2025 23:26:33 -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=HiTM8Hat; 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 1uANKz-00059X-Aa; Thu, 01 May 2025 02:24:01 -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 1uANKw-00057A-Cy for qemu-devel@nongnu.org; Thu, 01 May 2025 02:23:58 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uANKt-00071C-IJ for qemu-devel@nongnu.org; Thu, 01 May 2025 02:23:58 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-736ab1c43c4so675846b3a.1 for ; Wed, 30 Apr 2025 23:23:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1746080634; x=1746685434; 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=wRQcX2zj5rKRmJl38W94XdQVe0UW4OEH2J5EM4DWdNo=; b=HiTM8Hat01Oqmm8OvFriVkakGU2vr7JXa1HLNhkeWhrPoU1zmPLYqnu9issG1cd2a4 PBeZfedpe/ybK32vhXRIh6QZMfe6PkfnDgt84tdzf/HY8JnTUGiY316FF0f7rINoSyEv 8w0vGwbO4dJRq2/QiUcIwcy9dDrtj5M/Qltmw4cESQzd20YKN29xUDN5aFC1ZKUiiy+v HkbArrWEFOmuM2YU9mSpCtzGT7QFCHRq3j6t1iwqPrihzTNOx47xcnfpezM2iSPeEN8r MnNU2OWgLFprFoeyRpjS3wzw088hZcF8W7X2D5ranY6DgKaMBoQRR+wvjXE3P5i7GZUL tJVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746080634; x=1746685434; 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=wRQcX2zj5rKRmJl38W94XdQVe0UW4OEH2J5EM4DWdNo=; b=dAuyn1ZrDBaBWcMuWMGsLIlNeoN7qjxJSN1VavqMcLReSnTR+KFvRaFrko/BAx8b/V x+BwEMAU3AS1YW9lRDYyhoOrc3pF+igImgbBx/FTanleJxI5Ybudo3YF5eeOnQA2G9Rx UxHHTC2w/WYTDaPYDtLr4k8/tr16tnRGy43stgeEI5jdL8es1nEkmVDOdKnu+HQFD2IA rDsk/sxeWboaIPxbhcS3SDbjM7OWSxJEUl4VLcn3SkQKACpFmfI9xd8nNQi/2szhMdZy +A0lA33MpXy1pe9l4H0WA/RYbsWWdBIqSeXPZbVl2LbFnw9P+TQi/UAjTeahZwgmjgFq Vsyg== X-Gm-Message-State: AOJu0YzObQi9+ux747C6RFHRD1YZbb3ou+8IABoJv/iJBElcdPWpcjIN Ar4DKnVZZIKEyVp1AlxHwUy1CcXDlbHAM5aRtSneEEaFydBVkoMDWtsWK7Z5DnKZ+eaDxvmdPY1 N X-Gm-Gg: ASbGnctQAgr3u+2d6XqizOkUESAZPzDxv8xbcqWGnzbp8dy79uPpwzbjYyOHH3xy1gv 8qN0sB9rT7p3UH7wu2i7jMtZopGRGhN9ZV+Ntr+I5dfzU/ZLJ/cEn3xlWwNl+GtXEYWiNq5fJDB nsSNfqCMNhMnlp0brYtNYrnTLzBjsvPJhaCeiUtxLkxbwJ8hXuoOG+lKJlgRBWOjWq7oWorMvuz JqtyRWhGbnkxl03Trj7dZQIJxWfTFWd/eS/aKuZTE7bT0CG3Ivi64Ut112V4T6hphGesTYoJNG/ yv7ttKHfoWLzt/q+ieGbLDMeCntT2AQBsazcVUVq X-Received: by 2002:a05:6a21:1788:b0:1f5:837b:1868 with SMTP id adf61e73a8af0-20aa4380499mr9068562637.29.1746080634113; Wed, 30 Apr 2025 23:23:54 -0700 (PDT) Received: from pc.. ([38.41.223.211]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7404f9fed21sm108134b3a.93.2025.04.30.23.23.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Apr 2025 23:23:53 -0700 (PDT) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-arm@nongnu.org, richard.henderson@linaro.org, alex.bennee@linaro.org, Paolo Bonzini , anjo@rev.ng, =?utf-8?q?Philippe_Mathie?= =?utf-8?q?u-Daud=C3=A9?= , kvm@vger.kernel.org, Pierrick Bouvier Subject: [PATCH v3 03/33] meson: add common libs for target and target_system Date: Wed, 30 Apr 2025 23:23:14 -0700 Message-ID: <20250501062344.2526061-4-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250501062344.2526061-1-pierrick.bouvier@linaro.org> References: <20250501062344.2526061-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pf1-x432.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 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()