With gcc 4.6.0 the -mfentry feature places the function profiling call at the start of the function. When this is used, the call is to __fentry__ and not mcount. Change recordmcount.c to record both callers to __fentry__ and mcount. Link: http://lkml.kernel.org/r/20120807194058.990674363@goodmis.org
Showing the changes to scripts (1 of 1 file). Show all
Unified · Split
| @@ -261,11 +261,13 @@ static unsigned get_mcountsym(Elf_Sym const *const sym0, · 260 unmodified lines | |||
| 261 | &sym0[Elf_r_sym(relp)]; | 261 | &sym0[Elf_r_sym(relp)]; |
| 262 | char const *symname = &str0[w(symp->st_name)]; | 262 | char const *symname = &str0[w(symp->st_name)]; |
| 263 | char const *mcount = gpfx == '_' ? "_mcount" : "mcount"; | 263 | char const *mcount = gpfx == '_' ? "_mcount" : "mcount"; |
| 264 | char const *fentry = "__fentry__"; | ||
| 264 | 265 | ||
| 265 | if (symname[0] == '.') | 266 | if (symname[0] == '.') |
| 266 | ++symname; /* ppc64 hack */ | 267 | ++symname; /* ppc64 hack */ |
| 267 | if (strcmp(mcount, symname) == 0 || | 268 | if (strcmp(mcount, symname) == 0 || |
| 268 | (altmcount && strcmp(altmcount, symname) == 0)) | 269 | (altmcount && strcmp(altmcount, symname) == 0) || |
| 270 | (strcmp(fentry, symname) == 0)) | ||
| 269 | mcountsym = Elf_r_sym(relp); | 271 | mcountsym = Elf_r_sym(relp); |
| 270 | 272 | ||
| 271 | return mcountsym; | 273 | return mcountsym; |