ftrace: Add arm64 support to recordmcount
Peng Du [Tue, 1 Apr 2014 19:42:13 +0000 (12:42 -0700)]
Change-Id: Iabda40bedbcdfc26fdf4282ce3752ae887400817
Signed-off-by: Peng Du <pdu@nvidia.com>
Signed-off-by: Noah Imam <nimam@nvidia.com>
Change-Id: I58e5131a05a66d3ba21cb232fb1e21b613c04753
Reviewed-on: http://git-master/r/451086
Reviewed-by: Mitch Luban <mluban@nvidia.com>
Tested-by: Mitch Luban <mluban@nvidia.com>

arch/arm64/Kconfig
scripts/recordmcount.c
scripts/recordmcount.pl

index 35b4f7c..be5b3a9 100644 (file)
@@ -29,12 +29,14 @@ config ARM64
        select GENERIC_PCI_IOMAP
        select HAVE_ARCH_JUMP_LABEL
        select HAVE_ARCH_TRACEHOOK
+       select HAVE_C_RECORDMCOUNT
        select HAVE_DEBUG_BUGVERBOSE
        select HAVE_DEBUG_KMEMLEAK
        select HAVE_DMA_API_DEBUG
        select HAVE_DMA_ATTRS
        select HAVE_DMA_CONTIGUOUS if MMU
        select HAVE_EFFICIENT_UNALIGNED_ACCESS
+       select HAVE_FTRACE_MCOUNT_RECORD
        select HAVE_GENERIC_DMA_COHERENT
        select HAVE_GENERIC_HARDIRQS
        select HAVE_HW_BREAKPOINT if PERF_EVENTS
index 9c22317..e11aa4a 100644 (file)
 #define R_METAG_NONE                     3
 #endif
 
+#ifndef EM_AARCH64
+#define EM_AARCH64     183
+#define R_AARCH64_ABS64        257
+#endif
+
 static int fd_map;     /* File descriptor for file being modified. */
 static int mmap_failed; /* Boolean flag. */
 static void *ehdr_curr; /* current ElfXX_Ehdr *  for resource cleanup */
@@ -347,6 +352,8 @@ do_file(char const *const fname)
        case EM_ARM:     reltype = R_ARM_ABS32;
                         altmcount = "__gnu_mcount_nc";
                         break;
+       case EM_AARCH64:
+                        reltype = R_AARCH64_ABS64; gpfx = '_'; break;
        case EM_IA_64:   reltype = R_IA64_IMM64;   gpfx = '_'; break;
        case EM_METAG:   reltype = R_METAG_ADDR32;
                         altmcount = "_mcount_wrapper";
index 858966a..151739b 100755 (executable)
@@ -279,6 +279,11 @@ if ($arch eq "x86_64") {
     $mcount_regex = "^\\s*([0-9a-fA-F]+):\\s*R_ARM_(CALL|PC24|THM_CALL)" .
                        "\\s+(__gnu_mcount_nc|mcount)\$";
 
+} elsif ($arch eq "arm64") {
+    $alignment = 3;
+    $section_type = '%progbits';
+    $mcount_regex = "^\\s*([0-9a-fA-F]+):\\s*R_AARCH64_CALL26\\s+_mcount\$";
+    $type = ".quad";
 } elsif ($arch eq "ia64") {
     $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s_mcount\$";
     $type = "data8";