Skip to content

Commit 829d2bd

Browse files
mrutland-armwildea01
authored andcommitted
arm64: entry-ftrace.S: avoid open-coded {adr,ldr}_l
Some places in the kernel open-code sequences using ADRP for a symbol another instruction using a :lo12: relocation for that same symbol. These sequences are easy to get wrong, and more painful to read than is necessary. For these reasons, it is preferable to use the {adr,ldr,str}_l macros for these cases. This patch makes use of these in entry-ftrace.S, removing open-coded sequences using adrp. This results in a minor code change, since a temporary register is not used when generating the address for some symbols, but this is fine, as the value of the temporary register is not used elsewhere. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: AKASHI Takahiro <takahiro.akashi@linaro.org> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will.deacon@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
1 parent 526d10a commit 829d2bd

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

arch/arm64/kernel/entry-ftrace.S

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,7 @@
9898
ENTRY(_mcount)
9999
mcount_enter
100100

101-
adrp x0, ftrace_trace_function
102-
ldr x2, [x0, #:lo12:ftrace_trace_function]
101+
ldr_l x2, ftrace_trace_function
103102
adr x0, ftrace_stub
104103
cmp x0, x2 // if (ftrace_trace_function
105104
b.eq skip_ftrace_call // != ftrace_stub) {
@@ -115,15 +114,12 @@ skip_ftrace_call: // return;
115114
mcount_exit // return;
116115
// }
117116
skip_ftrace_call:
118-
adrp x1, ftrace_graph_return
119-
ldr x2, [x1, #:lo12:ftrace_graph_return]
117+
ldr_l x2, ftrace_graph_return
120118
cmp x0, x2 // if ((ftrace_graph_return
121119
b.ne ftrace_graph_caller // != ftrace_stub)
122120

123-
adrp x1, ftrace_graph_entry // || (ftrace_graph_entry
124-
adrp x0, ftrace_graph_entry_stub // != ftrace_graph_entry_stub))
125-
ldr x2, [x1, #:lo12:ftrace_graph_entry]
126-
add x0, x0, #:lo12:ftrace_graph_entry_stub
121+
ldr_l x2, ftrace_graph_entry // || (ftrace_graph_entry
122+
adr_l x0, ftrace_graph_entry_stub // != ftrace_graph_entry_stub))
127123
cmp x0, x2
128124
b.ne ftrace_graph_caller // ftrace_graph_caller();
129125

0 commit comments

Comments
 (0)