Skip to content

Commit f3af3b0

Browse files
Merge patch series "riscv: improve link and support ARCH_WANT_LD_ORPHAN_WARN"
Jisheng Zhang <[email protected]> says: 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 * b4-shazam-merge: riscv: select ARCH_WANT_LD_ORPHAN_WARN for !XIP_KERNEL riscv: vmlinux.lds.S: explicitly catch .init.bss sections from EFI stub riscv: vmlinux.lds.S: explicitly catch .riscv.attributes sections riscv: vmlinux.lds.S: explicitly catch .rela.dyn symbols riscv: lds: define RUNTIME_DISCARD_EXIT Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
2 parents 130aee3 + f4b71bf commit f3af3b0

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

arch/riscv/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ config RISCV
4747
select ARCH_WANT_FRAME_POINTERS
4848
select ARCH_WANT_GENERAL_HUGETLB
4949
select ARCH_WANT_HUGE_PMD_SHARE if 64BIT
50+
select ARCH_WANT_LD_ORPHAN_WARN if !XIP_KERNEL
5051
select ARCH_WANTS_THP_SWAP if HAVE_ARCH_TRANSPARENT_HUGEPAGE
5152
select BINFMT_FLAT_NO_DATA_START_OFFSET if !MMU
5253
select BUILDTIME_TABLE_SORT if MMU

arch/riscv/kernel/vmlinux.lds.S

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
#define RO_EXCEPTION_TABLE_ALIGN 4
8+
#define RUNTIME_DISCARD_EXIT
89

910
#ifdef CONFIG_XIP_KERNEL
1011
#include "vmlinux-xip.lds.S"
@@ -86,6 +87,9 @@ SECTIONS
8687
/* Start of init data section */
8788
__init_data_begin = .;
8889
INIT_DATA_SECTION(16)
90+
.init.bss : {
91+
*(.init.bss) /* from the EFI stub */
92+
}
8993
.exit.data :
9094
{
9195
EXIT_DATA
@@ -96,6 +100,10 @@ SECTIONS
96100
*(.rel.dyn*)
97101
}
98102

103+
.rela.dyn : {
104+
*(.rela*)
105+
}
106+
99107
__init_data_end = .;
100108

101109
. = ALIGN(8);
@@ -141,6 +149,7 @@ SECTIONS
141149
STABS_DEBUG
142150
DWARF_DEBUG
143151
ELF_DETAILS
152+
.riscv.attributes 0 : { *(.riscv.attributes) }
144153

145154
DISCARDS
146155
}

0 commit comments

Comments
 (0)