All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/5] riscv: improve link and support ARCH_WANT_LD_ORPHAN_WARN
@ 2023-01-19 15:54 ` Jisheng Zhang
  0 siblings, 0 replies; 18+ messages in thread
From: Jisheng Zhang @ 2023-01-19 15:54 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Masahiro Yamada,
	Kees Cook, Nathan Chancellor
  Cc: Conor Dooley, linux-riscv, linux-kernel

This series tries to improve link time handling of riscv:
patch1 adds the missing RUNTIME_DISCARD_EXIT as suggested by Masahiro.

Similar as other architectures such as x86, arm64 and so on, enable
ARCH_WANT_LD_ORPHAN_WARN to enable linker orphan warnings to prevent
from missing any new sections in future. So the following two patches
are preparation ones, and the last patch finally selects
ARCH_WANT_LD_ORPHAN_WARN

Since v1:
  - add one more patch to catch .init.bss from EFI stub

Jisheng Zhang (5):
  riscv: lds: define RUNTIME_DISCARD_EXIT
  riscv: vmlinux.lds.S: explicitly catch .rela.dyn symbols
  riscv: vmlinux.lds.S: explicitly catch .riscv.attributes sections
  riscv: vmlinux.lds.S: explicitly catch .init.bss sections from EFI
    stub
  riscv: select ARCH_WANT_LD_ORPHAN_WARN for !XIP_KERNEL

 arch/riscv/Kconfig              | 1 +
 arch/riscv/kernel/vmlinux.lds.S | 9 +++++++++
 2 files changed, 10 insertions(+)

-- 
2.38.1


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

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

* [PATCH v2 0/5] riscv: improve link and support ARCH_WANT_LD_ORPHAN_WARN
@ 2023-01-19 15:54 ` Jisheng Zhang
  0 siblings, 0 replies; 18+ messages in thread
From: Jisheng Zhang @ 2023-01-19 15:54 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Masahiro Yamada,
	Kees Cook, Nathan Chancellor
  Cc: Conor Dooley, linux-riscv, linux-kernel

This series tries to improve link time handling of riscv:
patch1 adds the missing RUNTIME_DISCARD_EXIT as suggested by Masahiro.

Similar as other architectures such as x86, arm64 and so on, enable
ARCH_WANT_LD_ORPHAN_WARN to enable linker orphan warnings to prevent
from missing any new sections in future. So the following two patches
are preparation ones, and the last patch finally selects
ARCH_WANT_LD_ORPHAN_WARN

Since v1:
  - add one more patch to catch .init.bss from EFI stub

Jisheng Zhang (5):
  riscv: lds: define RUNTIME_DISCARD_EXIT
  riscv: vmlinux.lds.S: explicitly catch .rela.dyn symbols
  riscv: vmlinux.lds.S: explicitly catch .riscv.attributes sections
  riscv: vmlinux.lds.S: explicitly catch .init.bss sections from EFI
    stub
  riscv: select ARCH_WANT_LD_ORPHAN_WARN for !XIP_KERNEL

 arch/riscv/Kconfig              | 1 +
 arch/riscv/kernel/vmlinux.lds.S | 9 +++++++++
 2 files changed, 10 insertions(+)

-- 
2.38.1


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

* [PATCH v2 1/5] riscv: lds: define RUNTIME_DISCARD_EXIT
  2023-01-19 15:54 ` Jisheng Zhang
@ 2023-01-19 15:54   ` Jisheng Zhang
  -1 siblings, 0 replies; 18+ messages in thread
From: Jisheng Zhang @ 2023-01-19 15:54 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Masahiro Yamada,
	Kees Cook, Nathan Chancellor
  Cc: Conor Dooley, linux-riscv, linux-kernel

riscv discards .exit.* sections at run-time but doesn't define
RUNTIME_DISCARD_EXIT. However, the .exit.* sections are still allocated
and kept even if the generic DISCARDS would discard the sections due
to missing RUNTIME_DISCARD_EXIT, because the DISCARD sits at the end of
the linker script. Add the missing RUNTIME_DISCARD_EXIT define so that
it still works if we move DISCARD up or even at the beginning of the
linker script.

Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
Suggested-by: Masahiro Yamada <masahiroy@kernel.org>
---
 arch/riscv/kernel/vmlinux.lds.S | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/riscv/kernel/vmlinux.lds.S b/arch/riscv/kernel/vmlinux.lds.S
