Skip to content

Commit ed60453

Browse files
vitkyrkaRussell King
authored andcommitted
ARM: 6511/1: ftrace: add ARM support for C version of recordmcount
Depending on the compiler version, ARM GCC calls the mcount function either __gnu_mcount_nc or mcount. Acked-by: Steven Rostedt <[email protected]> Signed-off-by: Rabin Vincent <[email protected]> Signed-off-by: Russell King <[email protected]>
1 parent cd3478f commit ed60453

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

arch/arm/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ config ARM
2323
select PERF_USE_VMALLOC
2424
select HAVE_REGS_AND_STACK_ACCESS_API
2525
select HAVE_HW_BREAKPOINT if (PERF_EVENTS && (CPU_V6 || CPU_V7))
26+
select HAVE_C_RECORDMCOUNT
2627
help
2728
The ARM series is a line of low-power-consumption RISC chip designs
2829
licensed by ARM Ltd and targeted at embedded applications and

scripts/recordmcount.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ static void *ehdr_curr; /* current ElfXX_Ehdr * for resource cleanup */
3838
static char gpfx; /* prefix for global symbol name (sometimes '_') */
3939
static struct stat sb; /* Remember .st_size, etc. */
4040
static jmp_buf jmpenv; /* setjmp/longjmp per-file error escape */
41+
static const char *altmcount; /* alternate mcount symbol name */
4142

4243
/* setjmp() return values */
4344
enum {
@@ -299,7 +300,9 @@ do_file(char const *const fname)
299300
fail_file();
300301
} break;
301302
case EM_386: reltype = R_386_32; break;
302-
case EM_ARM: reltype = R_ARM_ABS32; break;
303+
case EM_ARM: reltype = R_ARM_ABS32;
304+
altmcount = "__gnu_mcount_nc";
305+
break;
303306
case EM_IA_64: reltype = R_IA64_IMM64; gpfx = '_'; break;
304307
case EM_MIPS: /* reltype: e_class */ gpfx = '_'; break;
305308
case EM_PPC: reltype = R_PPC_ADDR32; gpfx = '_'; break;

scripts/recordmcount.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,11 +275,12 @@ static uint_t *sift_rel_mcount(uint_t *mlocp,
275275
Elf_Sym const *const symp =
276276
&sym0[Elf_r_sym(relp)];
277277
char const *symname = &str0[w(symp->st_name)];
278+
char const *mcount = '_' == gpfx ? "_mcount" : "mcount";
278279

279280
if ('.' == symname[0])
280281
++symname; /* ppc64 hack */
281-
if (0 == strcmp((('_' == gpfx) ? "_mcount" : "mcount"),
282-
symname))
282+
if (0 == strcmp(mcount, symname) ||
283+
(altmcount && 0 == strcmp(altmcount, symname)))
283284
mcountsym = Elf_r_sym(relp);
284285
}
285286

0 commit comments

Comments
 (0)