linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] riscv: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION
@ 2023-05-11 14:12 Jisheng Zhang
  2023-05-11 14:12 ` [PATCH 1/4] riscv: vmlinux-xip.lds.S: remove .alternative section Jisheng Zhang
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Jisheng Zhang @ 2023-05-11 14:12 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Arnd Bergmann
  Cc: linux-riscv, linux-kernel, linux-arch

When trying to run linux with various opensource riscv core on
resource limited FPGA platforms, for example, those FPGAs with less
than 16MB SDRAM, I want to save mem as much as possible. One of the
major technologies is kernel size optimizations, I found that riscv
does not currently support HAVE_LD_DEAD_CODE_DATA_ELIMINATION, which
passes -fdata-sections, -ffunction-sections to CFLAGS and passes the
--gc-sections flag to the linker.

This not only benefits my case on FPGA but also benefits defconfigs.
Here are some notable improvements from enabling this with defconfigs:

nommu_k210_defconfig:
   text    data     bss     dec     hex
1112009  410288   59837 1582134  182436     before
 962838  376656   51285 1390779  1538bb     after

rv32_defconfig:
   text    data     bss     dec     hex
8804455 2816544  290577 11911576 b5c198     before
8692295 2779872  288977 11761144 b375f8     after

defconfig:
   text    data     bss     dec     hex
9438267 3391332  485333 13314932 cb2b74     before
9285914 3350052  483349 13119315 c82f53     after

patch1 and patch2 are clean ups.
patch3 fixes a typo.
patch4 finally enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION for riscv.

Jisheng Zhang (4):
  riscv: vmlinux-xip.lds.S: remove .alternative section
  riscv: move HAVE_RETHOOK to keep entries sorted
  riscv: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION
  vmlinux.lds.h: use correct .init.data.* section name

 arch/riscv/Kconfig                  | 3 ++-
 arch/riscv/kernel/vmlinux-xip.lds.S | 6 ------
 arch/riscv/kernel/vmlinux.lds.S     | 6 +++---
 include/asm-generic/vmlinux.lds.h   | 2 +-
 4 files changed, 6 insertions(+), 11 deletions(-)

-- 
2.40.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/4] riscv: vmlinux-xip.lds.S: remove .alternative section
  2023-05-11 14:12 [PATCH 0/4] riscv: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION Jisheng Zhang
@ 2023-05-11 14:12 ` Jisheng Zhang
  2023-05-12 13:51   ` Conor Dooley
  2023-05-11 14:12 ` [PATCH 2/4] riscv: move HAVE_RETHOOK to keep entries sorted Jisheng Zhang
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 12+ messages in thread
From: Jisheng Zhang @ 2023-05-11 14:12 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Arnd Bergmann
  Cc: linux-riscv, linux-kernel, linux-arch

ALTERNATIVE mechanism can't work on XIP, and this is also reflected by
below Kconfig dependency:

RISCV_ALTERNATIVE
	...
	depends on !XIP_KERNEL
	...

So there's no .alternative section at all for XIP case, remove it.

Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
---
 arch/riscv/kernel/vmlinux-xip.lds.S | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/arch/riscv/kernel/vmlinux-xip.lds.S b/arch/riscv/kernel/vmlinux-xip.lds.S
index eab9edc3b631..50767647fbc6 100644
--- a/arch/riscv/kernel/vmlinux-xip.lds.S
+++ b/arch/riscv/kernel/vmlinux-xip.lds.S
@@ -98,12 +98,6 @@ SECTIONS
 		__soc_builtin_dtb_table_end = .;
 	}
 
