diff mbox series

[2/3] riscv: vdso.lds.S: merge .data section into .rodata section

Message ID 20230726173024.3684-3-jszhang@kernel.org (mailing list archive)
State Superseded
Headers show
Series riscv: vdso.lds.S: some improvement | expand

Checks

Context Check Description
conchuod/cover_letter success Series has a cover letter
conchuod/tree_selection success Guessed tree name to be for-next at HEAD 471aba2e4760
conchuod/fixes_present success Fixes tag not required for -next series
conchuod/maintainers_pattern success MAINTAINERS pattern errors before the patch: 4 and now 4
conchuod/verify_signedoff success Signed-off-by tag matches author and committer
conchuod/kdoc success Errors and warnings before: 0 this patch: 0
conchuod/build_rv64_clang_allmodconfig success Errors and warnings before: 9 this patch: 9
conchuod/module_param success Was 0 now: 0
conchuod/build_rv64_gcc_allmodconfig success Errors and warnings before: 10 this patch: 10
conchuod/build_rv32_defconfig success Build OK
conchuod/dtb_warn_rv64 success Errors and warnings before: 3 this patch: 3
conchuod/header_inline success No static functions without inline keyword in header files
conchuod/checkpatch success total: 0 errors, 0 warnings, 0 checks, 27 lines checked
conchuod/build_rv64_nommu_k210_defconfig success Build OK
conchuod/verify_fixes success No Fixes tag
conchuod/build_rv64_nommu_virt_defconfig success Build OK

Commit Message

Jisheng Zhang July 26, 2023, 5:30 p.m. UTC
The .data section doesn't need to be separate from .rodata section,
they are both readonly.

Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
---
 arch/riscv/kernel/vdso/vdso.lds.S | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

Comments

Andrew Jones July 28, 2023, 12:57 p.m. UTC | #1
On Thu, Jul 27, 2023 at 01:30:23AM +0800, Jisheng Zhang wrote:
> The .data section doesn't need to be separate from .rodata section,
> they are both readonly.
> 
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> ---
>  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.*)

Looking at other architectures, it appears the last three lines of
sections could be discarded, but I don't know enough about this to
state they should be.

Thanks,
drew


> +	}
>  
>  	/*
>  	 * 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.*)
> -	}
>  }
>  
>  /*
> -- 
> 2.40.1
>
Jisheng Zhang July 28, 2023, 2:11 p.m. UTC | #2
On Fri, Jul 28, 2023 at 02:57:03PM +0200, Andrew Jones wrote:
> On Thu, Jul 27, 2023 at 01:30:23AM +0800, Jisheng Zhang wrote:
> > The .data section doesn't need to be separate from .rodata section,
> > they are both readonly.
> > 
> > Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> > ---
> >  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.*)
> 
> Looking at other architectures, it appears the last three lines of
> sections could be discarded, but I don't know enough about this to

Hi Andrew,

I checked x86, they still keep those sections. From another side,
even if those sections are not needed, removing unused sections could
be an independent patch, for safe reason or bisect reason.

Thanks


> state they should be.
> 
> Thanks,
> drew
> 
> 
> > +	}
> >  
> >  	/*
> >  	 * 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.*)
> > -	}
> >  }
> >  
> >  /*
> > -- 
> > 2.40.1
> >
diff mbox series

Patch

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.*)
-	}
 }
 
 /*