Hi, The patch fixes profile in 32bits PIC mode (only -p option affected).
x86 bootstrap, make check passed spec2000 o2 -p train data on Corei7: CINT -5% CFP +1,5 compared to a compiler before "enabling ebx". There is a potential performance improve after the patch applied suggested by Jakub: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63534#c8 There is opened bug on this: PR63527. However the fix of the bug is more complicated. Is it ok? ChangeLog 2014-10-16 Evgeny Stupachenko <evstu...@gmail.com> PR target/63534 * config/i386/i386.c (x86_function_profiler): Add GOT register init for mcount call. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index a3ca2ed..5117572 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -39119,11 +39126,15 @@ x86_function_profiler (FILE *file, int labelno ATTRIBUTE_UNUSED) } else if (flag_pic) { + fprintf (file,"\tpush\t%%ebx\n"); + fprintf (file,"\tcall\t__x86.get_pc_thunk.bx\n"); + fprintf (file,"\taddl\t$_GLOBAL_OFFSET_TABLE_, %%ebx\n"); #ifndef NO_PROFILE_COUNTERS fprintf (file, "\tleal\t%sP%d@GOTOFF(%%ebx),%%" PROFILE_COUNT_REGISTER "\n", LPREFIX, labelno); #endif fprintf (file, "1:\tcall\t*%s@GOT(%%ebx)\n", mcount_name); + fprintf (file,"\tpop\t%%ebx\n"); } else {