index 4e6c88aa4d87..07c19f2a288c 100644
--- a/arch/riscv/kernel/vmlinux.lds.S
+++ b/arch/riscv/kernel/vmlinux.lds.S
@@ -5,6 +5,7 @@
  */
 
 #define RO_EXCEPTION_TABLE_ALIGN	4
+#define RUNTIME_DISCARD_EXIT
 
 #ifdef CONFIG_XIP_KERNEL
 #include "vmlinux-xip.lds.S"
-- 
2.38.1


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

* [PATCH v2 1/5] riscv: lds: define RUNTIME_DISCARD_EXIT
@ 2023-01-19 15:54   ` Jisheng Zhang
  0 siblings, 0 replies; 18+ messages in thread
From: Jisheng Zhang @ 2023-01-19 15:54 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Masahiro Yamada,
	Kees Cook, Nathan Chancellor
  Cc: Conor Dooley, linux-riscv, linux-kernel

riscv discards .exit.* sections at run-time but doesn't define
RUNTIME_DISCARD_EXIT. However, the .exit.* sections are still allocated
and kept even if the generic DISCARDS would discard the sections due
to missing RUNTIME_DISCARD_EXIT, because the DISCARD sits at the end of
the linker script. Add the missing RUNTIME_DISCARD_EXIT define so that
it still works if we move DISCARD up or even at the beginning of the
linker script.

Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
Suggested-by: Masahiro Yamada <masahiroy@kernel.org>
---
 arch/riscv/kernel/vmlinux.lds.S | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/riscv/kernel/vmlinux.lds.S b/arch/riscv/kernel/vmlinux.lds.S
index 4e6c88aa4d87..07c19f2a288c 100644
--- a/arch/riscv/kernel/vmlinux.lds.S
+++ b/arch/riscv/kernel/vmlinux.lds.S
@@ -5,6 +5,7 @@
  */
 
 #define RO_EXCEPTION_TABLE_ALIGN	4
+#define RUNTIME_DISCARD_EXIT
 
 #ifdef CONFIG_XIP_KERNEL
 #include "vmlinux-xip.lds.S"
-- 
2.38.1


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

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

* [PATCH v2 2/5] riscv: vmlinux.lds.S: explicitly catch .rela.dyn symbols
  2023-01-19 15:54 ` Jisheng Zhang
@ 2023-01-19 15:54   ` Jisheng Zhang
  -1 siblings, 0 replies; 18+ messages in thread
From: Jisheng Zhang @ 2023-01-19 15:54 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Masahiro Yamada,
	Kees Cook, Nathan Chancellor
  Cc: Conor Dooley, linux-riscv, linux-kernel

When enabling linker orphan section warning, I got warnings similar as
below:
riscv64-linux-gnu-ld: warning: orphan section `.rela.text' from
`init/main.o' being placed in section `.rela.dyn'

Use the approach similar as ARM64 does and declare it in vmlinux.lds.S

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

diff --git a/arch/riscv/kernel/vmlinux.lds.S b/arch/riscv/kernel/vmlinux.lds.S
index 07c19f2a288c..6a250313b752 100644
--- a/arch/riscv/kernel/vmlinux.lds.S
+++ b/arch/riscv/kernel/vmlinux.lds.S
@@ -97,6 +97,10 @@ SECTIONS
 		*(.rel.dyn*)
 	}
 
+	.rela.dyn : {
+		*(.rela*)
+	}
+
 	__init_data_end = .;
 
 	. = ALIGN(8);
-- 
2.38.1


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

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

* [PATCH v2 2/5] riscv: vmlinux.lds.S: explicitly catch .rela.dyn symbols
@ 2023-01-19 15:54   ` Jisheng Zhang
  0 siblings, 0 replies; 18+ messages in thread
From: Jisheng Zhang @ 2023-01-19 15:54 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Masahiro Yamada,
	Kees Cook, Nathan Chancellor
  Cc: Conor Dooley, linux-riscv, linux-kernel

When enabling linker orphan section warning, I got warnings similar as
below:
riscv64-linux-gnu-ld: warning: orphan section `.rela.text' from
`init/main.o' being placed in section `.rela.dyn'

