This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: gprof rejects egcs' global constructor calling functions


   Date: Thu, 25 May 2000 13:53:58 +0200
   From: Hans-Bernhard Broeker <broeker@physik.rwth-aachen.de>

   Debugging gprof quickly showed the reason: in core_sym_class(),
   in source file gprof/core.c, there's
   a routine that checks every static symbol name to reject some
   obvious non-function names. One of those tests rejects any
   name with a '.' in it:

     /*
      * Can't zero-length name or funny characters in name, where
      * `funny' includes: `.' (.o file names) and `$' (Pascal labels).
      */
     if (!sym->name || sym->name[0] == '\0')
       {
	 return 0;
       }

     for (name = sym->name; *name; ++name)
       {
	 if (*name == '.' || *name == '$')
	   {
	     return 0;
	   }
       }

   Thus, gprof rejects the symbol _GLOBAL_.I.main
   and attributes calls to it to the immediately preceding function
   in the program. That happened to be main(), in this case.

   This is clearly a bug, but I'm not fluent enough in the details of
   the ELF specs to know if it's a bug in the compiler to have
   chosen that name with '.'s in it, or if gprof is falsely rejecting
   this symbol name.

gprof is falsely rejecting the symbol name.  The comment explains
why.  It is specific to a.out.

That a.out specific test should be replaced with a call to
bfd_is_local_label.

Ian

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]