summaryrefslogtreecommitdiffstats
path: root/arch/loongarch/kernel/relocate.c
diff options
context:
space:
mode:
authorWANG Rui <wangrui@loongson.cn>2023-11-21 08:03:25 +0100
committerHuacai Chen <chenhuacai@loongson.cn>2023-11-21 08:03:25 +0100
commitaa0cbc1b506b090c3a775b547c693ada108cc0d7 (patch)
tree84034641fdf0fc52a79a75cb4fc6d0472eb7f0af /arch/loongarch/kernel/relocate.c
parentLoongArch: Explicitly set -fdirect-access-external-data for vmlinux (diff)
downloadlinux-aa0cbc1b506b090c3a775b547c693ada108cc0d7.tar.xz
linux-aa0cbc1b506b090c3a775b547c693ada108cc0d7.zip
LoongArch: Record pc instead of offset in la_abs relocation
To clarify, the previous version functioned flawlessly. However, it's worth noting that the LLVM's LoongArch backend currently lacks support for cross-section label calculations. With this patch, we enable the use of clang to compile relocatable kernels. Tested-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: WANG Rui <wangrui@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Diffstat (limited to 'arch/loongarch/kernel/relocate.c')
-rw-r--r--arch/loongarch/kernel/relocate.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/loongarch/kernel/relocate.c b/arch/loongarch/kernel/relocate.c
index 6c3eff9af9fb..288b739ca88d 100644
--- a/arch/loongarch/kernel/relocate.c
+++ b/arch/loongarch/kernel/relocate.c
@@ -52,7 +52,7 @@ static inline void __init relocate_absolute(long random_offset)
for (p = begin; (void *)p < end; p++) {
long v = p->symvalue;
uint32_t lu12iw, ori, lu32id, lu52id;
- union loongarch_instruction *insn = (void *)p - p->offset;
+ union loongarch_instruction *insn = (void *)p->pc;
lu12iw = (v >> 12) & 0xfffff;
ori = v & 0xfff;