-	. = ALIGN(8);
-	.alternative : {
-		__alt_start = .;
-		*(.alternative)
-		__alt_end = .;
-	}
 	__init_end = .;
 
 	. = ALIGN(16);
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/4] riscv: move HAVE_RETHOOK to keep entries sorted
  2023-05-11 14:12 [PATCH 0/4] riscv: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION Jisheng Zhang
  2023-05-11 14:12 ` [PATCH 1/4] riscv: vmlinux-xip.lds.S: remove .alternative section Jisheng Zhang
@ 2023-05-11 14:12 ` Jisheng Zhang
  2023-05-12 13:54   ` Conor Dooley
  2023-05-11 14:12 ` [PATCH 3/4] vmlinux.lds.h: use correct .init.data.* section name Jisheng Zhang
  2023-05-11 14:12 ` [PATCH 4/4] riscv: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION Jisheng Zhang
  3 siblings, 1 reply; 12+ messages in thread
From: Jisheng Zhang @ 2023-05-11 14:12 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Arnd Bergmann
  Cc: linux-riscv, linux-kernel, linux-arch

Commit b57c2f124098 ("riscv: add riscv rethook implementation") selects
the HAVE_RETHOOK option for the first time in riscv, but it breaks the
entries order. Properly move its location to keep entries sorted.

Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
---
 arch/riscv/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index 348c0fa1fc8c..f0663b52d052 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -110,7 +110,6 @@ config RISCV
 	select HAVE_KPROBES if !XIP_KERNEL
 	select HAVE_KPROBES_ON_FTRACE if !XIP_KERNEL
 	select HAVE_KRETPROBES if !XIP_KERNEL
-	select HAVE_RETHOOK if !XIP_KERNEL
 	select HAVE_MOVE_PMD
 	select HAVE_MOVE_PUD
 	select HAVE_PCI
@@ -119,6 +118,7 @@ config RISCV
 	select HAVE_PERF_USER_STACK_DUMP
 	select HAVE_POSIX_CPU_TIMERS_TASK_WORK
 	select HAVE_REGS_AND_STACK_ACCESS_API
+	select HAVE_RETHOOK if !XIP_KERNEL
 	select HAVE_RSEQ
 	select HAVE_STACKPROTECTOR
 	select HAVE_SYSCALL_TRACEPOINTS
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/4] vmlinux.lds.h: use correct .init.data.* section name
  2023-05-11 14:12 [PATCH 0/4] riscv: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION Jisheng Zhang
  2023-05-11 14:12 ` [PATCH 1/4] riscv: vmlinux-xip.lds.S: remove .alternative section Jisheng Zhang
  2023-05-11 14:12 ` [PATCH 2/4] riscv: move HAVE_RETHOOK to keep entries sorted Jisheng Zhang
@ 2023-05-11 14:12 ` Jisheng Zhang
  2023-06-01  4:58   ` Guo Ren
  2023-05-11 14:12 ` [PATCH 4/4] riscv: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION Jisheng Zhang
  3 siblings, 1 reply; 12+ messages in thread
From: Jisheng Zhang @ 2023-05-11 14:12 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Arnd Bergmann
  Cc: linux-riscv, linux-kernel, linux-arch

If building with -fdata-sections on riscv, LD_ORPHAN_WARN will warn
similar as below:

