UBUNTU: Ubuntu-2.6.38-12.51
[linux-flexiantxendom0-natty.git] / scripts / recordmcount.c
index 2d32b9c..038b3d1 100644 (file)
@@ -38,6 +38,7 @@ static void *ehdr_curr; /* current ElfXX_Ehdr *  for resource cleanup */
 static char gpfx;      /* prefix for global symbol name (sometimes '_') */
 static struct stat sb; /* Remember .st_size, etc. */
 static jmp_buf jmpenv; /* setjmp/longjmp per-file error escape */
+static const char *altmcount;  /* alternate mcount symbol name */
 
 /* setjmp() return values */
 enum {
@@ -299,7 +300,9 @@ do_file(char const *const fname)
                fail_file();
        } break;
        case EM_386:     reltype = R_386_32;                   break;
-       case EM_ARM:     reltype = R_ARM_ABS32;                break;
+       case EM_ARM:     reltype = R_ARM_ABS32;
+                        altmcount = "__gnu_mcount_nc";
+                        break;
        case EM_IA_64:   reltype = R_IA64_IMM64;   gpfx = '_'; break;
        case EM_MIPS:    /* reltype: e_class    */ gpfx = '_'; break;
        case EM_PPC:     reltype = R_PPC_ADDR32;   gpfx = '_'; break;
@@ -325,8 +328,10 @@ do_file(char const *const fname)
                }
                if (EM_S390 == w2(ehdr->e_machine))
                        reltype = R_390_32;
-               if (EM_MIPS == w2(ehdr->e_machine))
+               if (EM_MIPS == w2(ehdr->e_machine)) {
                        reltype = R_MIPS_32;
+                       is_fake_mcount32 = MIPS32_is_fake_mcount;
+               }
                do32(ehdr, fname, reltype);
        } break;
        case ELFCLASS64: {
@@ -343,6 +348,7 @@ do_file(char const *const fname)
                        reltype = R_MIPS_64;
                        Elf64_r_sym = MIPS64_r_sym;
                        Elf64_r_info = MIPS64_r_info;
+                       is_fake_mcount64 = MIPS64_is_fake_mcount;
                }
                do64(ghdr, fname, reltype);
        } break;
@@ -354,7 +360,7 @@ do_file(char const *const fname)
 int
 main(int argc, char const *argv[])
 {
-       const char ftrace[] = "kernel/trace/ftrace.o";
+       const char ftrace[] = "/ftrace.o";
        int ftrace_size = sizeof(ftrace) - 1;
        int n_error = 0;  /* gcc-4.3.0 false positive complaint */