Use the approach similar as ARM64 does and declare it in vmlinux.lds.S

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

diff --git a/arch/riscv/kernel/vmlinux.lds.S b/arch/riscv/kernel/vmlinux.lds.S
index 07c19f2a288c..6a250313b752 100644
--- a/arch/riscv/kernel/vmlinux.lds.S
+++ b/arch/riscv/kernel/vmlinux.lds.S
@@ -97,6 +97,10 @@ SECTIONS
 		*(.rel.dyn*)
 	}
 
+	.rela.dyn : {
+		*(.rela*)
+	}
+
 	__init_data_end = .;
 
 	. = ALIGN(8);
-- 
2.38.1


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

* [PATCH v2 3/5] riscv: vmlinux.lds.S: explicitly catch .riscv.attributes sections
  2023-01-19 15:54 ` Jisheng Zhang
@ 2023-01-19 15:54   ` Jisheng Zhang
  -1 siblings, 0 replies; 18+ messages in thread
From: Jisheng Zhang @ 2023-01-19 15:54 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Masahiro Yamada,
	Kees Cook, Nathan Chancellor
  Cc: Conor Dooley, linux-riscv, linux-kernel

When enabling linker orphan section warning, I got warnings similar as
below:
riscv64-linux-gnu-ld: warning: orphan section `.riscv.attributes' from
`init/main.o' being placed in section `.riscv.attributes'

While I don't see any usage of .riscv.attributes sections' in kernel
now, just catch the sections so that we can enable linker orphan
section warning.

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

diff --git a/arch/riscv/kernel/vmlinux.lds.S b/arch/riscv/kernel/vmlinux.lds.S
index 6a250313b752..7eb3d25d0dae 100644
--- a/arch/riscv/kernel/vmlinux.lds.S
+++ b/arch/riscv/kernel/vmlinux.lds.S
@@ -146,6 +146,7 @@ SECTIONS
 	STABS_DEBUG
 	DWARF_DEBUG
 	ELF_DETAILS
+	.riscv.attributes 0 : { *(.riscv.attributes) }
 
 	DISCARDS
 }
-- 
2.38.1


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

* [PATCH v2 3/5] riscv: vmlinux.lds.S: explicitly catch .riscv.attributes sections
@ 2023-01-19 15:54   ` Jisheng Zhang
  0 siblings, 0 replies; 18+ messages in thread
From: Jisheng Zhang @ 2023-01-19 15:54 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Masahiro Yamada,
	Kees Cook, Nathan Chancellor
  Cc: Conor Dooley, linux-riscv, linux-kernel

When enabling linker orphan section warning, I got warnings similar as
below:
riscv64-linux-gnu-ld: warning: orphan section `.riscv.attributes' from
`init/main.o' being placed in section `.riscv.attributes'

While I don't see any usage of .riscv.attributes sections' in kernel
now, just catch the sections so that we can enable linker orphan
section warning.

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

diff --git a/arch/riscv/kernel/vmlinux.lds.S b/arch/riscv/kernel/vmlinux.lds.S
index 6a250313b752..7eb3d25d0dae 100644
--- a/arch/riscv/kernel/vmlinux.lds.S
+++ b/arch/riscv/kernel/vmlinux.lds.S
@@ -146,6 +146,7 @@ SECTIONS
 	STABS_DEBUG
 	DWARF_DEBUG
 	ELF_DETAILS
+	.riscv.attributes 0 : { *(.riscv.attributes) }
 
 	DISCARDS
 }
-- 
2.38.1


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

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

* [PATCH v2 4/5] riscv: vmlinux.lds.S: explicitly catch .init.bss sections from EFI stub
  2023-01-19 15:54 ` Jisheng Zhang
@ 2023-01-19 15:54   ` Jisheng Zhang
  -1 siblings, 0 replies; 18+ messages in thread
From: Jisheng Zhang @ 2023-01-19 15:54 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Masahiro Yamada,
	Kees Cook, Nathan Chancellor
  Cc: Conor Dooley, linux-riscv, linux-kernel

When enabling linker orphan section warning, I got warnings similar as
below:
ld.lld: warning:
./drivers/firmware/efi/libstub/lib.a(efi-stub-helper.stub.o):(.init.bss)
is being placed in '.init.bss'