riscv64-linux-gnu-ld: warning: orphan section `.init.data.efi_loglevel'
from `./drivers/firmware/efi/libstub/printk.stub.o' being placed in
section `.init.data.efi_loglevel'

I believe this is caused by a a typo:
init.data.* should be .init.data.*

Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
---
 include/asm-generic/vmlinux.lds.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index d1f57e4868ed..371026ca7221 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -688,7 +688,7 @@
 /* init and exit section handling */
 #define INIT_DATA							\
 	KEEP(*(SORT(___kentry+*)))					\
-	*(.init.data init.data.*)					\
+	*(.init.data .init.data.*)					\
 	MEM_DISCARD(init.data*)						\
 	KERNEL_CTORS()							\
 	MCOUNT_REC()							\
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 4/4] riscv: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION
  2023-05-11 14:12 [PATCH 0/4] riscv: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION Jisheng Zhang
                   ` (2 preceding siblings ...)
  2023-05-11 14:12 ` [PATCH 3/4] vmlinux.lds.h: use correct .init.data.* section name Jisheng Zhang
@ 2023-05-11 14:12 ` Jisheng Zhang
  2023-05-12 13:58   ` Conor Dooley
  3 siblings, 1 reply; 12+ messages in thread
From: Jisheng Zhang @ 2023-05-11 14:12 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Arnd Bergmann
  Cc: linux-riscv, linux-kernel, linux-arch

When trying to run linux with various opensource riscv core on
resource limited FPGA platforms, for example, those FPGAs with less
than 16MB SDRAM, I want to save mem as much as possible. One of the
major technologies is kernel size optimizations, I found that riscv
does not currently support HAVE_LD_DEAD_CODE_DATA_ELIMINATION, which
passes -fdata-sections, -ffunction-sections to CFLAGS and passes the
--gc-sections flag to the linker.

This not only benefits my case on FPGA but also benefits defconfigs.
Here are some notable improvements from enabling this with defconfigs:

nommu_k210_defconfig:
   text    data     bss     dec     hex
1112009  410288   59837 1582134  182436     before
 962838  376656   51285 1390779  1538bb     after

rv32_defconfig:
   text    data     bss     dec     hex
8804455 2816544  290577 11911576 b5c198     before
8692295 2779872  288977 11761144 b375f8     after

defconfig:
   text    data     bss     dec     hex
9438267 3391332  485333 13314932 cb2b74     before
9285914 3350052  483349 13119315 c82f53     after

Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
---
 arch/riscv/Kconfig              | 1 +
 arch/riscv/kernel/vmlinux.lds.S | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index f0663b52d052..a5feab2c3037 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -110,6 +110,7 @@ config RISCV
 	select HAVE_KPROBES if !XIP_KERNEL
 	select HAVE_KPROBES_ON_FTRACE if !XIP_KERNEL
 	select HAVE_KRETPROBES if !XIP_KERNEL
+	select HAVE_LD_DEAD_CODE_DATA_ELIMINATION
 	select HAVE_MOVE_PMD
 	select HAVE_MOVE_PUD
 	select HAVE_PCI
diff --git a/arch/riscv/kernel/vmlinux.lds.S b/arch/riscv/kernel/vmlinux.lds.S
index e5f9f4677bbf..492dd4b8f3d6 100644
--- a/arch/riscv/kernel/vmlinux.lds.S
+++ b/arch/riscv/kernel/vmlinux.lds.S
@@ -85,11 +85,11 @@ SECTIONS
 	INIT_DATA_SECTION(16)
 
 	.init.pi : {
-		*(.init.pi*)
+		KEEP(*(.init.pi*))
 	}
 
 	.init.bss : {
-		*(.init.bss)	/* from the EFI stub */
+		KEEP(*(.init.bss*))	/* from the EFI stub */
 	}
 	.exit.data :
 	{
@@ -112,7 +112,7 @@ SECTIONS
 	. = ALIGN(8);
 	.alternative : {
 		__alt_start = .;
-		*(.alternative)
+		KEEP(*(.alternative))
 		__alt_end = .;
 	}
 	__init_end = .;
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/4] riscv: vmlinux-xip.lds.S: remove .alternative section
  2023-05-11 14:12 ` [PATCH 1/4] riscv: vmlinux-xip.lds.S: remove .alternative section Jisheng Zhang
@ 2023-05-12 13:51   ` Conor Dooley
  2023-05-12 15:36     ` Jisheng Zhang
  0 siblings, 1 reply; 12+ messages in thread
From: Conor Dooley @ 2023-05-12 13:51 UTC (permalink / raw)
  To: Jisheng Zhang
  Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Arnd Bergmann,
	linux-riscv, linux-kernel, linux-arch

[-- Attachment #1: Type: text/plain, Size: 1121 bytes --]

On Thu, May 11, 2023 at 10:12:08PM +0800, Jisheng Zhang wrote:
> ALTERNATIVE mechanism can't work on XIP, and this is also reflected by
> below Kconfig dependency:
> 
> RISCV_ALTERNATIVE
> 	...
> 	depends on !XIP_KERNEL
> 	...
> 
> So there's no .alternative section at all for XIP case, remove it.
> 
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>

Reviewed-by: Conor Dooley <conor.dooley@microchip.com>

Just to note, this series doesn't apply on top of -rc1 - what is the
base that you used?

Cheers,
Conor.

> ---
>  arch/riscv/kernel/vmlinux-xip.lds.S | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/arch/riscv/kernel/vmlinux-xip.lds.S b/arch/riscv/kernel/vmlinux-xip.lds.S
> index eab9edc3b631..50767647fbc6 100644
> --- a/arch/riscv/kernel/vmlinux-xip.lds.S
> +++ b/arch/riscv/kernel/vmlinux-xip.lds.S
> @@ -98,12 +98,6 @@ SECTIONS
>  		__soc_builtin_dtb_table_end = .;
>  	}
>  
> -	. = ALIGN(8);
> -	.alternative : {
> -		__alt_start = .;
> -		*(.alternative)
> -		__alt_end = .;
> -	}
>  	__init_end = .;
>  
>  	. = ALIGN(16);
> -- 
> 2.40.1
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/4] riscv: move HAVE_RETHOOK to keep entries sorted
  2023-05-11 14:12 ` [PATCH 2/4] riscv: move HAVE_RETHOOK to keep entries sorted Jisheng Zhang
@ 2023-05-12 13:54   ` Conor Dooley
  0 siblings, 0 replies; 12+ messages in thread
