Follow up on __cyg_ ... functions

Bill Mahoney bmahoney@savrx.com
Fri Oct 10 14:26:00 GMT 2008


Brian and (Andrew Haley):

But, you see, it is not unresolved for me:

[bmahoney@IDEA play]$ gcc -finstrument-functions -o test test.c
[bmahoney@IDEA play]

And a "nm" shows that they're going to get sucked in as part of the library:

                 U __cyg_profile_func_enter@@GLIBC_2.2.5
                 U __cyg_profile_func_exit@@GLIBC_2.2.5

which brings me back to... Where are they in the lib source? No amount 
of grepping seems to find it. The doc's for GCC say that the runtime is 
in the distribution sources, so I assume that is true. This is from a 
brand new 4.3.2 install.

Bill


Brian Dessent wrote:
> Bill Mahoney wrote:
>
>   
>> This much I knew. However! Let me rephrase my question. Suppose I
>> compile something with -finstrument-functions and don't supply my own
>> function. The linker must resolve it to something, so I assumed that
>> there is an empty function (e.g. a "ret" with a global label on it)
>> somewhere in the runtime library source; otherwise "ld" would barf. Is
>> this not the case, and the linker is just supplying that silently, or what?
>>     
>
> It depends on the target.  glibc has an implementation which writes the
> profiling data to a FIFO named in the environment variable
> PCPROFILE_OUTPUT (otherwise a no-op if not set.)  Other targets don't
> provide anything:
>
> $ gcc -finstrument-functions tc.c
> /tmp/cc92y1eZ.o:tc.c:(.text+0x15): undefined reference to
> `___cyg_profile_func_enter'
> /tmp/cc92y1eZ.o:tc.c:(.text+0x28): undefined reference to
> `___cyg_profile_func_exit'
> /tmp/cc92y1eZ.o:tc.c:(.text+0x63): undefined reference to
> `___cyg_profile_func_enter'
> /tmp/cc92y1eZ.o:tc.c:(.text+0x85): undefined reference to
> `___cyg_profile_func_exit'
> collect2: ld returned 1 exit status
>
> Brian
>   



More information about the Gcc-help mailing list