Catch the sections so that we can enable linker orphan section warning.

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

diff --git a/arch/riscv/kernel/vmlinux.lds.S b/arch/riscv/kernel/vmlinux.lds.S
index 7eb3d25d0dae..b2813b5e47a0 100644
--- a/arch/riscv/kernel/vmlinux.lds.S
+++ b/arch/riscv/kernel/vmlinux.lds.S
@@ -87,6 +87,9 @@ SECTIONS
 	/* Start of init data section */
 	__init_data_begin = .;
 	INIT_DATA_SECTION(16)
+	.init.bss : {
+		*(.init.bss)	/* from the EFI stub */
+	}
 	.exit.data :
 	{
 		EXIT_DATA
-- 
2.38.1


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

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

* [PATCH v2 4/5] riscv: vmlinux.lds.S: explicitly catch .init.bss sections from EFI stub
@ 2023-01-19 15:54   ` Jisheng Zhang
  0 siblings, 0 replies; 18+ messages in thread
From: Jisheng Zhang @ 2023-01-19 15:54 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Masahiro Yamada,
	Kees Cook, Nathan Chancellor
  Cc: Conor Dooley, linux-riscv, linux-kernel

When enabling linker orphan section warning, I got warnings similar as
below:
ld.lld: warning:
./drivers/firmware/efi/libstub/lib.a(efi-stub-helper.stub.o):(.init.bss)
is being placed in '.init.bss'

Catch the sections so that we can enable linker orphan section warning.

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

diff --git a/arch/riscv/kernel/vmlinux.lds.S b/arch/riscv/kernel/vmlinux.lds.S
index 7eb3d25d0dae..b2813b5e47a0 100644
--- a/arch/riscv/kernel/vmlinux.lds.S
+++ b/arch/riscv/kernel/vmlinux.lds.S
@@ -87,6 +87,9 @@ SECTIONS
 	/* Start of init data section */
 	__init_data_begin = .;
 	INIT_DATA_SECTION(16)
+	.init.bss : {
+		*(.init.bss)	/* from the EFI stub */
+	}
 	.exit.data :
 	{
 		EXIT_DATA
-- 
2.38.1


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

* [PATCH v2 5/5] riscv: select ARCH_WANT_LD_ORPHAN_WARN for !XIP_KERNEL
  2023-01-19 15:54 ` Jisheng Zhang
@ 2023-01-19 15:54   ` Jisheng Zhang
  -1 siblings, 0 replies; 18+ messages in thread
From: Jisheng Zhang @ 2023-01-19 15:54 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Masahiro Yamada,
	Kees Cook, Nathan Chancellor
  Cc: Conor Dooley, linux-riscv, linux-kernel

Now, after that all the sections are explicitly described and
declared in vmlinux.lds.S, we can enable ld orphan warnings for
!XIP_KERNEL to prevent from missing any new sections in future.

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

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index e2b656043abf..335e0c45cced 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -46,6 +46,7 @@ config RISCV
 	select ARCH_WANT_FRAME_POINTERS
 	select ARCH_WANT_GENERAL_HUGETLB
 	select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
+	select ARCH_WANT_LD_ORPHAN_WARN if !XIP_KERNEL
 	select ARCH_WANTS_THP_SWAP if HAVE_ARCH_TRANSPARENT_HUGEPAGE
 	select BINFMT_FLAT_NO_DATA_START_OFFSET if !MMU
 	select BUILDTIME_TABLE_SORT if MMU
-- 
2.38.1


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

* [PATCH v2 5/5] riscv: select ARCH_WANT_LD_ORPHAN_WARN for !XIP_KERNEL
@ 2023-01-19 15:54   ` Jisheng Zhang
  0 siblings, 0 replies; 18+ messages in thread
From: Jisheng Zhang @ 2023-01-19 15:54 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Masahiro Yamada,
	Kees Cook, Nathan Chancellor
  Cc: Conor Dooley, linux-riscv, linux-kernel

Now, after that all the sections are explicitly described and
declared in vmlinux.lds.S, we can enable ld orphan warnings for
!XIP_KERNEL to prevent from missing any new sections in future.

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

diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index e2b656043abf..335e0c45cced 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -46,6 +46,7 @@ config RISCV
 	select ARCH_WANT_FRAME_POINTERS
 	select ARCH_WANT_GENERAL_HUGETLB
 	select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
+	select ARCH_WANT_LD_ORPHAN_WARN if !XIP_KERNEL
 	select ARCH_WANTS_THP_SWAP if HAVE_ARCH_TRANSPARENT_HUGEPAGE
 	select BINFMT_FLAT_NO_DATA_START_OFFSET if !MMU
 	select BUILDTIME_TABLE_SORT if MMU
-- 
2.38.1


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

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

* Re: [PATCH v2 1/5] riscv: lds: define RUNTIME_DISCARD_EXIT
  2023-01-19 15:54   ` Jisheng Zhang
@ 2023-01-19 18:32     ` Conor Dooley
  -1 siblings, 0 replies; 18+ messages in thread
From: Conor Dooley @ 2023-01-19 18:32 UTC (permalink / raw)
  To: Jisheng Zhang
  Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Masahiro Yamada,
	Kees Cook, Nathan Chancellor, linux-riscv, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 759 bytes --]

