diff options
author | Youling Tang <tangyouling@loongson.cn> | 2023-02-25 10:52:56 +0300 |
---|---|---|
committer | Huacai Chen <chenhuacai@loongson.cn> | 2023-02-25 17:12:16 +0300 |
commit | d8da19fbdedd5852592fbba18a7348e3f09500e6 (patch) | |
tree | a6a4a921da97d0b7379e9034532c8267a14b631e /arch/loongarch/include/asm/setup.h | |
parent | 396233c650084cb957eb6d87dd4abd3e56a7d499 (diff) | |
download | linux-d8da19fbdedd5852592fbba18a7348e3f09500e6.tar.xz |
LoongArch: Add support for kernel relocation
This config allows to compile kernel as PIE and to relocate it at any
virtual address at runtime: this paves the way to KASLR.
Runtime relocation is possible since relocation metadata are embedded
into the kernel.
Signed-off-by: Youling Tang <tangyouling@loongson.cn>
Signed-off-by: Xi Ruoyao <xry111@xry111.site> # Use arch_initcall
Signed-off-by: Jinyang He <hejinyang@loongson.cn> # Provide la_abs relocation code
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Diffstat (limited to 'arch/loongarch/include/asm/setup.h')
-rw-r--r-- | arch/loongarch/include/asm/setup.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/arch/loongarch/include/asm/setup.h b/arch/loongarch/include/asm/setup.h index 72ead58039f3..27d968655b4b 100644 --- a/arch/loongarch/include/asm/setup.h +++ b/arch/loongarch/include/asm/setup.h @@ -21,4 +21,20 @@ extern void per_cpu_trap_init(int cpu); extern void set_handler(unsigned long offset, void *addr, unsigned long len); extern void set_merr_handler(unsigned long offset, void *addr, unsigned long len); +#ifdef CONFIG_RELOCATABLE + +struct rela_la_abs { + long offset; + long symvalue; +}; + +extern long __la_abs_begin; +extern long __la_abs_end; +extern long __rela_dyn_begin; +extern long __rela_dyn_end; + +extern void __init relocate_kernel(void); + +#endif + #endif /* __SETUP_H */ |