From patchwork Tue Sep 3 20:53:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 1980294 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WyyYR3c7Fz1yZ9 for ; Wed, 4 Sep 2024 06:54:43 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=J0b1PtAAUF36xz3QBcBRrwm1GH/2q0ArGjFRSWXdAi8=; b=qxDNRAGPIPfrCE YONkbLwYSXxdPjSHQ4uE6T0+XGs7K8xLECE0KV4sboodZuvXUnDBHQW5/icAeQnK/lu5VuRVg+/lY Wzgnu/BdY8HFvn5lffe3+vOcfGEYnsbnCue4eN0J0e0xnShmQ1QQKFGkudbMZpqAZepPJ+lqDvXEU AEHJeiKPA2MlWRycQk65Fc80Vl0NqMi9odvWZHUPn3XXa3PyCBJLO99I3W8M73leuCEHncCavDXG3 ZL2HsNCGqMvvyw2WisPvU0V/pQpJ/BVXA9ZgK2BIYVS2S0eZbEBUXKbUZI57r6hIF5vQck7AlbG7+ oxP5P10myLYghvuDWaRw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1slaXk-00000001sRY-34pK; Tue, 03 Sep 2024 20:54:28 +0000 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1slaX6-00000001sG0-3x8j for opensbi@lists.infradead.org; Tue, 03 Sep 2024 20:53:50 +0000 Received: by mail-pj1-x1030.google.com with SMTP id 98e67ed59e1d1-2d88c5d76eeso2443108a91.2 for ; Tue, 03 Sep 2024 13:53:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1725396828; x=1726001628; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=wrdWSxOgGclc6SWX32vFJlDH21gRjNh6wTPvD+Cslgs=; b=PKrqKzgmgjGvftuh2JAJzd97wHlmfZi3O3dmmnwQlZ02H7B/TrxacKsoT4a1MUqVuM CnjDvXhY+iN/Xp529knOEv9b8Gv1eSBC7DsrQAHcJqfu1+WOxcOTwXqY8i1Uc/xKJl68 XE7fTkhyQtKeqc8BsSvgLQzXlnjE6iQ3FEKvgBvD8B58g698fEEWQQ3jNWoS/8F2PB0/ lGxJbZw7LxEcLe9iw9o4B+yTshgH28IwYDE2RRPlD4iHFDCQghfhNp58OpwDwhyd9GAK 2yfsBn1+5OYm60MSDqfBURbm5uYhwfcfAPJZx6eHRjdM3MAXsaPEXlAAObzjn6krdonY AXcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725396828; x=1726001628; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=wrdWSxOgGclc6SWX32vFJlDH21gRjNh6wTPvD+Cslgs=; b=LllPcecxXXEUDejb7F1ODkt1SaZehrCsxKZTxh9VCl68OImGxCCEpqwVovgKqs/Vkx 6cDqQxHsi2RlCaFsBW5+2e4gZpEJ7sSXcC3C1D639mb+gP7xy+fwwtTqmMsjPZ6SDMWs Yto+7yb0wbm150d9SHdsPVHFkmR51J8JP0CV87CGsP7fbxmfz4tKv+keLmT+4WgKPQ8B oja+IflOlhsS9gY+jSQ2m6BR+dWrMrtwKlCklBEM668MgvdSxb+0iKZnqm4cyW9n4lWc mLBaOmkjwx/eIeaMySyNZEHR8w95aCUcQhdtk4rPOR6Ci61NRb42jp/XNIn1V5mB3MXA xewg== X-Gm-Message-State: AOJu0YxcuHZuTacFoOnakLGa4vmoyeHN8+ZS8uqptKH5AT1586miZcGj ecR2tkcO/xb2A0/th2MB+y2pgjVQAEE4s6y81kVBjIsy5rHI55OXAMxF3nqCMBqpMY1470EvO6w 1PCOvkKO4pN6SGRgoLQwGTd/OxCMnu/AaLNiVYA8FdLLcBXYMmpM3lukw/EuMwXPHgIXoQjzwfb qq1jtRnydmr0MDvAxJxD5bWaWMcvB00HK1m1+vwP1felwoM1aoMPU= X-Google-Smtp-Source: AGHT+IG3XiwwgRn/BBC0VvrDvCfBAtukxygqZ58dMnlIrMUD8BBJuNNbuXXV8ivGg3U97hth4zjTkg== X-Received: by 2002:a17:90a:3d4b:b0:2d8:6bfe:2bb4 with SMTP id 98e67ed59e1d1-2da5597d530mr5206236a91.23.1725396827760; Tue, 03 Sep 2024 13:53:47 -0700 (PDT) Received: from sw06.internal.sifive.com ([4.53.31.132]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2da6fb086cfsm1774768a91.24.2024.09.03.13.53.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2024 13:53:46 -0700 (PDT) From: Samuel Holland To: opensbi@lists.infradead.org Subject: [PATCH] Makefile: Separate libsbi objects for each platform Date: Tue, 3 Sep 2024 13:53:10 -0700 Message-ID: <20240903205345.2088737-1-samuel.holland@sifive.com> X-Mailer: git-send-email 2.45.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240903_135349_032212_03EE6EEA X-CRM114-Status: GOOD ( 13.43 ) X-Spam-Score: -2.1 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Since commit 22f38ee6c658 ("lib: sbi_ecall: Add Kconfig option for each extension"), the libsbi object file contents depend on the Kconfig configuration, so these files may be different across platfor [...] Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:1030 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 T_SCC_BODY_TEXT_LINE No description available. X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Since commit 22f38ee6c658 ("lib: sbi_ecall: Add Kconfig option for each extension"), the libsbi object file contents depend on the Kconfig configuration, so these files may be different across platforms. As a result, each platform should get a separate copy of these object files, corresponding to that platform's configuration. This change also allows building for multiple platforms in parallel. Fixes: 22f38ee6c658 ("lib: sbi_ecall: Add Kconfig option for each extension") Signed-off-by: Samuel Holland --- Note that Kconfig is not used for the generic (no PLATFORM set) libsbi build. But this is actually equivalent to all Kconfig options being disabled. As a result, since the referenced commit, the generic libsbi only supports the base SBI extension and none of the others. I don't know how we want to fix this -- does anyone even use libsbi anymore? Makefile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index e5a0f19e..ccb2e138 100644 --- a/Makefile +++ b/Makefile @@ -264,11 +264,13 @@ include $(libsbiutils-object-mks) include $(firmware-object-mks) # Setup list of objects -libsbi-objs-path-y=$(foreach obj,$(libsbi-objs-y),$(build_dir)/lib/sbi/$(obj)) ifdef PLATFORM +libsbi-objs-path-y=$(foreach obj,$(libsbi-objs-y),$(platform_build_dir)/lib/sbi/$(obj)) libsbiutils-objs-path-y=$(foreach obj,$(libsbiutils-objs-y),$(platform_build_dir)/lib/utils/$(obj)) platform-objs-path-y=$(foreach obj,$(platform-objs-y),$(platform_build_dir)/$(obj)) firmware-bins-path-y=$(foreach bin,$(firmware-bins-y),$(platform_build_dir)/firmware/$(bin)) +else +libsbi-objs-path-y=$(foreach obj,$(libsbi-objs-y),$(build_dir)/lib/sbi/$(obj)) endif firmware-elfs-path-y=$(firmware-bins-path-y:.bin=.elf) firmware-objs-path-y=$(firmware-bins-path-y:.bin=.o) @@ -504,9 +506,10 @@ compile_gen_dep = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ echo " GEN-DEP $(subst $(build_dir)/,,$(1))"; \ echo "$(1:.dep=$(2)): $(3)" >> $(1) -targets-y = $(build_dir)/lib/libsbi.a ifdef PLATFORM targets-y += $(platform_build_dir)/lib/libplatsbi.a +else +targets-y = $(build_dir)/lib/libsbi.a endif targets-y += $(firmware-bins-path-y) @@ -565,6 +568,11 @@ $(platform_build_dir)/%.dep: $(platform_src_dir)/%.c $(KCONFIG_AUTOHEADER) $(platform_build_dir)/%.o: $(platform_src_dir)/%.c $(KCONFIG_AUTOHEADER) $(call compile_cc,$@,$<) +ifeq ($(BUILD_INFO),y) +$(platform_build_dir)/lib/sbi/sbi_init.o: $(libsbi_dir)/sbi_init.c FORCE + $(call compile_cc,$@,$<) +endif + $(platform_build_dir)/%.dep: $(platform_src_dir)/%.S $(call compile_as_dep,$@,$<)