ftrace/s390: mcount offset calculation
authorMartin Schwidefsky <schwidefsky@de.ibm.com>
Tue, 10 May 2011 08:10:43 +0000 (10:10 +0200)
committerSteven Rostedt <rostedt@goodmis.org>
Mon, 16 May 2011 19:05:06 +0000 (15:05 -0400)
Do the mcount offset adjustment in the recordmcount.pl/recordmcount.[ch]
at compile time and not in ftrace_call_adjust at run time.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
arch/s390/include/asm/ftrace.h
scripts/recordmcount.c
scripts/recordmcount.pl

index 3c29be4836ed53db58af9f2b8eefefadfb3aa8fc..b7931faaef6d76add44dd3bcb5c461cec5237a94 100644 (file)
@@ -11,15 +11,13 @@ struct dyn_arch_ftrace { };
 
 #ifdef CONFIG_64BIT
 #define MCOUNT_INSN_SIZE  12
-#define MCOUNT_OFFSET     8
 #else
 #define MCOUNT_INSN_SIZE  20
-#define MCOUNT_OFFSET     4
 #endif
 
 static inline unsigned long ftrace_call_adjust(unsigned long addr)
 {
-       return addr - MCOUNT_OFFSET;
+       return addr;
 }
 
 #endif /* __ASSEMBLY__ */
index 7648a5d11154d6fe87fe1c3cdf25a43d19bcb273..ee52cb8e17adf1d8d842559fb66dbd3ad5c2fe52 100644 (file)
@@ -368,8 +368,10 @@ do_file(char const *const fname)
                                "unrecognized ET_REL file: %s\n", fname);
                        fail_file();
                }
-               if (w2(ehdr->e_machine) == EM_S390)
+               if (w2(ehdr->e_machine) == EM_S390) {
                        reltype = R_390_32;
+                       mcount_adjust_32 = -4;
+               }
                if (w2(ehdr->e_machine) == EM_MIPS) {
                        reltype = R_MIPS_32;
                        is_fake_mcount32 = MIPS32_is_fake_mcount;
@@ -384,8 +386,10 @@ do_file(char const *const fname)
                                "unrecognized ET_REL file: %s\n", fname);
                        fail_file();
                }
-               if (w2(ghdr->e_machine) == EM_S390)
+               if (w2(ghdr->e_machine) == EM_S390) {
                        reltype = R_390_64;
+                       mcount_adjust_64 = -8;
+               }
                if (w2(ghdr->e_machine) == EM_MIPS) {
                        reltype = R_MIPS_64;
                        Elf64_r_sym = MIPS64_r_sym;
index 414e7f5e42ec9fd786996b94f151a4430a91276b..858966ab019cc1951724b3a2f47b4bfd5b892bf6 100755 (executable)
@@ -243,12 +243,14 @@ if ($arch eq "x86_64") {
 
 } elsif ($arch eq "s390" && $bits == 32) {
     $mcount_regex = "^\\s*([0-9a-fA-F]+):\\s*R_390_32\\s+_mcount\$";
+    $mcount_adjust = -4;
     $alignment = 4;
     $ld .= " -m elf_s390";
     $cc .= " -m31";
 
 } elsif ($arch eq "s390" && $bits == 64) {
     $mcount_regex = "^\\s*([0-9a-fA-F]+):\\s*R_390_(PC|PLT)32DBL\\s+_mcount\\+0x2\$";
+    $mcount_adjust = -8;
     $alignment = 8;
     $type = ".quad";
     $ld .= " -m elf64_s390";