From: Conor Dooley @ 2023-05-12 13:54 UTC (permalink / raw)
  To: Jisheng Zhang
  Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Arnd Bergmann,
	linux-riscv, linux-kernel, linux-arch

[-- Attachment #1: Type: text/plain, Size: 1402 bytes --]

On Thu, May 11, 2023 at 10:12:09PM +0800, Jisheng Zhang wrote:
> Commit b57c2f124098 ("riscv: add riscv rethook implementation") selects
> the HAVE_RETHOOK option for the first time in riscv, but it breaks the
> entries order. Properly move its location to keep entries sorted.

The entries need a rework in general, but it's only really worth doing
the whole lot during the merge window to avoid a rake of conflicts.

Reviewed-by: Conor Dooley <conor.dooley@microchip.com>

Thanks,
Conor.

> 
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> ---
>  arch/riscv/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index 348c0fa1fc8c..f0663b52d052 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -110,7 +110,6 @@ config RISCV
>  	select HAVE_KPROBES if !XIP_KERNEL
>  	select HAVE_KPROBES_ON_FTRACE if !XIP_KERNEL
>  	select HAVE_KRETPROBES if !XIP_KERNEL
> -	select HAVE_RETHOOK if !XIP_KERNEL
>  	select HAVE_MOVE_PMD
>  	select HAVE_MOVE_PUD
>  	select HAVE_PCI
> @@ -119,6 +118,7 @@ config RISCV
>  	select HAVE_PERF_USER_STACK_DUMP
>  	select HAVE_POSIX_CPU_TIMERS_TASK_WORK
>  	select HAVE_REGS_AND_STACK_ACCESS_API
> +	select HAVE_RETHOOK if !XIP_KERNEL
>  	select HAVE_RSEQ
>  	select HAVE_STACKPROTECTOR
>  	select HAVE_SYSCALL_TRACEPOINTS
> -- 
> 2.40.1
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 4/4] riscv: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION
  2023-05-11 14:12 ` [PATCH 4/4] riscv: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION Jisheng Zhang
@ 2023-05-12 13:58   ` Conor Dooley
  2023-05-12 15:16     ` Conor Dooley
  0 siblings, 1 reply; 12+ messages in thread
From: Conor Dooley @ 2023-05-12 13:58 UTC (permalink / raw)
  To: Jisheng Zhang
  Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Arnd Bergmann,
	linux-riscv, linux-kernel, linux-arch

[-- Attachment #1: Type: text/plain, Size: 647 bytes --]

On Thu, May 11, 2023 at 10:12:11PM +0800, Jisheng Zhang wrote:

> diff --git a/arch/riscv/kernel/vmlinux.lds.S b/arch/riscv/kernel/vmlinux.lds.S
> index e5f9f4677bbf..492dd4b8f3d6 100644
> --- a/arch/riscv/kernel/vmlinux.lds.S
> +++ b/arch/riscv/kernel/vmlinux.lds.S
> @@ -85,11 +85,11 @@ SECTIONS
>  	INIT_DATA_SECTION(16)
>  
>  	.init.pi : {
> -		*(.init.pi*)
> +		KEEP(*(.init.pi*))
>  	}

This section no longer exists in v6.4-rc1, it is now:
	/* Those sections result from the compilation of kernel/pi/string.c */
	.init.pidata : {
		*(.init.srodata.cst8*)
		*(.init__bug_table*)
		*(.init.sdata*)
	}

Cheers,
Conor.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 4/4] riscv: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION
  2023-05-12 13:58   ` Conor Dooley
@ 2023-05-12 15:16     ` Conor Dooley
  2023-05-12 15:39       ` Jisheng Zhang
  0 siblings, 1 reply; 12+ messages in thread
From: Conor Dooley @ 2023-05-12 15:16 UTC (permalink / raw)
  To: Conor Dooley
  Cc: Jisheng Zhang, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Arnd Bergmann, linux-riscv, linux-kernel, linux-arch

