From patchwork Mon May 12 18:04:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 889365 Delivered-To: patch@linaro.org Received: by 2002:adf:fd8a:0:b0:3a1:f579:ae88 with SMTP id d10csp1739470wrr; Mon, 12 May 2025 11:07:15 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUA6lTFvuIs+2hJ4IWaKrfQf+dk5Aev4qNaY6R9zHE39qbhUiXylUSfeGpTqZBuBrVoA2Z/ew==@linaro.org X-Google-Smtp-Source: AGHT+IH20ake2X8Fy5YzHbeU8Py2qSqxbBXh+0WY+w4tHC49exiEf09+l827AAcFlDDxTcMv9BVT X-Received: by 2002:ad4:5aa5:0:b0:6f5:436:9e46 with SMTP id 6a1803df08f44-6f6e47c77eemr221047546d6.15.1747073235498; Mon, 12 May 2025 11:07:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1747073235; cv=none; d=google.com; s=arc-20240605; b=blYep+bzQnOHgEk/282YBPM+FMEQAAlHIEKEplPLY/XodPuBHqf3L17TYqEQ8B1NfR fL0QdqC3EQYGy1PvmSTg9FmP8pTo70GoGOvs+NQJd2bFJesV4HxQ+AQXnoFWjSJuyTdX G4s16nStfFI1cP5oDNCtwEncuSQQNDFt4kxPgCyxo3P/VlXPwnVmwJvjOwK8+MoLz3Cs QDkQ8gYkhRFaQulbvZ6mBWlUL+eTVp+j/71PGKeG5KYJNz0N0gAKQyvWP62c4KP6e0iV jqdJW2YSUYFO92LHnV09v8/prtHEAzEJHLOJ5I3xqV3IE+Nm3czH5q0mPM9JVq6g8wal no1A== 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=6FGLSZTqO/KSoe45Th2y1VHmRd/kN2aH8D38tKOyoXc=; fh=PlN3fUhDtems6Bb7y59zYD8EwBcqcc7pnzqldojq+us=; b=gNhrd+OY5ZJZhk1CLMANS8omdDbOfCDCE+qNr3DdQ5V4VZqE/WEVQFEjJyPuH1SgFH zchZXGrT+cfUzyIFbjoDeeMuIGzT8J3WWSzMtMrWHiMz6DRGtlKYV4bI4DKMhpGfQ0fS fsUyHaX2HyvZDZEOl1pg+oZPUWOBk7a+oABbR7BhF4Mvm75ZNgIIGFr4C6F0FW2033IV K3+xA/Drxbfu1miaQWY3Z42nkeeyuFi0wrVQRxANUpkpVVZwOqO3KsdqZnEhkZH1JYOd C3TwpP16++y9UK5jlLuxXk1V3V4aK4dd+XVVGUNSKf82ma+/RA62iOYtvL1bVPen56E4 tD5g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=InRn58Ct; 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-6f6e39f7555si97547886d6.119.2025.05.12.11.07.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 May 2025 11:07:15 -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=InRn58Ct; 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 1uEXXD-0002uV-W2; Mon, 12 May 2025 14:05:52 -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 1uEXWh-0002EB-VJ for qemu-devel@nongnu.org; Mon, 12 May 2025 14:05:20 -0400 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uEXWf-0008R4-6H for qemu-devel@nongnu.org; Mon, 12 May 2025 14:05:19 -0400 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-22d95f0dda4so55838925ad.2 for ; Mon, 12 May 2025 11:05:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1747073114; x=1747677914; 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=6FGLSZTqO/KSoe45Th2y1VHmRd/kN2aH8D38tKOyoXc=; b=InRn58Ct73V8ZtvhBfV4+Q/WPe2hW1G9KRTxm4lAznSHPgRQs67noP0hYe5v5znOvF +C3xj1cDnAYOzc+ci3A8VeM1MrD+pgGbKjQkyITI32ZvpQUMufGyfWkqok3N9iooP9BL L37N9+h5DIpdVZhfzcgtjeNMDeln3Kkg1UvuE9qBpLZIRcpX/crMmXwVZhVX7n6+NLEl Tx0+a0mE9fgbvHSY8/jW1jsE8O/b1stZYYBwL1fynwYbo12XKsOlqSNpLByOxxdinP/f 4YukqXVdc/ZxdWyqwV91b7W06lA3xzaKoLyGxqdWktjaf7ejvMh3bL1fHzrqEG+Uzg2z aa9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747073114; x=1747677914; 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=6FGLSZTqO/KSoe45Th2y1VHmRd/kN2aH8D38tKOyoXc=; b=pX4zNJv6dG/FSuK2+F/+5PxgOR/da181q4o4NqH/ryY/JU7pGAwqBx24AXp9tvvS9G iC7qwpU3w9Ij37mbflEMaki4sUzb9+i/vH701DfZ8tOK8akXgXWqdVtug+TiGmg2RNnh iPSL6/wdoOioUb9kk5MsqGSSj/HLOZCD9PSjcoIh4hXJakajYprJDynxreNPcLP+e2JU 9X6H/mKnu90kocZ4zD1XuDWqvQMcFH7zoGQbCMrrWDSazD503rjJHTvmQVSD8nnKruEt +UOi7cXzueReoWvL3wC41EmhmfV0H7h8EOiFzWpYdT+j+y3nyuzmpQMiMM7ec/4BVhcq raHg== X-Gm-Message-State: AOJu0YyNwEwafco2Lxvjc96jZyqjZqamDAX1yZgjcuFKj8ciidn5fMDz GJBpKA8+Z9UnWL5LShl1V06/6ankzXhL5ZeL5MZPDmlbyBx12txCBcMqHAwqznNdYT/4hpkvQ9I O X-Gm-Gg: ASbGncuO45Ipg+SbP+9Jqj+hLVUwF1m+8m2ByV2EDfmTHLnH52xIsKUO/+hHkxW1iYy AKH9n1aK1g08HA+v9fvg3gKjsaGDPzd3Y1grEQOK0Fgj4YolltYyt1+B++zzEwprn/vQxCVx9qS aSHUnpAy4NVH4wguLsSvbpE/F4aVnjBqaWe/DysPpu5npKL1Vc6qy+yVqLVWxA0350PksccF24L Gwf5ueCkceJQqqb8a0gUjDBY1egHf407UYUBMAXdyVnppL2F0cj70THgEZYR0VqG7ZeW95kpBwN crYMyBoiWI8mPgJQqt/0MJloIdm8PUq2Y8Zuz+EGyBUe4yMGViiROljjNorsLA== X-Received: by 2002:a17:903:98c:b0:22f:9f6a:7cf with SMTP id d9443c01a7336-22fc91a8c92mr188920805ad.52.1747073114488; Mon, 12 May 2025 11:05:14 -0700 (PDT) Received: from pc.. ([38.41.223.211]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-22fc82a2e4fsm65792005ad.232.2025.05.12.11.05.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 May 2025 11:05:14 -0700 (PDT) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , kvm@vger.kernel.org, alex.bennee@linaro.org, anjo@rev.ng, qemu-arm@nongnu.org, Peter Maydell , Paolo Bonzini , Richard Henderson , Pierrick Bouvier Subject: [PATCH v8 03/48] meson: add common libs for target and target_system Date: Mon, 12 May 2025 11:04:17 -0700 Message-ID: <20250512180502.2395029-4-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250512180502.2395029-1-pierrick.bouvier@linaro.org> References: <20250512180502.2395029-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pl1-x62d.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 bbcba3a84a1..bdcde9746c1 100644 --- a/meson.build +++ b/meson.build @@ -3706,6 +3706,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/. @@ -4111,29 +4113,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 @@ -4306,12 +4338,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()