From patchwork Thu Jan 19 15:54:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13108328 X-Patchwork-Delegate: palmer@dabbelt.com 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 97C77C00A5A for ; Thu, 19 Jan 2023 16:04:56 +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=PTashnVMW0nYfIlADkpOZRhd4C0zat1Z4Bd8N7Z102U=; b=CYMm98I2Bl/6F7 i4BDrHQ8+DWeEbaishe3Kq7t0Ee8oBY90X596plMtLnE61/l9IvGhaTQXQb89gNOU/2ZLkt1CqvEi FGdGTU9jtZoKYVlaYuiwp3X716BhzWyB2sQASOq33YK0cu3sBFUlfxiD2miMHN+Jl4BnI3ALuMZqJ Tf4csC4zrywDTM4YLQOBSuhRtEF99vpy8Z+V4h5o5huARjP4NrGgjUGSGryav+Y6yN+XvotEzaHub mwIc54c2RAtwaQHsbQa4zBimim3YiHKHHQUZ4LKKBRJn9t8Q/PLEjm22R+i8qpjV4sRzBXoj7yxbC WRi1zZo5HWIyN4Gk8QFg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pIXPB-005png-PY; Thu, 19 Jan 2023 16:04:45 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pIXP6-005pl3-Ru for linux-riscv@lists.infradead.org; Thu, 19 Jan 2023 16:04:43 +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 dfw.source.kernel.org (Postfix) with ESMTPS id 3828061CB7; Thu, 19 Jan 2023 16:04:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C585C433F0; Thu, 19 Jan 2023 16:04:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674144279; bh=J6NfBaiAHaZuC3c1U8Q2mwYoiCAI9Bs41guM1DxDgPc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rGvlB0CvLLTbE3PEOLaWlAM8hyCbtspLIpmMAXkQE65qKeOs1S5YQ6tFOIDNNMTzm +mfaKlbigHE/gP4UIVpLKkUE8RGRAFTkwiUgY7UbGhAwFnghvwDYSxA3c8c+df+tEU +TXbI3TJkWdTzjtp+4PwcoQY1uuf+slEpGzFUMAiEhuex7y9DTZRa3elnetXCqZEcg J6QyYJbwP7Ni+xJqI5I5SWy/e+hvTRPVgwtDMy3tasF8/13mclwc4BQKJhm/3nNxXs bV1G5T1YvVXfIcg3yoatppjIV7UlRoU3+cbjKK09/GhIkXKDRLZhxjqvpxAcSI/CyH gPkwFYrYYBfMA== From: Jisheng Zhang To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Masahiro Yamada , Kees Cook , Nathan Chancellor Cc: Conor Dooley , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/5] riscv: lds: define RUNTIME_DISCARD_EXIT Date: Thu, 19 Jan 2023 23:54:13 +0800 Message-Id: <20230119155417.2600-2-jszhang@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230119155417.2600-1-jszhang@kernel.org> References: <20230119155417.2600-1-jszhang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230119_080440_974984_7FDC6EA6 X-CRM114-Status: GOOD ( 11.16 ) X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org riscv discards .exit.* sections at run-time but doesn't define RUNTIME_DISCARD_EXIT. However, the .exit.* sections are still allocated and kept even if the generic DISCARDS would discard the sections due to missing RUNTIME_DISCARD_EXIT, because the DISCARD sits at the end of the linker script. Add the missing RUNTIME_DISCARD_EXIT define so that it still works if we move DISCARD up or even at the beginning of the linker script. Signed-off-by: Jisheng Zhang Suggested-by: Masahiro Yamada Reviewed-by: Conor Dooley --- arch/riscv/kernel/vmlinux.lds.S | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/riscv/kernel/vmlinux.lds.S b/arch/riscv/kernel/vmlinux.lds.S index 4e6c88aa4d87..07c19f2a288c 100644 --- a/arch/riscv/kernel/vmlinux.lds.S +++ b/arch/riscv/kernel/vmlinux.lds.S @@ -5,6 +5,7 @@ */ #define RO_EXCEPTION_TABLE_ALIGN 4 +#define RUNTIME_DISCARD_EXIT #ifdef CONFIG_XIP_KERNEL #include "vmlinux-xip.lds.S" From patchwork Thu Jan 19 15:54:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13108329 X-Patchwork-Delegate: palmer@dabbelt.com 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 2369CC004D4 for ; Thu, 19 Jan 2023 16:05:21 +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=j6GFbqX2458SyTJDO9J25h/w0Wt40zvExchTuTSrfuw=; b=h9cjM6ZTdeXZNC 0S43Ybt6+ZTXGK/WfnLFMli5hz1EUGHksRsZvYuk4r8L2i9IruAhwJBVrL2MiiE8raA81HCo2pcLr nbBorI2ZL/uI6SrdT7sP5Ys0uGAqtf6Adi0M1FF92KzbmwW/2DFIs2W8zOAYdozR3I75qJCzpteWV AewlmC66+U/0wj+EFw/Ax2dlV88JZM6Mmuhj5fQUl+KCC2LtGfe7wPe1XpY63AqgjAXhjJnEqGlvt W1bb0vHZZRxNNgpZ8omdoyUE8zrx95Lq4b2/TLeCEzNgQdd4eE2on4Zlazm6Nyt0pNjj0I3wqcPPd iSyuBiOBAHZWo4xKdldQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pIXPc-005pzJ-RJ; Thu, 19 Jan 2023 16:05:12 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pIXP8-005pmK-Ln for linux-riscv@lists.infradead.org; Thu, 19 Jan 2023 16:04:44 +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 dfw.source.kernel.org (Postfix) with ESMTPS id 45B2161B5D; Thu, 19 Jan 2023 16:04:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08DD0C433D2; Thu, 19 Jan 2023 16:04:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674144281; bh=JVI55/ivlZ2TxoJHk0X2NO1E9dymbfoLXWzO4tbPtjg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sb/IuKp0gRLNHotZEmSEUC5VIcFKvFDct3mmUFbR/RgMiNz4w6hsFeLsqIRKBxs8C SVXmwwejCWXXx9vxIj0okNKj9s9nXgMDRqz8pM/8I/GxVGChP6BGEhZE/0NpaU0OZJ cWnOmQ6gTLwfeU7TLmG8uXy9apHLMCIN3feZd77krFdI3QM7+VTln48Qd4Ahs1o1eJ CQWzdokDLVZw/3ZLwLJAV+Z42Yn3++93GRXVXXzJbr+WmZ8w2fVTpHa1mk/RKUh2YH 8ct/q8JlLqoczfUQ4aTZhYBWCiKj761uH8aPsleUEILO0lJBavjg1fLAxvKgrFvDt8 /NrYA+SchZ3Lg== From: Jisheng Zhang To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Masahiro Yamada , Kees Cook , Nathan Chancellor Cc: Conor Dooley , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/5] riscv: vmlinux.lds.S: explicitly catch .rela.dyn symbols Date: Thu, 19 Jan 2023 23:54:14 +0800 Message-Id: <20230119155417.2600-3-jszhang@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230119155417.2600-1-jszhang@kernel.org> References: <20230119155417.2600-1-jszhang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230119_080442_980477_0370B1CC X-CRM114-Status: UNSURE ( 9.85 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org When enabling linker orphan section warning, I got warnings similar as below: riscv64-linux-gnu-ld: warning: orphan section `.rela.text' from `init/main.o' being placed in section `.rela.dyn' Use the approach similar as ARM64 does and declare it in vmlinux.lds.S Signed-off-by: Jisheng Zhang --- arch/riscv/kernel/vmlinux.lds.S | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/riscv/kernel/vmlinux.lds.S b/arch/riscv/kernel/vmlinux.lds.S index 07c19f2a288c..6a250313b752 100644 --- a/arch/riscv/kernel/vmlinux.lds.S +++ b/arch/riscv/kernel/vmlinux.lds.S @@ -97,6 +97,10 @@ SECTIONS *(.rel.dyn*) } + .rela.dyn : { + *(.rela*) + } + __init_data_end = .; . = ALIGN(8); From patchwork Thu Jan 19 15:54:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13108331 X-Patchwork-Delegate: palmer@dabbelt.com 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 87759C004D4 for ; Thu, 19 Jan 2023 16:05:26 +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=wq7hL5v9hZJplaXcx+lSLWQhrktN9HXbFyNJRjxqIus=; b=UreppIfCUp775g 8a7g+6QILQ/GYK3JujAspL7mNlBshsPyQ+mReHxU1E80E7kYNLd6n5lKHRpeYXotaj49huwqvipsb VgBG1p4JdYsbo+NJlGZm89Ykk2eQDSVzIKuq41t6OVfwCkCOgTKOwGlnTGVxBlU4lmieMYzyS61Jm EjmTsOyZ+w2JdZBqPGjQ4mlq4TqbRmUzHM8xN0Of7FhcrBmTdCYjeHC8/ujN8A0InqhmvQ8+4SDZw zuT57ancKjpnYTo3x7BaN2mAi3cvrIry180KVOCBjdrcasy8XJphsgJZdMY1sPJlsnq8jFcaAgl8W z0MPVd7LcA52UKIwSSdg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pIXPi-005q2f-N9; Thu, 19 Jan 2023 16:05:18 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pIXPE-005pnc-CE for linux-riscv@lists.infradead.org; Thu, 19 Jan 2023 16:04:50 +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 14BCEB825CF; Thu, 19 Jan 2023 16:04:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 192F1C433F0; Thu, 19 Jan 2023 16:04:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674144283; bh=HZ2KeW9xZS9UJRxhjs2snT6EZu0lqTWV3MzCCMYghqA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZPQmJJUes4tQ1AHeqLpcuDsBW0QuzfZesiN8dtYdaZeUVxPt0hMlcL2HqoMfSORIU R0OGX1vIgqw3Szuz+yOhOdEK31eu6KYWEOSNPET/XJ0cnB+S8FklJuGJ9vsNuRKPvw RQyodrQj7IYIZcVX2nPnM/kdUcw6rvQ1sEp7TaCJ2c1LZFR35A01Va75F6cuiIKlgA 7IsczqPTd5NABgRSLCJBfB5wPxqtdNdKc0B/oSOiRf21wenFIlD+c4l+B2b7vqzHgn McDiYiDWtnsikeoHgFtGuixpH1sleZfxOm9OJ2VMgTBfNfi23ir6UeiBOBda2Fz/lc 3KP1k6cQgZ7Zw== From: Jisheng Zhang To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Masahiro Yamada , Kees Cook , Nathan Chancellor Cc: Conor Dooley , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/5] riscv: vmlinux.lds.S: explicitly catch .riscv.attributes sections Date: Thu, 19 Jan 2023 23:54:15 +0800 Message-Id: <20230119155417.2600-4-jszhang@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230119155417.2600-1-jszhang@kernel.org> References: <20230119155417.2600-1-jszhang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230119_080448_640151_FAB42D8A X-CRM114-Status: GOOD ( 10.12 ) X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org When enabling linker orphan section warning, I got warnings similar as below: riscv64-linux-gnu-ld: warning: orphan section `.riscv.attributes' from `init/main.o' being placed in section `.riscv.attributes' While I don't see any usage of .riscv.attributes sections' in kernel now, just catch the sections so that we can enable linker orphan section warning. Signed-off-by: Jisheng Zhang --- arch/riscv/kernel/vmlinux.lds.S | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/riscv/kernel/vmlinux.lds.S b/arch/riscv/kernel/vmlinux.lds.S index 6a250313b752..7eb3d25d0dae 100644 --- a/arch/riscv/kernel/vmlinux.lds.S +++ b/arch/riscv/kernel/vmlinux.lds.S @@ -146,6 +146,7 @@ SECTIONS STABS_DEBUG DWARF_DEBUG ELF_DETAILS + .riscv.attributes 0 : { *(.riscv.attributes) } DISCARDS } From patchwork Thu Jan 19 15:54:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13108330 X-Patchwork-Delegate: palmer@dabbelt.com 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 B101BC6379F for ; Thu, 19 Jan 2023 16:05:23 +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=V8HDG1Ml8ouenZjFyR2o044kCWiX8JRWES+7BY60KIQ=; b=bwuEEMc9DjNRSj dWKR4vpNi+nZlu88Wjw3SOgxRT7je0Lr+yNEyM3qxItcZMxg/KUaGnx+m0VWhY5noRIX3FDbFrsSW sXWtVd1ap9qwr9jJ0U8KNClJ8QdHZlTTPiaxw+dfrnGSv+VQsr4Kh32s4a4YWwiHVnioqEq4BFrX8 caPv0qFIwi8tkZ2qjrkDLlGOwsZwesnnkFN72HA2ADwUDuCYpcfEWxheZMTn8O97Ix8rjfsQweWsb F2Jr3+WKMtn+TevJ5QiaO1lgq7/6dr+/CYdgScjYSgYFSJydEcG8N0XPKEOlYcHQWBpZ/rH+xmBk6 RUhoxEBjqdb34hXfa4IQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pIXPg-005q14-BC; Thu, 19 Jan 2023 16:05:16 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pIXPC-005poB-Qg for linux-riscv@lists.infradead.org; Thu, 19 Jan 2023 16:04:48 +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 dfw.source.kernel.org (Postfix) with ESMTPS id 6081E61CB2; Thu, 19 Jan 2023 16:04:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2773FC433EF; Thu, 19 Jan 2023 16:04:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674144285; bh=pK9Wljug0Rn52ySou16paWAQsJuCdZT50slSKiioR6I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I2M7OjAvb5J/bLEAc1b32Jtbukywae8404syAwBYwhKyD3JPidlY3A/Es8gJ9BQAu Qp3p/b4rqgs8vNq/1frbEJyI3+RM1MtOo9DD/VCKW2lRBqscBhmIZpxiSHWL2aY4Pw RdH4jlK74S/mq0YVuTN1YkdGZzaCjh8SJmPJyJkqoidzKDfoxrLjAhOxPLwnmmwJ9V a3b/giUqbhV9myKXy0jPD8f6ZNFRvNZw9GTjnogGUilLxlvCG3/kvhLhBy79ECywzy XiMevmoyYtgRE3B/EnERlqPBLQH5PPSmaelHe/isPHMXpPMzdRh02oY/k0x3sc7Y4L Jqvc86erhRayw== From: Jisheng Zhang To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Masahiro Yamada , Kees Cook , Nathan Chancellor Cc: Conor Dooley , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 4/5] riscv: vmlinux.lds.S: explicitly catch .init.bss sections from EFI stub Date: Thu, 19 Jan 2023 23:54:16 +0800 Message-Id: <20230119155417.2600-5-jszhang@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230119155417.2600-1-jszhang@kernel.org> References: <20230119155417.2600-1-jszhang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230119_080447_176572_6B92C1B2 X-CRM114-Status: UNSURE ( 9.96 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org When enabling linker orphan section warning, I got warnings similar as below: ld.lld: warning: ./drivers/firmware/efi/libstub/lib.a(efi-stub-helper.stub.o):(.init.bss) is being placed in '.init.bss' Catch the sections so that we can enable linker orphan section warning. Signed-off-by: Jisheng Zhang --- arch/riscv/kernel/vmlinux.lds.S | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/riscv/kernel/vmlinux.lds.S b/arch/riscv/kernel/vmlinux.lds.S index 7eb3d25d0dae..b2813b5e47a0 100644 --- a/arch/riscv/kernel/vmlinux.lds.S +++ b/arch/riscv/kernel/vmlinux.lds.S @@ -87,6 +87,9 @@ SECTIONS /* Start of init data section */ __init_data_begin = .; INIT_DATA_SECTION(16) + .init.bss : { + *(.init.bss) /* from the EFI stub */ + } .exit.data : { EXIT_DATA From patchwork Thu Jan 19 15:54:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13108332 X-Patchwork-Delegate: palmer@dabbelt.com 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 13739C004D4 for ; Thu, 19 Jan 2023 16:05:30 +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=PfuCjhc4NEegZ7yqc7DnqSj8Xiy9YAZcYlcT+r1X7dM=; b=fjoQTbpU0vZGqM TPnJwkPrszblqG+8CaYeIRq1itU8Q0dOs+k2i2SuoE9H8XzdNpZCKdaicGMUOFtvdliARnHeTgCgR Uh96fOZeZrVkiH2OdbGpLvDWbPy0Skg3BbJcwJqgA1A3/AiXHOBszactdjGnoqqGCkYK+R7Rzw/GE CNRG5xVajGLe4HA7aUWLDJ3634074wCCregPzmXPC9ax9jkRFMOtRDBpMgmzmgqGlKrLaC/C+lyHe YU+kAGpltXTO4ypsWAY/gsD8vkmFufieYW88cyGxkdSfmO1MSgsvGIrXxtL63b1fxvjLKbP0ZT7Jj GsRy8E/SNBmz+3RpXs0A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pIXPk-005q40-Pj; Thu, 19 Jan 2023 16:05:20 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pIXPG-005ppq-SW for linux-riscv@lists.infradead.org; Thu, 19 Jan 2023 16:04:52 +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 7DE6BB825D5; Thu, 19 Jan 2023 16:04:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31355C43398; Thu, 19 Jan 2023 16:04:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674144288; bh=Q3aUPyCmgVUYIBmI6uVtAlDrofg5WEVa3xPWnM7xs/M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KOOU8bw3d6SuGu0wcCX7KDP4dmpC5+XBCZ2OljXy1baMW85lsj4+IqWljAFyoSWBl ppX4QqkJxaSDD0HfCrhXdJhHdHNiJa2wGfyyV1QOju+OJf2+ZkEsMUd6PnsHRUvRif pbfBKnuYGROfs91MqXhZAJeoqCFjbscAlGdNGsS0v9mUv9NxUg+tV1MdzdHfEpWLHT zTv8VTs/c1/0c1jQl4JNc2fmMLxE/IWL1jJJRNdZbxYZ7AAcS9PCCA/DnSjQecu6E4 Sv8jnLCBxM8fMikux4xClrENpdNhnm0ZuSDTp0EqingpaCJSR2sQr7mOwAgsIQ3reB IaPMMTaUwCudg== From: Jisheng Zhang To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Masahiro Yamada , Kees Cook , Nathan Chancellor Cc: Conor Dooley , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 5/5] riscv: select ARCH_WANT_LD_ORPHAN_WARN for !XIP_KERNEL Date: Thu, 19 Jan 2023 23:54:17 +0800 Message-Id: <20230119155417.2600-6-jszhang@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230119155417.2600-1-jszhang@kernel.org> References: <20230119155417.2600-1-jszhang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230119_080451_115085_DFBB577D X-CRM114-Status: UNSURE ( 9.61 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Now, after that all the sections are explicitly described and declared in vmlinux.lds.S, we can enable ld orphan warnings for !XIP_KERNEL to prevent from missing any new sections in future. Signed-off-by: Jisheng Zhang Reviewed-by: Conor Dooley --- arch/riscv/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index e2b656043abf..335e0c45cced 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -46,6 +46,7 @@ config RISCV select ARCH_WANT_FRAME_POINTERS select ARCH_WANT_GENERAL_HUGETLB select ARCH_WANT_HUGE_PMD_SHARE if 64BIT + select ARCH_WANT_LD_ORPHAN_WARN if !XIP_KERNEL select ARCH_WANTS_THP_SWAP if HAVE_ARCH_TRANSPARENT_HUGEPAGE select BINFMT_FLAT_NO_DATA_START_OFFSET if !MMU select BUILDTIME_TABLE_SORT if MMU