This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Adding Profiling support - GCC 4.1.1


Jim Wilson wrote:
Rohit Arul Raj wrote:
1. The function mcount: While building with native gcc, the mcount
function is defined in glibc. Is the same mcount function available in
newlib? or is it that we have to define it in our back-end as SPARC
does (gmon-sol2.c).

Did you try looking at newlib? Try something like this find . -type f | xargs grep mcount That will show you all of the mcount support in newlib/libgloss.

sparc-solaris is a special case. Early versions of Solaris shipped without the necessary support files. (Maybe it still does? I don't know, and don't care to check.) I think that there were part of the add-on extra-cost compiler. This meant that people using gcc only were not able to use profiling unless gcc provided the mcount library. Otherwise it never would have been put here. mcount belongs in the C library.

2. Is it possible to reuse the existing mcount definition or is it
customized for every backend?

It must be customized for every backend.


3. Any other existing back-ends that support profiling.

Pretty much all targets do, at least ones for operating systems. It is much harder to make mcount work for an embedded target with no file system.


If you want to learn how mcount works, just pick any existing target with mcount support, and study it.

You might take a look at the profiling support in the GNU tool chain for the Xscale that Intel distributes. There was some support to use GDB to read the required information out of the embedded target even if it didn't have a file system.


-Will


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