On Thu, Jan 19, 2023 at 11:54:13PM +0800, Jisheng Zhang wrote:
> riscv discards .exit.* sections at run-time but doesn't define
> RUNTIME_DISCARD_EXIT. However, the .exit.* sections are still allocated
> and kept even if the generic DISCARDS would discard the sections due
> to missing RUNTIME_DISCARD_EXIT, because the DISCARD sits at the end of
> the linker script. Add the missing RUNTIME_DISCARD_EXIT define so that
> it still works if we move DISCARD up or even at the beginning of the
> linker script.
> 
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> Suggested-by: Masahiro Yamada <masahiroy@kernel.org>

Thought I left one of these against v1, either way:
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>

Thanks,
Conor.

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

[-- Attachment #2: Type: text/plain, Size: 161 bytes --]

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

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

* Re: [PATCH v2 1/5] riscv: lds: define RUNTIME_DISCARD_EXIT
@ 2023-01-19 18:32     ` Conor Dooley
  0 siblings, 0 replies; 18+ messages in thread
From: Conor Dooley @ 2023-01-19 18:32 UTC (permalink / raw)
  To: Jisheng Zhang
  Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Masahiro Yamada,
	Kees Cook, Nathan Chancellor, linux-riscv, linux-kernel

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

On Thu, Jan 19, 2023 at 11:54:13PM +0800, Jisheng Zhang wrote:
> riscv discards .exit.* sections at run-time but doesn't define
> RUNTIME_DISCARD_EXIT. However, the .exit.* sections are still allocated
> and kept even if the generic DISCARDS would discard the sections due
> to missing RUNTIME_DISCARD_EXIT, because the DISCARD sits at the end of
> the linker script. Add the missing RUNTIME_DISCARD_EXIT define so that
> it still works if we move DISCARD up or even at the beginning of the
> linker script.
> 
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> Suggested-by: Masahiro Yamada <masahiroy@kernel.org>

Thought I left one of these against v1, either way:
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>

Thanks,
Conor.

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

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

* Re: [PATCH v2 5/5] riscv: select ARCH_WANT_LD_ORPHAN_WARN for !XIP_KERNEL
  2023-01-19 15:54   ` Jisheng Zhang
@ 2023-01-20  8:06     ` Conor Dooley
  -1 siblings, 0 replies; 18+ messages in thread
From: Conor Dooley @ 2023-01-20  8:06 UTC (permalink / raw)
  To: Jisheng Zhang
  Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Masahiro Yamada,
	Kees Cook, Nathan Chancellor, Conor Dooley, linux-riscv,
	linux-kernel

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

On Thu, Jan 19, 2023 at 11:54:17PM +0800, Jisheng Zhang wrote:
> Now, after that all the sections are explicitly described and
> declared in vmlinux.lds.S, we can enable ld orphan warnings for
> !XIP_KERNEL to prevent from missing any new sections in future.
> 
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>

Warnings that the automation picked up are now gone in v2, thanks!
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>

> ---
>  arch/riscv/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index e2b656043abf..335e0c45cced 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -46,6 +46,7 @@ config RISCV
>  	select ARCH_WANT_FRAME_POINTERS
>  	select ARCH_WANT_GENERAL_HUGETLB
>  	select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
> +	select ARCH_WANT_LD_ORPHAN_WARN if !XIP_KERNEL
>  	select ARCH_WANTS_THP_SWAP if HAVE_ARCH_TRANSPARENT_HUGEPAGE
>  	select BINFMT_FLAT_NO_DATA_START_OFFSET if !MMU
>  	select BUILDTIME_TABLE_SORT if MMU
> -- 
> 2.38.1
> 

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

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

* Re: [PATCH v2 5/5] riscv: select ARCH_WANT_LD_ORPHAN_WARN for !XIP_KERNEL
@ 2023-01-20  8:06     ` Conor Dooley
  0 siblings, 0 replies; 18+ messages in thread
From: Conor Dooley @ 2023-01-20  8:06 UTC (permalink / raw)
  To: Jisheng Zhang
  Cc: Paul Walmsley, Palmer Dabbelt, Albert Ou, Masahiro Yamada,
	Kees Cook, Nathan Chancellor, Conor Dooley, linux-riscv,
	linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 1065 bytes --]

