From patchwork Tue Sep 12 07:20: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: 13380943 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 E534FCA0ED3 for ; Tue, 12 Sep 2023 07:32:24 +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=6VaUn2jzG330UTim7Roj2BqYcemrMy1q+zXjfHXUM+E=; b=WKmrph0tSQKVqh XIrU92mmK2okX2oIh/pTuUcWoFXTaejqnAt6VZa9AxrLgUX4VdtJF7MGkxqd/EKN19FByP/zoajny S7ZXg9W3LLdiD/uTkqd6iKK/sv+/u9vUHjNdChvMzxcbWI81jGjk6ufYlxYbjrXGL5WdGx+81AxqD vIz3+4LOP28A4OT+duS9o6Z+MhjN0OiZqPXJr5PhnWk0wz+1Qb4z4rsDmLZ4HvxxSUqePJLa6zzj8 4ph6ZVaBc1KHSHmbdICaPjToVQ7YzaCIBv3jGGVAYeRQnm0bhaq5jxuukZl6Zz6eE422o9E19jIQT wBpLvghfXw4ngas+Z+yg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qfxsi-002PGB-00; Tue, 12 Sep 2023 07:32:20 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qfxsf-002PEC-0V for linux-riscv@lists.infradead.org; Tue, 12 Sep 2023 07:32:18 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 633F6CE0AC9; Tue, 12 Sep 2023 07:32:14 +0000 (UTC) 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230912_003217_411536_8A4E5405 X-CRM114-Status: UNSURE ( 8.34 ) 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 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/vdso.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 . = ALIGN(4); .alternative : { - __alt_start = .; *(.alternative) - __alt_end = .; } .data : { From patchwork Tue Sep 12 07:20: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: 13380941 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 49A8CCA0ECE for ; Tue, 12 Sep 2023 07:32:24 +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=5rA6uwUKjhQComd4Ji0ODYUu/EffmPf6QjdvWafufmo=; b=dkHp+sZtUFFODI X6YvbmM9N9lwNTX183x7BIQlFWyaW8zQDyIYefaz+HwqD5OoHGHGsVdzhUrgxHpvYqjztusr931Uu oGd5L02FpIbJpkQ2ScZmR1H5cauaTl/Y3T3hNsRrBlXpfvIi/bCW6hxqm5zzCoqaJYUnQ70eDL593 oofQCxOguymgJ+ifFXZ6I8aLdEibXq6rIh2/lX97U0BwFbuZO9Yrzr8LZffv8lsLxTObN77VBUHri nQF50tYpr/ILhQHtPDrTZCJ1Xc4A6FNMAx7q2Yoimsj+sAdrd5Xz7Uqce+9PRZ0dTDM0Lr1RXYxnf aR+ACOlb1yPcjhRNdqxg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qfxsg-002PFN-1C; Tue, 12 Sep 2023 07:32:18 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qfxsd-002PE6-2o for linux-riscv@lists.infradead.org; Tue, 12 Sep 2023 07:32:17 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4CC12615DE; Tue, 12 Sep 2023 07:32:15 +0000 (UTC) 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230912_003215_952888_B7EA5E7A X-CRM114-Status: UNSURE ( 8.86 ) 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 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/vdso.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 - .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.*) + } /* * 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.*) - } } /* From patchwork Tue Sep 12 07:20: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: 13380942 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 DEC63CA0ECF for ; Tue, 12 Sep 2023 07:32:24 +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=oDROQFZ1CvsDcoaInpjsLxGbzJeR8OFEL5KaMld2qog=; b=H05ZWG4cXTOqWt XIjXhWijuo11gI3uUyCIs/AyQkWIdwhKDIQs0Xh35LqiGs6wSU2IM4wSuviYCqnlkEW4GnAas+J69 h2t8Mz9VIvYW4lvLlQz4W+jNcMDqK3Yv+2TTr0wQpKPgGRMU6z7HChToYNfJcLZP4IeZ+Ej7N9Qwf rIloPyTXRCT0hTihdhoasmcVp9s0n6t5GmxCjXO5+bOZFE17VIvu4F+hoOtmEG8q52PodJhETArMR AJo4PNkJje74sZybkTdbJu8qFpjHSNH6bhW/uCQ99tVeeMluJdvG2hogJCMwdJFOQHYIOK+/IM72c px5FikaZgS6ETUipQzMg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qfxsi-002PGF-1n; Tue, 12 Sep 2023 07:32:20 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qfxsf-002PEn-2F for linux-riscv@lists.infradead.org; Tue, 12 Sep 2023 07:32:19 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1968E615CE; Tue, 12 Sep 2023 07:32:17 +0000 (UTC) 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230912_003217_774253_9781A05F X-CRM114-Status: GOOD ( 12.02 ) 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 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/vdso.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) } - .note : { *(.note.*) } :text :note .dynamic : { *(.dynamic) } :text :dynamic - .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.*) } + .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. */ - . = 0x800; + . = ALIGN(16); .text : { *(.text .text.*) } :text . = ALIGN(4);