riscv: improve __ex_table section handling
v2 cover riscv: improve __ex_table section handling
From: Jisheng Zhang <[email protected]>
Enable BUILDTIME_TABLE_SORT to sort the exception table at build time then move exception table to RO_DATA segment.
Since v1:
- Only enable BUILDTIME_TABLE_SORT for MMU. Thank Palmer for catching tinyconfig case.
Jisheng Zhang (2):
riscv: Enable BUILDTIME_TABLE_SORT
riscv: Move EXCEPTION_TABLE to RO_DATA segment
arch/riscv/Kconfig | 1 + arch/riscv/kernel/vmlinux-xip.lds.S | 1 - arch/riscv/kernel/vmlinux.lds.S | 4 ++-- scripts/sorttable.c | 1 + 4 files changed, 4 insertions(+), 3 deletions(-)
Signature · 8 lines
2.32.0 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv
PATCH v2 1/2 riscv: Enable BUILDTIME_TABLE_SORT
From: Jisheng Zhang <[email protected]>
Enable BUILDTIME_TABLE_SORT to sort the exception table at build time rather than during boot.
--- arch/riscv/Kconfig | 1 + scripts/sorttable.c | 1 + 2 files changed, 2 insertions(+)
arch/riscv/Kconfig +1 -0
@@ -40,6 +40,7 @@ config RISCV select ARCH_WANT_FRAME_POINTERS select ARCH_WANT_HUGE_PMD_SHARE if 64BIT select BINFMT_FLAT_NO_DATA_START_OFFSET if !MMU + select BUILDTIME_TABLE_SORT if MMU select CLONE_BACKWARDS select CLINT_TIMER if !MMU select COMMON_CLK
scripts/sorttable.c +1 -0
@@ -349,6 +349,7 @@ static int do_file(char const *const fname, void *addr)case EM_ARM :case EM_MICROBLAZE :case EM_MIPS : +case EM_RISCV :case EM_XTENSA :break ;default :
Signature · 8 lines
2.32.0 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv
PATCH v2 2/2 riscv: Move EXCEPTION_TABLE to RO_DATA segment
In reply to Jisheng ZhangFrom: Jisheng Zhang <[email protected]>
_ex_table section is read-only, so move it to RO_DATA.
--- arch/riscv/kernel/vmlinux-xip.lds.S | 1 - arch/riscv/kernel/vmlinux.lds.S | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-)
arch/riscv/kernel/vmlinux-xip.lds.S +0 -1
@@ -121,7 +121,6 @@ SECTIONS } BSS_SECTION(PAGE_SIZE, PAGE_SIZE, 0) - EXCEPTION_TABLE(0x10) .rel.dyn : AT(ADDR(.rel.dyn) - LOAD_OFFSET) { *(.rel.dyn*)
arch/riscv/kernel/vmlinux.lds.S +2 -2
@@ -4,6 +4,8 @@ * Copyright (C) 2017 SiFive */ +#define RO_EXCEPTION_TABLE_ALIGN 16 + #ifdef CONFIG_XIP_KERNEL #include "vmlinux-xip.lds.S" #else
@@ -112,8 +114,6 @@ SECTIONS *(.srodata*) } - EXCEPTION_TABLE(0x10) - . = ALIGN(SECTION_ALIGN); _data = .;
Signature · 8 lines
2.32.0 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv
Palmer Dabbelt
maintainerQuoted 13 lines · On Thu, 26 Aug 2021 07:09:52 PDT (-0700), [email protected] wrote:
From: Jisheng Zhang <[email protected]>
Enable
BUILDTIME_TABLE_SORTto sort the exception table at build time then move exception table toRO_DATAsegment.Since v1:
- Only enableBUILDTIME_TABLE_SORTfor MMU. Thank Palmer for catching tinyconfig case.Jisheng Zhang (2):
riscv: EnableBUILDTIME_TABLE_SORT
riscv: MoveEXCEPTION_TABLEtoRO_DATAsegment
Quoted 5 lines
arch/riscv/Kconfig | 1 + arch/riscv/kernel/vmlinux-xip.lds.S | 1 - arch/riscv/kernel/vmlinux.lds.S | 4 ++-- scripts/sorttable.c | 1 + 4 files changed, 4 insertions(+), 3 deletions(-)
Thanks, this is on for-next.