From nobody Tue Sep 9 18:02:10 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 820D9CA0EC3 for ; Tue, 12 Sep 2023 07:32:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231614AbjILHcW (ORCPT ); Tue, 12 Sep 2023 03:32:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231559AbjILHcQ (ORCPT ); Tue, 12 Sep 2023 03:32:16 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B3F9E79 for ; Tue, 12 Sep 2023 00:32:13 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC59AC433C8; Tue, 12 Sep 2023 07:32:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694503932; bh=HBWl5TsWAKAoTzbm8Bwf+YOEMz6NMlDFOMNBVCJ92PE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OvVipaHJZ3zN6VWZ13xySJscIIb9lQcwQwf2SKfyd22P78oZNNTLrW+qPfdhupd5j 1LH0ujc0/BogPiGdv044Ht/xolxVdwAg0WVA27P2R8L53y2TSDLR0j/rVGRW050or1 ktvn0XBB2FE3O5Vs52vpqCaPDsQNrLOj1aVUptRkuY1ezxJhGZiZFoVgBqbVF/uwZo oBpMTx372X/0B4DbYcwOAxS+wBOuhAhQOqHVSZemrTrW8dQokYUXQNHIgj+TkprJPK +alxjlXZPeMlumYoYHle6QTNRZlrHCkx1SYVzH1RX1AAinxnB91xL1TmlitQ2GkuqJ BhoGw/P1VwzKQ== From: Jisheng Zhang To: Paul Walmsley , Palmer Dabbelt , Albert Ou Cc: Andrew Jones , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Emil Renner Berthing Subject: [RESEND PATCH 1/3] riscv: vdso.lds.S: drop __alt_start and __alt_end symbols Date: Tue, 12 Sep 2023 15:20:13 +0800 Message-Id: <20230912072015.2424-2-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230912072015.2424-1-jszhang@kernel.org> References: <20230912072015.2424-1-jszhang@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" These two symbols are not used, remove them. Signed-off-by: Jisheng Zhang Tested-by: Emil Renner Berthing --- arch/riscv/kernel/vdso/vdso.lds.S | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/riscv/kernel/vdso/vdso.lds.S b/arch/riscv/kernel/vdso/vds= o.lds.S index 82ce64900f3d..d43fd7c7dd11 100644 --- a/arch/riscv/kernel/vdso/vdso.lds.S +++ b/arch/riscv/kernel/vdso/vdso.lds.S @@ -42,9 +42,7 @@ SECTIONS =20 . =3D ALIGN(4); .alternative : { - __alt_start =3D .; *(.alternative) - __alt_end =3D .; } =20 .data : { --=20 2.40.1 From nobody Tue Sep 9 18:02:10 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2CBECA0ECA for ; Tue, 12 Sep 2023 07:32:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231669AbjILHcY (ORCPT ); Tue, 12 Sep 2023 03:32:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231633AbjILHcS (ORCPT ); Tue, 12 Sep 2023 03:32:18 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E67E710C2 for ; Tue, 12 Sep 2023 00:32:14 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1FB7BC433C7; Tue, 12 Sep 2023 07:32:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694503934; bh=SNTi6EXjRzqklc00AhX/G/qenKAaP0mCu6dWGFTJ448=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CYnnR/ilRkGT4q9ek9ocgu4MaGhNF2mRvrrgfNo2WpDw23NReL/A8pizQ26tmjD7R juAJ6MV424uoVvVVEWzbmY6aadsfMg5z0lVP4QQ2udB0tzQhF3ECWF5GGVggNqSr4B DvxnT/UNemTM9BT2px1Tyxynh18gL12NGGyoXEMASZQlj/r6pHHXbHGMPQb4UTkHL8 0D67ELq1bJ0L0V3JFrLZ6y2RY3SLgVNCZQRV6CEKI76NYH34w4lqEkMoWWp5X90pTZ zOk28jh56mjyvJ7Vxfe21TjDxZkwkdetE6O8V/8P1ZIaCQK176IHagZeRZGFib3lIs TmBOFMQmncTIA== From: Jisheng Zhang To: Paul Walmsley , Palmer Dabbelt , Albert Ou Cc: Andrew Jones , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Emil Renner Berthing Subject: [RESEND PATCH 2/3] riscv: vdso.lds.S: merge .data section into .rodata section Date: Tue, 12 Sep 2023 15:20:14 +0800 Message-Id: <20230912072015.2424-3-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230912072015.2424-1-jszhang@kernel.org> References: <20230912072015.2424-1-jszhang@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The .data section doesn't need to be separate from .rodata section, they are both readonly. Signed-off-by: Jisheng Zhang Tested-by: Emil Renner Berthing --- arch/riscv/kernel/vdso/vdso.lds.S | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/arch/riscv/kernel/vdso/vdso.lds.S b/arch/riscv/kernel/vdso/vds= o.lds.S index d43fd7c7dd11..671aa21769bc 100644 --- a/arch/riscv/kernel/vdso/vdso.lds.S +++ b/arch/riscv/kernel/vdso/vdso.lds.S @@ -29,7 +29,13 @@ SECTIONS .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr .eh_frame : { KEEP (*(.eh_frame)) } :text =20 - .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } + .rodata : { + *(.rodata .rodata.* .gnu.linkonce.r.*) + *(.got.plt) *(.got) + *(.data .data.* .gnu.linkonce.d.*) + *(.dynbss) + *(.bss .bss.* .gnu.linkonce.b.*) + } =20 /* * This linker script is used both with -r and with -shared. @@ -44,13 +50,6 @@ SECTIONS .alternative : { *(.alternative) } - - .data : { - *(.got.plt) *(.got) - *(.data .data.* .gnu.linkonce.d.*) - *(.dynbss) - *(.bss .bss.* .gnu.linkonce.b.*) - } } =20 /* --=20 2.40.1 From nobody Tue Sep 9 18:02:10 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2AC5CA0EC3 for ; Tue, 12 Sep 2023 07:32:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231675AbjILHcZ (ORCPT ); Tue, 12 Sep 2023 03:32:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231642AbjILHcV (ORCPT ); Tue, 12 Sep 2023 03:32:21 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D039A10C9 for ; Tue, 12 Sep 2023 00:32:16 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03EA6C433C8; Tue, 12 Sep 2023 07:32:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694503936; bh=LVkhyWFH59zqNCV7QiwAO5x1uYMJKWUxGuvv3jXu/IQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aHhhtPBV+49U1o/r/CM1Znsy1im0RnVGuv+yP6AeptLwXw+lvr/lhnlUccKnXlFza CxEAXhnH8pc8T94zdnvctdmtyVQtYbVkveTHcQ/0W4T/hAyXENARO14ni3pqj/yTbq hqGY1FVIM78CX8gH7hQSR4vMDLOj4f0ag7rE/LHveaIEzJPws+iZ2dZg5hlAskdD9B Scm6tv7vyPmLHmgJVNN5Jhsb/5WxilSJr+cLda46qfqDuVnkHsTDUEXGp1zG/8JysC mdO0kLM+J+gwzJQpXmq/5H5BxIWp5rrynf9cN1Dp5FNkOeD80HSRR4Yltjl9BuFFYP 1X5TKbkKrh+eg== From: Jisheng Zhang To: Paul Walmsley , Palmer Dabbelt , Albert Ou Cc: Andrew Jones , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Emil Renner Berthing Subject: [RESEND PATCH 3/3] riscv: vdso.lds.S: remove hardcoded 0x800 .text start addr Date: Tue, 12 Sep 2023 15:20:15 +0800 Message-Id: <20230912072015.2424-4-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230912072015.2424-1-jszhang@kernel.org> References: <20230912072015.2424-1-jszhang@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" I believe the hardcoded 0x800 and related comments come from the long history VDSO_TEXT_OFFSET in x86 vdso code, but commit 5b9304933730 ("x86 vDSO: generate vdso-syms.lds") and commit f6b46ebf904f ("x86 vDSO: new layout") removes the comment and hard coding for x86. Similar as x86 and other arch, riscv doesn't need the rigid layout using VDSO_TEXT_OFFSET since it "no longer matters to the kernel". so we could remove the hard coding now, and removing it brings a small vdso.so and aligns with other architectures. Also, having enough separation between data and text is important for I-cache, so similar as x86, move .note, .eh_frame_hdr, and .eh_frame between .rodata and .text. Signed-off-by: Jisheng Zhang Reviewed-by: Andrew Jones Tested-by: Emil Renner Berthing --- arch/riscv/kernel/vdso/vdso.lds.S | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/arch/riscv/kernel/vdso/vdso.lds.S b/arch/riscv/kernel/vdso/vds= o.lds.S index 671aa21769bc..cbe2a179331d 100644 --- a/arch/riscv/kernel/vdso/vdso.lds.S +++ b/arch/riscv/kernel/vdso/vdso.lds.S @@ -23,12 +23,8 @@ SECTIONS .gnu.version_d : { *(.gnu.version_d) } .gnu.version_r : { *(.gnu.version_r) } =20 - .note : { *(.note.*) } :text :note .dynamic : { *(.dynamic) } :text :dynamic =20 - .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr - .eh_frame : { KEEP (*(.eh_frame)) } :text - .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) *(.got.plt) *(.got) @@ -37,13 +33,16 @@ SECTIONS *(.bss .bss.* .gnu.linkonce.b.*) } =20 + .note : { *(.note.*) } :text :note + + .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr + .eh_frame : { KEEP (*(.eh_frame)) } :text + /* - * This linker script is used both with -r and with -shared. - * For the layouts to match, we need to skip more than enough - * space for the dynamic symbol table, etc. If this amount is - * insufficient, ld -shared will error; simply increase it here. + * Text is well-separated from actual data: there's plenty of + * stuff that isn't used at runtime in between. */ - . =3D 0x800; + . =3D ALIGN(16); .text : { *(.text .text.*) } :text =20 . =3D ALIGN(4); --=20 2.40.1