Hello,

I have been investigating gcc and gprof interaction. 
I have noticed something strange, even though I cannot reproduce an example.

In certain situations, GCC will produce functions called foo.isra.0 or 
foo.constprop.0. 
These function names are created by clone_function_name where suffix is isra or 
constprop.

On the other hand in gprof/corefile.c (function core_sym_class) of binutils, 
symbols that don't include a '.clone.' (which used to be generated by 4.5 at 
least) are discarded (from 2.23.2).
  for (name = sym->name; *name; ++name)
    {
      if (*name == '$')
        return 0;

      while (*name == '.')
        {
          /* Allow both nested subprograms (which end with ".NNN", where N is
             a digit) and GCC cloned functions (which contain ".clone").
             Allow for multiple iterations of both - apparently GCC can clone
             clones and subprograms.  */
          int digit_seen = 0;
#define CLONE_NAME      ".clone."
#define CLONE_NAME_LEN  strlen (CLONE_NAME)
              
          if (strlen (name) > CLONE_NAME_LEN
              && strncmp (name, CLONE_NAME, CLONE_NAME_LEN) == 0)
            name += CLONE_NAME_LEN - 1;

          for (name++; *name; name++)
            if (digit_seen && *name == '.')
              break;
            else if (ISDIGIT (*name))
              digit_seen = 1;
            else
              return 0;
        }
    }


My question is, how does this work with recent gcc's and binutils'? If I use 
-pg on gcc, will gcc stop outputting functions with isra, constprop, etc 
suffixes and revert to clone suffixes or will it just use .<number>?

Cheers,

Paulo Matos


Reply via email to