LoongArch: Add support for kernel relocation
authorYouling Tang <tangyouling@loongson.cn>
Sat, 25 Feb 2023 07:52:56 +0000 (15:52 +0800)
committerHuacai Chen <chenhuacai@loongson.cn>
Sat, 25 Feb 2023 14:12:16 +0000 (22:12 +0800)
commitd8da19fbdedd5852592fbba18a7348e3f09500e6
treea6a4a921da97d0b7379e9034532c8267a14b631e
parent396233c650084cb957eb6d87dd4abd3e56a7d499
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>
arch/loongarch/Kconfig
arch/loongarch/Makefile
arch/loongarch/include/asm/asmmacro.h
arch/loongarch/include/asm/setup.h
arch/loongarch/kernel/Makefile
arch/loongarch/kernel/head.S
arch/loongarch/kernel/relocate.c [new file with mode: 0644]
arch/loongarch/kernel/vmlinux.lds.S