From 0eb41106922d85afbc50bbc1af0ae2e1df28518f Mon Sep 17 00:00:00 2001 From: Cui GaoSheng Date: Mon, 15 Nov 2021 19:53:48 +0800 Subject: [PATCH] ARM: use ldr_l to replace ldr instruction for the symbol jump hulk inclusion category: bugfix bugzilla: 185737 https://gitee.com/openeuler/kernel/issues/I4DDEL ----------------------------------------------------------------- ARM supports position independent code sequences that produce symbol references with a greater reach than the ordinary adr/ldr instructions, pseudo-instruction ldr_l is used to solve the symbol references problem, so we should use ldr_l to replace ldr instrutction when kaslr is enabled. Signed-off-by: Cui GaoSheng Reviewed-by: Xiu Jianfeng Reviewed-by: Jason Yan Reviewed-by: Hanjun Guo Signed-off-by: Chen Jun Signed-off-by: Zheng Zengkai --- arch/arm/mm/proc-v7.S | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S index a59ddfd7a179..2fcffcc60cc6 100644 --- a/arch/arm/mm/proc-v7.S +++ b/arch/arm/mm/proc-v7.S @@ -112,10 +112,8 @@ ENTRY(cpu_v7_hvc_switch_mm) ENDPROC(cpu_v7_hvc_switch_mm) #endif -.globl nospectre_v2 ENTRY(cpu_v7_iciallu_switch_mm) - adr r3, 3f - ldr r3, [r3] + ldr_l r3, nospectre_v2 cmp r3, #1 beq 1f mov r3, #0 @@ -124,8 +122,7 @@ ENTRY(cpu_v7_iciallu_switch_mm) b cpu_v7_switch_mm ENDPROC(cpu_v7_iciallu_switch_mm) ENTRY(cpu_v7_bpiall_switch_mm) - adr r3, 3f - ldr r3, [r3] + ldr_l r3, nospectre_v2 cmp r3, #1 beq 1f mov r3, #0 @@ -134,9 +131,6 @@ ENTRY(cpu_v7_bpiall_switch_mm) b cpu_v7_switch_mm ENDPROC(cpu_v7_bpiall_switch_mm) - .align -3: .long nospectre_v2 - string cpu_v7_name, "ARMv7 Processor" .align -- GitLab