[-- Attachment #1: Type: text/plain, Size: 950 bytes --]

On Fri, May 12, 2023 at 02:58:49PM +0100, Conor Dooley wrote:
> On Thu, May 11, 2023 at 10:12:11PM +0800, Jisheng Zhang wrote:
> 
> > diff --git a/arch/riscv/kernel/vmlinux.lds.S b/arch/riscv/kernel/vmlinux.lds.S
> > index e5f9f4677bbf..492dd4b8f3d6 100644
> > --- a/arch/riscv/kernel/vmlinux.lds.S
> > +++ b/arch/riscv/kernel/vmlinux.lds.S
> > @@ -85,11 +85,11 @@ SECTIONS
> >  	INIT_DATA_SECTION(16)
> >  
> >  	.init.pi : {
> > -		*(.init.pi*)
> > +		KEEP(*(.init.pi*))
> >  	}
> 
> This section no longer exists in v6.4-rc1, it is now:
> 	/* Those sections result from the compilation of kernel/pi/string.c */
> 	.init.pidata : {
> 		*(.init.srodata.cst8*)
> 		*(.init__bug_table*)
> 		*(.init.sdata*)
> 	}

Ahh, I see what has happened. This series was made on top of
riscv/fixes, but none of the patches are marked as a fix, leading to the
automation testing this as new content.

Sorry for the noise on this patch.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/4] riscv: vmlinux-xip.lds.S: remove .alternative section
  2023-05-12 13:51   ` Conor Dooley
@ 2023-05-12 15:36     ` Jisheng Zhang
  0 siblings, 0 replies; 12+ messages in thread
From: Jisheng Zhang @ 2023-05-12 15:36 UTC (permalink / raw)
  To: Conor Dooley
  Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Arnd Bergmann,
	linux-riscv, linux-kernel, linux-arch

On Fri, May 12, 2023 at 02:51:56PM +0100, Conor Dooley wrote:
> On Thu, May 11, 2023 at 10:12:08PM +0800, Jisheng Zhang wrote:
> > ALTERNATIVE mechanism can't work on XIP, and this is also reflected by
> > below Kconfig dependency:
> > 
> > RISCV_ALTERNATIVE
> > 	...
> > 	depends on !XIP_KERNEL
> > 	...
> > 
> > So there's no .alternative section at all for XIP case, remove it.
> > 
> > Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> 
> Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
> 
> Just to note, this series doesn't apply on top of -rc1 - what is the
> base that you used?

rc1 + Palmer's fix branch

Thanks
> 
> Cheers,
> Conor.
> 
> > ---
> >  arch/riscv/kernel/vmlinux-xip.lds.S | 6 ------
> >  1 file changed, 6 deletions(-)
> > 
> > diff --git a/arch/riscv/kernel/vmlinux-xip.lds.S b/arch/riscv/kernel/vmlinux-xip.lds.S
> > index eab9edc3b631..50767647fbc6 100644
> > --- a/arch/riscv/kernel/vmlinux-xip.lds.S
> > +++ b/arch/riscv/kernel/vmlinux-xip.lds.S
> > @@ -98,12 +98,6 @@ SECTIONS
> >  		__soc_builtin_dtb_table_end = .;
> >  	}
> >  
> > -	. = ALIGN(8);
> > -	.alternative : {
> > -		__alt_start = .;
> > -		*(.alternative)
> > -		__alt_end = .;
> > -	}
> >  	__init_end = .;
> >  
> >  	. = ALIGN(16);
> > -- 
> > 2.40.1
> > 



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 4/4] riscv: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION
  2023-05-12 15:16     ` Conor Dooley
@ 2023-05-12 15:39       ` Jisheng Zhang
  0 siblings, 0 replies; 12+ messages in thread
From: Jisheng Zhang @ 2023-05-12 15:39 UTC (permalink / raw)
  To: Conor Dooley
  Cc: Conor Dooley, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Arnd Bergmann, linux-riscv, linux-kernel, linux-arch

