From patchwork Thu May 15 10:25:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 890153 Delivered-To: patch@linaro.org Received: by 2002:adf:fd8a:0:b0:3a1:f579:ae88 with SMTP id d10csp3058730wrr; Thu, 15 May 2025 03:26:58 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXQU6NftpMFdaR4hcNRRT5MRHisieZdytEc7X8hVhdKat88GaFdPVIc38GEGSDt/V3qbnEkpg==@linaro.org X-Google-Smtp-Source: AGHT+IHu6Mb/Il9ozBXpQS6saVawb/Ap0vX7H+vZ3o1WL0mpjP1zggkmUnwUpXYPkHnv45JL9v/a X-Received: by 2002:a05:620a:1918:b0:7c9:6531:53c1 with SMTP id af79cd13be357-7cd287f8d5emr850228385a.26.1747304818297; Thu, 15 May 2025 03:26:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1747304818; cv=none; d=google.com; s=arc-20240605; b=JJ7JX2m5z5bveRwYA0G4RAF+1Li65SBIy3PDfz3VZNL3HnFvmLpvo9yMndwhKrkq8k mz+SieZuB+DRA6JCFDmKsmc2UUzI5HQdinKZq42emRBPI8CAp+sRdWjRkXyqDlIsTx3E 9n2TSoLx1HpUMsnj9suQBH4QLjOv4+3yOW/j44ILEaBpVBkmXPH5MReDomW3FqfHx+uK YnmtTSVay/roDwR54k32OvbWegZ7ysqUlrdGYwzmVKCJ0VsQbUwMKKFz/xRtmQgySJ7E f3vDeV6CLIzRzmd//9txEe/GoEGBhDmeRryh4xpisnze8uSagNCW5b4hFDWdy/AqX0Sb Vdow== 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:to:from :dkim-signature; bh=+fk+E1hNI4ene4uIKK/hnLRnqA1uMFK4Q9d7SpDJgfs=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=lk4MDBGUpff2oKVpE85Sfgip4I9L6Fxx3c0Jf0kjSpj/2nhTChlm9/mPfaCKH4ja6y 0uC4n/6zjdAVOx9sPqrXooCTBkrG6SGkp8viGQFn+bgmMc898T3Jyk51ISJ8uKi1HEmF pVMGHbStqAqy6MIXWyz9E5pBn+aFPULYipKnCcrZJz5OUEa0jbd6CJxTRgizm8/xnFzj 2qcO6x7D2c747j/uaUS7rdL7n/D5VDRuLo8dRr1qHtECh8K0qs1FGfgJ8cRdlkI2hFDr Bv+fHOBHyxID8PMt4EEnuuyQ9FscADhbK9mT44PgJ9n3xInZTbmY10CHSvDOXc0gXpmE OS/A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="QT/4dH0C"; 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-7cd00fd4519si1638587285a.304.2025.05.15.03.26.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 May 2025 03:26:58 -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="QT/4dH0C"; 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 1uFVn2-0004Qj-RL; Thu, 15 May 2025 06:26:12 -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 1uFVn1-0004QM-3a for qemu-devel@nongnu.org; Thu, 15 May 2025 06:26:11 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uFVmy-00089E-Os for qemu-devel@nongnu.org; Thu, 15 May 2025 06:26:10 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-43cfba466b2so8369085e9.3 for ; Thu, 15 May 2025 03:26:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1747304767; x=1747909567; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=+fk+E1hNI4ene4uIKK/hnLRnqA1uMFK4Q9d7SpDJgfs=; b=QT/4dH0CRGnOn4Q/ecROuTXpvzynOWf3ZOX2+2VcvU3XVEwbEq3N4wuzHD0FxK33j3 zIIrI4908idSjkWCmxPzBECyOl9afRuG1/usXFZpTy/kRztyK2BGPg0UKSNHFYppqeu+ pj+TEez1XcDLuSP4RzrWq1CFjJKMo6PEK1ngXNbBGPV7h8V5Hb6J9uxKsk8zqQk2fGWr 9uVgeyaeUiX/Vmz6kw7i8t8UbD5RWMSrgdxi5iDOqCGgZ19tXzxxCTvZ2yFmORlLLijJ twvArvSbkNmvW1uODP0ZMgLSIVD42lxYIxcnREz5rdetLj9qdgy4tvOJqD/34hRkDMHb hisg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747304767; x=1747909567; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+fk+E1hNI4ene4uIKK/hnLRnqA1uMFK4Q9d7SpDJgfs=; b=jlDt5r2HauqByIKyL8VaiNQ2Gvm8QTN81+TQhdz9Tft6kSh1L64tHBw+46Iongyida SjNUbu3gisIbZy0jGvNB7B8AXhLkUC9buKzBAF20W1PVNMSikrI5C2t3SHlzPwv3Ns7I nBa8bauFLpYPZZMoq/d+Qq1tHFG1SWsz+IISu6BfkhdDJ9FfWL2ijiieBkFyf7ltIxxV u3fG3Ft97OhFzgoY9LPf/PCqjirtzcTbYsOck3W16n3XmszS5BAl+hv8wk0/D2Aa6klk /gacRxgJHnDrvbNJozCAfMSeny956ySLt3EVYnx0Maa6QGO4585q/N05NzaN3KHvITc2 7g7Q== X-Gm-Message-State: AOJu0YzeZpqz3P9kLrbji0ZoUD7r8x55ZPhi6htz/3KpLD7KMMqcdHVb hFQaLpXdOVZfSuVjyOMyRoIu3He9Yn/e2lL2QdO8UuWad38nh7l8lqv24zkiBAv8h2z9mFmFG05 KKKI= X-Gm-Gg: ASbGncuky1d3y77bCo8YUAkFc9kGVpHD3gcnRQGTM77l0qm6VTnY0QwAbLo9jPVjVd+ kzSpZ5EhPEBgPmnWMIONaVNRhNtlWB4A8mpN9LfR6U/5sm7/wVbllPKayZjcyKAQKVjoCasUdw+ 2Mt5EhT6+eKGufb3uIB6rsML0vclcwbeVgwINrdpi9MVZaQx79vQpm/Boxf4ttqSARYoZp4i2of THTtLDWTEACBTRuKOklFyvu0frQEPLCNWgCf3TrFn2w5y28NvxEq8POoCZFQMm9+qPXpmnmUGmQ syy1AQVeTaj5n4p35u0woY+M6637ulZnD3cws4Y5L+mjmi6fHHQG0V3W5g== X-Received: by 2002:a05:600c:4e09:b0:43d:1b74:e89a with SMTP id 5b1f17b1804b1-442f96e8949mr19588185e9.9.1747304767095; Thu, 15 May 2025 03:26:07 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-442f396c3a4sm65657855e9.26.2025.05.15.03.26.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 May 2025 03:26:06 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 13/58] meson: add common libs for target and target_system Date: Thu, 15 May 2025 11:25:01 +0100 Message-ID: <20250515102546.2149601-14-peter.maydell@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250515102546.2149601-1-peter.maydell@linaro.org> References: <20250515102546.2149601-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32b.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 From: Pierrick Bouvier 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 Message-id: 20250512180502.2395029-4-pierrick.bouvier@linaro.org Signed-off-by: Peter Maydell --- meson.build | 78 +++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 61 insertions(+), 17 deletions(-) diff --git a/meson.build b/meson.build index 7f91500bb73..ad2053f968b 100644 --- a/meson.build +++ b/meson.build @@ -3709,6 +3709,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/. @@ -4107,29 +4109,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 @@ -4300,12 +4332,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()