[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gcc and profiling
The interfacing of gcc with external programs, such as ld, is one of the
scarier parts of gcc itself.
There are some knobs to automate some *limited* amount of profiling support,
specifically, -pg automatically links against libc_p instead of libc.
Other libraries do not follow suit. This appears to be intentional: -lm says
`link against libm.a'. If it automatically became libm_p.a, there would
be no easy way left to link against some profiled libraries and some
non-profiled libraries...
The design guideline is that libraries you explicitly have to mention on
the command line you need to care about, gcc will handle its `default'
libraries (-lc, -lgcc...) automatically.
There is a huge nasty problem with g++ and libstdc++ currently: there is
no mechanism in gcc akin to the libc magic handling, that would change the
name of the standard C++ when profiling is used. (Fortran has a similar
problem). The solution does involve rewriting a fairly large part of the
specs handling code... which is already special-cased all over the place,
and I don't have the time to do it right now.
(for those of you who build the egcs-snapshot port, this is the cause of
failure of all tests involving C++ and profiling).
--
Marc Espie
|anime, sf, juggling, unicycle, acrobatics, comics...
|AmigaOS, OpenBSD, C++, perl, Icon, PostScript...
| `real programmers don't die, they just get out of beta'