From patchwork Sat Aug 27 08:38:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 12956882 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5D22DECAAD2 for ; Sat, 27 Aug 2022 08:41:08 +0000 (UTC) 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:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=MV3MgvlYBEqMnnnA6NUh6/G4bDk1h9RnKwyzjc9CxkA=; b=BR3OKV7In9O5H7 HkRTepQtNK0+c5AT9AB/Za6CAxsH+QPo55KB9LCnh2Y3pd4dKA1tEqZXkzQAahZDRcq3zUAFo6rAa zQpZ5ZtpKvo1VZ4ltxa0/m87Whs0xLCSRFHf0MPBrQSPElQ7dZoKObNZjyPtm6GbykQW2674HziaH vH9FP2KhnHRLoRitLwSvK2mqibUy2sMMLY37jT5TqcCTw3d7cmC1X6ik/3LLK3wGOHSVLMzi0maJi kQRWVlzPC9U/EfY9NxJcdD05qGVCTe0Ilq4UBq2fe5b2Z/KTStvXwx2T6y2V7sval1UHfnrs7FMOc BgYWTlMksV6vyxfO8MRg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oRrMM-0061gf-DA; Sat, 27 Aug 2022 08:40:06 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oRrLl-0060zm-7n for linux-arm-kernel@lists.infradead.org; Sat, 27 Aug 2022 08:39:31 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 907E1B822E5; Sat, 27 Aug 2022 08:39:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5130CC433C1; Sat, 27 Aug 2022 08:39:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1661589563; bh=BgNwH7xfBPv6l1sHY7W8lv62pNdIUhlpLRWtnyMfKTQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HZTVkKz+1FlZx1gaSXop7eGIQZi8rzBg2kr33mDB3b+WrGTfTo5tbzhERJvqyACWj 4GGzOyG3YPTm8mcX4bla83cGLUadK2uPa89xkmjhWlA4iEmdrCdjWA5YrIVQpXyH4L YMWtsBnkuqYu/BeJtJfELLW5PY5Er2Ldxo/treMfdkFSm4pibPaLc4IxpCiTz7/xGY CKokkvM8/Yc5KIXqkiFcS1/TY4KlVs2PuBIQ6zP6ZzNnxfZEby4h9JRWFaz+pEjCuu dfFx4QKQcUgCmTEGIvRdAIXE4SCgiD0cKTHUaxSfukVH8lVHEDD890cjX4H4owzI3+ jkORFiTx+5F3A== From: Ard Biesheuvel To: linux-efi@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , "James E.J. Bottomley" , Matthew Garrett , Peter Jones , Ilias Apalodimas , Heinrich Schuchardt , AKASHI Takahiro , Palmer Dabbelt , Atish Patra , Arnd Bergmann , Huacai Chen , Xi Ruoyao , Lennart Poettering , Jeremy Linton Subject: [PATCH v4 4/9] efi/libstub: move efi_system_table global var into separate object Date: Sat, 27 Aug 2022 10:38:45 +0200 Message-Id: <20220827083850.2702465-5-ardb@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220827083850.2702465-1-ardb@kernel.org> References: <20220827083850.2702465-1-ardb@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2060; i=ardb@kernel.org; h=from:subject; bh=BgNwH7xfBPv6l1sHY7W8lv62pNdIUhlpLRWtnyMfKTQ=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBjCdgRYrCMeBKPNkBsfxIIEhlW6FxbWiIJTYHw4tIJ y7Qs+5mJAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCYwnYEQAKCRDDTyI5ktmPJJ3PC/ sGUEpWe63Hgzpvf9nGzGNA+f99uF7hln570rqVzyJFdGH8L+mOE7jCuUOzIZGMkLsgLmYMmCBUjF2V JNyAlsnRUFMoprwfwwm90hvyENy/LCUXGSZToZZUt3CeO0BsaSuY3dp4/FVVH1LlDEfU3zxQKmrdCg ZpuKMZfTTXHULFvllfHjruAifDnaB/SHlBYV3hvKhSPXjWxT/TZ3W+sH/xnnpPQioSd3fXPBwB42Cx xnfcsUCMIigdA0a1ONR88CCjwKUkPFz1tkrcRsXEws0JFqoTG9vW4R1rJPC/EnlbvrCot5PTg2o2zj HHG+KfSJ0jVQaykOprKDFCj8gRHSw638G1F3GcBoY2Kj5dReqJBoXudktqUuoo6yWJIfBgUVKnliNr C7+ljb7Wn37ubVe6cSxHutzhXnAeJMWjPRT2+Ee5w2ZJxrYlipNR/s8cdt0yRPR6sZ4bthurwAWSrz swj38uMrgLDd2d3J9jtqJVWwqXfSpy2S3GBj7zH0dfsmw= X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220827_013929_620900_80F86FDB X-CRM114-Status: GOOD ( 14.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org To avoid pulling in the wrong object when using the libstub static library to build the decompressor, define efi_system_table in a separate compilation unit. Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/libstub/Makefile | 3 ++- drivers/firmware/efi/libstub/efi-stub.c | 2 -- drivers/firmware/efi/libstub/systable.c | 8 ++++++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/firmware/efi/libstub/Makefile b/drivers/firmware/efi/libstub/Makefile index 498ea6f7a92a..fbe1900f47c4 100644 --- a/drivers/firmware/efi/libstub/Makefile +++ b/drivers/firmware/efi/libstub/Makefile @@ -57,7 +57,8 @@ KCOV_INSTRUMENT := n lib-y := efi-stub-helper.o gop.o secureboot.o tpm.o \ file.o mem.o random.o randomalloc.o pci.o \ skip_spaces.o lib-cmdline.o lib-ctype.o \ - alignedmem.o relocate.o vsprintf.o + alignedmem.o relocate.o vsprintf.o \ + systable.o # include the stub's generic dependencies from lib/ when building for ARM/arm64 efi-deps-y := fdt_rw.c fdt_ro.c fdt_wip.c fdt.c fdt_empty_tree.c fdt_sw.c diff --git a/drivers/firmware/efi/libstub/efi-stub.c b/drivers/firmware/efi/libstub/efi-stub.c index 4bf751484e8b..57ea04378087 100644 --- a/drivers/firmware/efi/libstub/efi-stub.c +++ b/drivers/firmware/efi/libstub/efi-stub.c @@ -57,8 +57,6 @@ static u64 virtmap_base = EFI_RT_VIRTUAL_BASE; static bool flat_va_mapping = (EFI_RT_VIRTUAL_OFFSET != 0); -const efi_system_table_t *efi_system_table; - static struct screen_info *setup_graphics(void) { efi_guid_t gop_proto = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID; diff --git a/drivers/firmware/efi/libstub/systable.c b/drivers/firmware/efi/libstub/systable.c new file mode 100644 index 000000000000..91d016b02f8c --- /dev/null +++ b/drivers/firmware/efi/libstub/systable.c @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include +#include + +#include "efistub.h" + +const efi_system_table_t *efi_system_table;