Hi Maintainers,

This patch adds macros to support gprof in Aarch64. The difference
from the previous patch is that the compiler, while generating
"mcount" routine for an instrumented function, also passes the return
address as argument.

The "mcount" routine in glibc will be modified as follows.

(-----Snip-----)
 #define MCOUNT \
-void __mcount (void)                                                         \
+void __mcount (void* frompc)
               \
 {                                                                            \
-  mcount_internal ((u_long) RETURN_ADDRESS (1), (u_long) RETURN_ADDRESS (0)); \
+  mcount_internal ((u_long) frompc, (u_long) RETURN_ADDRESS (0)); \
 }
(-----Snip-----)

Also in Aarch64 cases__builtin_return_adderess(n) where n>0, still be
returning 0 as it was doing before.

If this is Ok I will send the patch to glibc as well.

2013-08-02  Venkataramanan Kumar  <venkataramanan.ku...@linaro.org>

         * config/aarch64/aarch64.h (MCOUNT_NAME): Define.
           (NO_PROFILE_COUNTERS): Likewise.
           (PROFILE_HOOK): Likewise.
           (FUNCTION_PROFILER): Likewise.
        *  config/aarch64/aarch64.c (aarch64_function_profiler): Remove.
           .

regards,
Venkat.

Attachment: gcc.gprof.diff
Description: Binary data

Reply via email to