arm64: ftrace: eliminate literal pool entries
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Fri, 7 Nov 2014 14:12:33 +0000 (14:12 +0000)
committerWill Deacon <will.deacon@arm.com>
Fri, 7 Nov 2014 15:04:49 +0000 (15:04 +0000)
Replace ldr xN, =<symbol> with adrp/add or adrp/ldr [as appropriate]
in the implementation of _mcount(), which may be called very often.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/kernel/entry-ftrace.S

index 38e704e597f71bc25e677849162716a307640921..08cafc518b9a57ad724530b9dbb144d50683c13f 100644 (file)
@@ -98,8 +98,8 @@
 ENTRY(_mcount)
        mcount_enter
 
-       ldr     x0, =ftrace_trace_function
-       ldr     x2, [x0]
+       adrp    x0, ftrace_trace_function
+       ldr     x2, [x0, #:lo12:ftrace_trace_function]
        adr     x0, ftrace_stub
        cmp     x0, x2                  // if (ftrace_trace_function
        b.eq    skip_ftrace_call        //     != ftrace_stub) {
@@ -115,14 +115,15 @@ skip_ftrace_call:                 //   return;
        mcount_exit                     //   return;
                                        // }
 skip_ftrace_call:
-       ldr     x1, =ftrace_graph_return
-       ldr     x2, [x1]                //   if ((ftrace_graph_return
-       cmp     x0, x2                  //        != ftrace_stub)
-       b.ne    ftrace_graph_caller
-
-       ldr     x1, =ftrace_graph_entry //     || (ftrace_graph_entry
-       ldr     x2, [x1]                //        != ftrace_graph_entry_stub))
-       ldr     x0, =ftrace_graph_entry_stub
+       adrp    x1, ftrace_graph_return
+       ldr     x2, [x1, #:lo12:ftrace_graph_return]
+       cmp     x0, x2                  //   if ((ftrace_graph_return
+       b.ne    ftrace_graph_caller     //        != ftrace_stub)
+
+       adrp    x1, ftrace_graph_entry  //     || (ftrace_graph_entry
+       adrp    x0, ftrace_graph_entry_stub //     != ftrace_graph_entry_stub))
+       ldr     x2, [x1, #:lo12:ftrace_graph_entry]
+       add     x0, x0, #:lo12:ftrace_graph_entry_stub
        cmp     x0, x2
        b.ne    ftrace_graph_caller     //     ftrace_graph_caller();