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.
--
Jim Wilson, GNU Tools Support, http://www.specifix.com

Reply via email to