From patchwork Sat Aug 27 08:38:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 12956886 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 9A10DECAAD2 for ; Sat, 27 Aug 2022 08:42:46 +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=Ev7Y2yvsNHTX4kzZL/691aXZzDvUuvyXdTC5SJ8s2kQ=; b=gKjuRO6JA4afOF KQk3bCnwGMLpivPECcahoEK1w3Rr21SPEGM1x200T2PQT+OeAEleWow0KBHPxxW1fEmsxIZzgWI6I 1IaEBVp/EObeo8saZ4C1tLKPbFCcCf4t/dyyghVfaDIc2j6MyHJxGHWAanPEFekKNmll4ud5Z1H6s 90kMTF3AK0Tno9+f8VtdB0tmYW5jFfrUxTGQ/Mc/FftBm+zX9c+M790CzYE3fwveM01yxBi9P99QL VwRVmAejgbgRGwr+vd3niR+pFNMvf7X4Inb7nNLAUw6pf+Fwd5GlfVxpbvubGQnVXWDwOQeuvyKV9 KojD9443qRJF0/WtznBg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oRrNl-00631R-Ar; Sat, 27 Aug 2022 08:41:33 +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 1oRrLw-0061De-0t for linux-arm-kernel@lists.infradead.org; Sat, 27 Aug 2022 08:39:41 +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 B532EB822E9; Sat, 27 Aug 2022 08:39:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76C3EC433D7; Sat, 27 Aug 2022 08:39:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1661589577; bh=JJ62mwQRKOhojwaa2WD+JELwQTszUIIRFMzYE6TT7q0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WG13pKz8qHZhdYtiYQAlF/xMtBO136Axd3jClNCDrE1ITrM9o3tLTS9WhIHO0rjJx /aal7XELnlXsDYxCKmBa5jAH3eGEqxgJlLAfStf8e07Mel0JcxVOFQh/WxA3c1lVAo KElkEx8lqgP1E1PxRCEiJWlmE+YaDTRCajccwY5UaNQWgJL0b5XX4hs17HYQU/Gpxh ZEQ9gnI1gfLl6fI+/KJH69HUQkPnSWSQNznwSZDiCnetuP6N3BpZSR/wlEEuWxXhYY to9BrJnD7Y1re7Lfzc4y9djkQ2ZvkH1dVGUhF4Xz46xSAt9vDRYNgoEFX6D1mlM+ox jK/y7JzzY05iQ== 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 8/9] loongarch: avoid orphan input sections Date: Sat, 27 Aug 2022 10:38:49 +0200 Message-Id: <20220827083850.2702465-9-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=1261; i=ardb@kernel.org; h=from:subject; bh=JJ62mwQRKOhojwaa2WD+JELwQTszUIIRFMzYE6TT7q0=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBjCdgY/W0kg4XKg0dra/guhX0FcEV61muFkzdpmVKs mAUwR7GJAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCYwnYGAAKCRDDTyI5ktmPJFa6C/ 9HYuy4CqWxM53SqNFHF+plJs4f/acUcqTQ45qKRPhTxS7mo12bma9v0Zc/hnnqomUHpmay7XzRdYyD BjcjT11dhpDmN/EvvAQvBZcRFbkx3dayppjVFnCqZokxuam/xnYWUzF1tdJoB5x+b3STIj0ci2bsCL tak96eO6KYxx3iczavU2Q+HLjEDNpHTg7DCi9Gm/gJEKi8WyBp8844xHqsyPzOlJhKSSu/pGN2jJJA v5EQ8GyKZ8a0PdgfHd0L33AxwilCA5kVwDnLsdpzoPD1xfudSA7j54QAhNw6fmqTm4bfhEG00qO0as x29Ps3kVBQLG3/2+8s3jxPFv+QPWVFnWQD64IrQOFsdgFQl57anp5BXPuN9mfpeprBvLCstG/VXj5v NLko79AVOVQlipWHAumqEz3EZ6oe6PldGy2GirkHerbftNwTV9h1U0yjQU9S4ozWfnR931l6fYkBDL pNn3RruNecffPip2Io2E7K34+efFFXoxx1R8UJHGW9dbE= 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_013940_380151_FC4FA844 X-CRM114-Status: GOOD ( 10.59 ) 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 Ensure that all input sections are listed explicitly in the linker script, and issue a warning otherwise. This ensures that the binary image matches the PE/COFF and other image metadata exactly, which is important for things like code signing. Signed-off-by: Ard Biesheuvel --- arch/loongarch/Kconfig | 1 + arch/loongarch/kernel/vmlinux.lds.S | 2 ++ 2 files changed, 3 insertions(+) diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig index fca106a8b8af..407502da4335 100644 --- a/arch/loongarch/Kconfig +++ b/arch/loongarch/Kconfig @@ -51,6 +51,7 @@ config LOONGARCH select ARCH_USE_CMPXCHG_LOCKREF select ARCH_USE_QUEUED_RWLOCKS select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT + select ARCH_WANT_LD_ORPHAN_WARN select ARCH_WANTS_NO_INSTR select BUILDTIME_TABLE_SORT select COMMON_CLK diff --git a/arch/loongarch/kernel/vmlinux.lds.S b/arch/loongarch/kernel/vmlinux.lds.S index 36d042739f3c..17d33308dfba 100644 --- a/arch/loongarch/kernel/vmlinux.lds.S +++ b/arch/loongarch/kernel/vmlinux.lds.S @@ -74,6 +74,8 @@ SECTIONS EXIT_DATA } + .rela.dyn : { *(.rela.dyn) *(.rela*) } + #ifdef CONFIG_SMP PERCPU_SECTION(1 << CONFIG_L1_CACHE_SHIFT) #endif