linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Jones <ajones@ventanamicro.com>
To: Jisheng Zhang <jszhang@kernel.org>
Cc: Paul Walmsley <paul.walmsley@sifive.com>,
	 Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	 linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] riscv: vdso.lds.S: remove hardcoded 0x800 .text start addr
Date: Fri, 28 Jul 2023 14:58:51 +0200	[thread overview]
Message-ID: <20230728-628baf3727ffccddae0b0663@orel> (raw)
In-Reply-To: <20230726173024.3684-4-jszhang@kernel.org>

On Thu, Jul 27, 2023 at 01:30:24AM +0800, Jisheng Zhang wrote:
> 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 <jszhang@kernel.org>
> ---
>  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);
> -- 
> 2.40.1
>

Reviewed-by: Andrew Jones <ajones@ventanamicro.com>

Thanks,
drew

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2023-07-28 12:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-26 17:30 [PATCH 0/3] riscv: vdso.lds.S: some improvement Jisheng Zhang
2023-07-26 17:30 ` [PATCH 1/3] riscv: vdso.lds.S: drop __alt_start and __alt_end symbols Jisheng Zhang
2023-07-26 17:30 ` [PATCH 2/3] riscv: vdso.lds.S: merge .data section into .rodata section Jisheng Zhang
2023-07-28 12:57   ` Andrew Jones
2023-07-28 14:11     ` Jisheng Zhang
2023-07-26 17:30 ` [PATCH 3/3] riscv: vdso.lds.S: remove hardcoded 0x800 .text start addr Jisheng Zhang
2023-07-28 12:58   ` Andrew Jones [this message]
2023-09-05 14:46 ` [PATCH 0/3] riscv: vdso.lds.S: some improvement Emil Renner Berthing

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230728-628baf3727ffccddae0b0663@orel \
    --to=ajones@ventanamicro.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=jszhang@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).