On Thu, Jan 19, 2023 at 11:54:17PM +0800, Jisheng Zhang wrote:
> Now, after that all the sections are explicitly described and
> declared in vmlinux.lds.S, we can enable ld orphan warnings for
> !XIP_KERNEL to prevent from missing any new sections in future.
> 
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>

Warnings that the automation picked up are now gone in v2, thanks!
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>

> ---
>  arch/riscv/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> index e2b656043abf..335e0c45cced 100644
> --- a/arch/riscv/Kconfig
> +++ b/arch/riscv/Kconfig
> @@ -46,6 +46,7 @@ config RISCV
>  	select ARCH_WANT_FRAME_POINTERS
>  	select ARCH_WANT_GENERAL_HUGETLB
>  	select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
> +	select ARCH_WANT_LD_ORPHAN_WARN if !XIP_KERNEL
>  	select ARCH_WANTS_THP_SWAP if HAVE_ARCH_TRANSPARENT_HUGEPAGE
>  	select BINFMT_FLAT_NO_DATA_START_OFFSET if !MMU
>  	select BUILDTIME_TABLE_SORT if MMU
> -- 
> 2.38.1
> 

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

[-- Attachment #2: Type: text/plain, Size: 161 bytes --]

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

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

* Re: [PATCH v2 0/5] riscv: improve link and support ARCH_WANT_LD_ORPHAN_WARN
  2023-01-19 15:54 ` Jisheng Zhang
@ 2023-02-22 15:00   ` patchwork-bot+linux-riscv
  -1 siblings, 0 replies; 18+ messages in thread
From: patchwork-bot+linux-riscv @ 2023-02-22 15:00 UTC (permalink / raw)
  To: Jisheng Zhang
  Cc: linux-riscv, paul.walmsley, palmer, aou, masahiroy, keescook,
	nathan, conor, linux-kernel

Hello:

This series was applied to riscv/linux.git (for-next)
by Palmer Dabbelt <palmer@rivosinc.com>:

On Thu, 19 Jan 2023 23:54:12 +0800 you wrote:
> This series tries to improve link time handling of riscv:
> patch1 adds the missing RUNTIME_DISCARD_EXIT as suggested by Masahiro.
> 
> Similar as other architectures such as x86, arm64 and so on, enable
> ARCH_WANT_LD_ORPHAN_WARN to enable linker orphan warnings to prevent
> from missing any new sections in future. So the following two patches
> are preparation ones, and the last patch finally selects
> ARCH_WANT_LD_ORPHAN_WARN
> 
> [...]

Here is the summary with links:
  - [v2,1/5] riscv: lds: define RUNTIME_DISCARD_EXIT
    https://git.kernel.org/riscv/c/7e92586c28a5
  - [v2,2/5] riscv: vmlinux.lds.S: explicitly catch .rela.dyn symbols
    https://git.kernel.org/riscv/c/e5973191a8e3
  - [v2,3/5] riscv: vmlinux.lds.S: explicitly catch .riscv.attributes sections
    https://git.kernel.org/riscv/c/b13e64d94149
  - [v2,4/5] riscv: vmlinux.lds.S: explicitly catch .init.bss sections from EFI stub
    https://git.kernel.org/riscv/c/0ed0031b093b
  - [v2,5/5] riscv: select ARCH_WANT_LD_ORPHAN_WARN for !XIP_KERNEL
    https://git.kernel.org/riscv/c/f4b71bff8d85

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

* Re: [PATCH v2 0/5] riscv: improve link and support ARCH_WANT_LD_ORPHAN_WARN
@ 2023-02-22 15:00   ` patchwork-bot+linux-riscv
  0 siblings, 0 replies; 18+ messages in thread
From: patchwork-bot+linux-riscv @ 2023-02-22 15:00 UTC (permalink / raw)
  To: Jisheng Zhang
  Cc: linux-riscv, paul.walmsley, palmer, aou, masahiroy, keescook,
	nathan, conor, linux-kernel

Hello:

This series was applied to riscv/linux.git (for-next)
by Palmer Dabbelt <palmer@rivosinc.com>:

On Thu, 19 Jan 2023 23:54:12 +0800 you wrote:
> This series tries to improve link time handling of riscv:
> patch1 adds the missing RUNTIME_DISCARD_EXIT as suggested by Masahiro.
> 
> Similar as other architectures such as x86, arm64 and so on, enable
> ARCH_WANT_LD_ORPHAN_WARN to enable linker orphan warnings to prevent
> from missing any new sections in future. So the following two patches
> are preparation ones, and the last patch finally selects
> ARCH_WANT_LD_ORPHAN_WARN
> 
> [...]

Here is the summary with links:
  - [v2,1/5] riscv: lds: define RUNTIME_DISCARD_EXIT
    https://git.kernel.org/riscv/c/7e92586c28a5
  - [v2,2/5] riscv: vmlinux.lds.S: explicitly catch .rela.dyn symbols
    https://git.kernel.org/riscv/c/e5973191a8e3
  - [v2,3/5] riscv: vmlinux.lds.S: explicitly catch .riscv.attributes sections
    https://git.kernel.org/riscv/c/b13e64d94149
  - [v2,4/5] riscv: vmlinux.lds.S: explicitly catch .init.bss sections from EFI stub
    https://git.kernel.org/riscv/c/0ed0031b093b
  - [v2,5/5] riscv: select ARCH_WANT_LD_ORPHAN_WARN for !XIP_KERNEL
    https://git.kernel.org/riscv/c/f4b71bff8d85

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

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

end of thread, other threads:[~2023-02-22 15:01 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-19 15:54 [PATCH v2 0/5] riscv: improve link and support ARCH_WANT_LD_ORPHAN_WARN Jisheng Zhang
2023-01-19 15:54 ` Jisheng Zhang
2023-01-19 15:54 ` [PATCH v2 1/5] riscv: lds: define RUNTIME_DISCARD_EXIT Jisheng Zhang
2023-01-19 15:54   ` Jisheng Zhang
2023-01-19 18:32   ` Conor Dooley
2023-01-19 18:32     ` Conor Dooley
2023-01-19 15:54 ` [PATCH v2 2/5] riscv: vmlinux.lds.S: explicitly catch .rela.dyn symbols Jisheng Zhang
2023-01-19 15:54   ` Jisheng Zhang
2023-01-19 15:54 ` [PATCH v2 3/5] riscv: vmlinux.lds.S: explicitly catch .riscv.attributes sections Jisheng Zhang
2023-01-19 15:54   ` Jisheng Zhang
2023-01-19 15:54 ` [PATCH v2 4/5] riscv: vmlinux.lds.S: explicitly catch .init.bss sections from EFI stub Jisheng Zhang
2023-01-19 15:54   ` Jisheng Zhang
2023-01-19 15:54 ` [PATCH v2 5/5] riscv: select ARCH_WANT_LD_ORPHAN_WARN for !XIP_KERNEL Jisheng Zhang
2023-01-19 15:54   ` Jisheng Zhang
2023-01-20  8:06   ` Conor Dooley
2023-01-20  8:06     ` Conor Dooley
2023-02-22 15:00 ` [PATCH v2 0/5] riscv: improve link and support ARCH_WANT_LD_ORPHAN_WARN patchwork-bot+linux-riscv
2023-02-22 15:00   ` patchwork-bot+linux-riscv

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.