On Fri, May 12, 2023 at 04:16:31PM +0100, Conor Dooley wrote:
> On Fri, May 12, 2023 at 02:58:49PM +0100, Conor Dooley wrote:
> > On Thu, May 11, 2023 at 10:12:11PM +0800, Jisheng Zhang wrote:
> > 
> > > diff --git a/arch/riscv/kernel/vmlinux.lds.S b/arch/riscv/kernel/vmlinux.lds.S
> > > index e5f9f4677bbf..492dd4b8f3d6 100644
> > > --- a/arch/riscv/kernel/vmlinux.lds.S
> > > +++ b/arch/riscv/kernel/vmlinux.lds.S
> > > @@ -85,11 +85,11 @@ SECTIONS
> > >  	INIT_DATA_SECTION(16)
> > >  
> > >  	.init.pi : {
> > > -		*(.init.pi*)
> > > +		KEEP(*(.init.pi*))
> > >  	}
> > 
> > This section no longer exists in v6.4-rc1, it is now:
> > 	/* Those sections result from the compilation of kernel/pi/string.c */
> > 	.init.pidata : {
> > 		*(.init.srodata.cst8*)
> > 		*(.init__bug_table*)
> > 		*(.init.sdata*)
> > 	}
> 
> Ahh, I see what has happened. This series was made on top of
> riscv/fixes, but none of the patches are marked as a fix, leading to the

I need to touch the sections, and there's a fix in Palmer's tree which
will rename the section name, so rebased on the fix HEAD.

> automation testing this as new content.
> 
> Sorry for the noise on this patch.

Thank you for your review.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/4] vmlinux.lds.h: use correct .init.data.* section name
  2023-05-11 14:12 ` [PATCH 3/4] vmlinux.lds.h: use correct .init.data.* section name Jisheng Zhang
@ 2023-06-01  4:58   ` Guo Ren
  0 siblings, 0 replies; 12+ messages in thread
From: Guo Ren @ 2023-06-01  4:58 UTC (permalink / raw)
  To: Jisheng Zhang
  Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Arnd Bergmann,
	linux-riscv, linux-kernel, linux-arch

On Thu, May 11, 2023 at 10:27 PM Jisheng Zhang <jszhang@kernel.org> wrote:
>
> If building with -fdata-sections on riscv, LD_ORPHAN_WARN will warn
> similar as below:
>
> riscv64-linux-gnu-ld: warning: orphan section `.init.data.efi_loglevel'
> from `./drivers/firmware/efi/libstub/printk.stub.o' being placed in
> section `.init.data.efi_loglevel'
>
> I believe this is caused by a a typo:
> init.data.* should be .init.data.*
>
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
Seems it's a fixup for all architectures, what's the Fix: tag?

> ---
>  include/asm-generic/vmlinux.lds.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
> index d1f57e4868ed..371026ca7221 100644
> --- a/include/asm-generic/vmlinux.lds.h
> +++ b/include/asm-generic/vmlinux.lds.h
> @@ -688,7 +688,7 @@
>  /* init and exit section handling */
>  #define INIT_DATA                                                      \
>         KEEP(*(SORT(___kentry+*)))                                      \
> -       *(.init.data init.data.*)                                       \
> +       *(.init.data .init.data.*)                                      \
>         MEM_DISCARD(init.data*)                                         \
>         KERNEL_CTORS()                                                  \
>         MCOUNT_REC()                                                    \
> --
> 2.40.1
>


-- 
Best Regards
 Guo Ren

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-06-01  4:59 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-11 14:12 [PATCH 0/4] riscv: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION Jisheng Zhang
2023-05-11 14:12 ` [PATCH 1/4] riscv: vmlinux-xip.lds.S: remove .alternative section Jisheng Zhang
2023-05-12 13:51   ` Conor Dooley
2023-05-12 15:36     ` Jisheng Zhang
2023-05-11 14:12 ` [PATCH 2/4] riscv: move HAVE_RETHOOK to keep entries sorted Jisheng Zhang
2023-05-12 13:54   ` Conor Dooley
2023-05-11 14:12 ` [PATCH 3/4] vmlinux.lds.h: use correct .init.data.* section name Jisheng Zhang
2023-06-01  4:58   ` Guo Ren
2023-05-11 14:12 ` [PATCH 4/4] riscv: enable HAVE_LD_DEAD_CODE_DATA_ELIMINATION Jisheng Zhang
2023-05-12 13:58   ` Conor Dooley
2023-05-12 15:16     ` Conor Dooley
2023-05-12 15:39       ` Jisheng Zhang

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).