RFA: Inserting NOPs for profiling.

Jim Wilson wilson@cygnus.com
Mon Oct 16 17:46:00 GMT 2000


>However, today I had an idea for making them more useful.  If each
>front end emitted a *different* symbol, collect2 could determine what
>language each module had been written in, and add the appropriate
>libraries to the link automatically.  You'd be able to link Fortran
>and C++, for example, without knowing about either libstdc++ or
>libg2c.

It has been there for years.  It is called ASM_IDENTIFY_LANGUAGE.  It is
disabled by default because it has the same problems as ASM_IDENTIFY_GCC,
except that they are even worse when you have two of these bogus labels.
This is really really not the right way to do things.

>Say - why don't we put .gcc2_compiled in the _data_ section?  Then it
>wouldn't interfere with profiling.

Because then there is no obvious mapping to the code sections, which is the
important piece of data here.  Also, it means that every program has a few
extra bytes of garbage in the data section.  In theory there is no code
size increase if you put it text, except when using profiling.  Anyways,
it doesn't matter whether you put it in text or data, it is still needless
junk.

A much better idea is to put this info in its own section.  If the info
is there, then collect can use it.  If the info isn't there, then collect
defaults to something sensible.  This works for all ELF and *COFF targets
except ECOFF.  It doesn't work for a.out targets, but it isn't worthwhile
to try to make this feature work for a.out targets.

Or alternatively, rely on the debug info sections which already have this
info.

Jim


More information about the Gcc-patches mailing list