2023-01-20 06:15:12

by Jisheng Zhang

[permalink] [raw]
Subject: [PATCH v2 0/5] riscv: improve link and support ARCH_WANT_LD_ORPHAN_WARN

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


2023-01-20 06:21:42

by Jisheng Zhang

[permalink] [raw]
Subject: [PATCH v2 4/5] riscv: vmlinux.lds.S: explicitly catch .init.bss sections from EFI stub

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 <[email protected]>
---
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

Subject: Re: [PATCH v2 0/5] riscv: improve link and support ARCH_WANT_LD_ORPHAN_WARN

Hello:

This series was applied to riscv/linux.git (for-next)
by Palmer Dabbelt <[email protected]>:

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