public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Follow up on __cyg_ ... functions
@ 2008-10-09 20:40 Bill Mahoney
  2008-10-09 21:23 ` Building GCC without an assembler Gobaan_Raveendran
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Bill Mahoney @ 2008-10-09 20:40 UTC (permalink / raw)
  To: gcc-help

Brian:

Thanks for the reply - I appreciate it.

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?

The reason I ask is that a couple of years ago I instrumented blocks as 
well. (I am guilty of not posting these to the GCC community.) So I also 
have __cyg_profile_block as an additional extern. I wanted to supply a 
"default, do nothing" function for this as well.

Thoughts?  Thanks again.

Bill


Brian Dessent wrote:
> Bill Mahoney wrote:
>
>   
>> Hey, I would like to know on a new 4.3.2 install, where the source is
>> for the portion of the RT library that contains __cyg_profile_func_enter
>> / _exit.  Can somebody just email me back and aim me at the correct
>> file? I've find/grep'd until my fingers are tired.
>>     
>
> The compiler will insert calls to those functions when you use
> -finstrument-functions but you are meant to provide an implementation of
> them in your own code to receive the data and process it as you wish. 
> So you won't find what you're looking for in gcc anywhere because it
> doesn't exist.
>
> Brian
>   

>   

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Building GCC without an assembler
  2008-10-09 20:40 Follow up on __cyg_ ... functions Bill Mahoney
@ 2008-10-09 21:23 ` Gobaan_Raveendran
  2008-10-10  0:59   ` Brian Dessent
  2008-10-10  0:53 ` Follow up on __cyg_ ... functions Brian Dessent
  2008-10-10 10:22 ` Andrew Haley
  2 siblings, 1 reply; 8+ messages in thread
From: Gobaan_Raveendran @ 2008-10-09 21:23 UTC (permalink / raw)
  To: gcc-help

Hello,

I am working on building gcc as a cross compiler and I do not have a
working assembler, thus it fails when trying to build the libraries. I
think I can build a simple program to read the input and spit it back out
so no errors are produced, but I was wondering if there is any way to avoid
building the libraries so that I can experiment with code that does not
need to be assembled/linked. I currently just install the broken cross
compiler as it allows me to experiment, but I am wondering if there is a
better way.

Thanks,

- Gobi

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Follow up on __cyg_ ... functions
  2008-10-09 20:40 Follow up on __cyg_ ... functions Bill Mahoney
  2008-10-09 21:23 ` Building GCC without an assembler Gobaan_Raveendran
@ 2008-10-10  0:53 ` Brian Dessent
  2008-10-10 14:26   ` Bill Mahoney
  2008-10-10 10:22 ` Andrew Haley
  2 siblings, 1 reply; 8+ messages in thread
From: Brian Dessent @ 2008-10-10  0:53 UTC (permalink / raw)
  To: Bill Mahoney; +Cc: gcc-help

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Building GCC without an assembler
  2008-10-09 21:23 ` Building GCC without an assembler Gobaan_Raveendran
@ 2008-10-10  0:59   ` Brian Dessent
  0 siblings, 0 replies; 8+ messages in thread
From: Brian Dessent @ 2008-10-10  0:59 UTC (permalink / raw)
  To: Gobaan_Raveendran; +Cc: gcc-help

Gobaan_Raveendran@amis.com wrote:

> I am working on building gcc as a cross compiler and I do not have a
> working assembler, thus it fails when trying to build the libraries. I
> think I can build a simple program to read the input and spit it back out
> so no errors are produced, but I was wondering if there is any way to avoid
> building the libraries so that I can experiment with code that does not
> need to be assembled/linked. I currently just install the broken cross
> compiler as it allows me to experiment, but I am wondering if there is a
> better way.

To build just the compiler and not the target libraries use the make
target "all-gcc".  In theory you should be able to install this with
"install-gcc" as well.

Brian

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Follow up on __cyg_ ... functions
  2008-10-09 20:40 Follow up on __cyg_ ... functions Bill Mahoney
  2008-10-09 21:23 ` Building GCC without an assembler Gobaan_Raveendran
  2008-10-10  0:53 ` Follow up on __cyg_ ... functions Brian Dessent
@ 2008-10-10 10:22 ` Andrew Haley
  2 siblings, 0 replies; 8+ messages in thread
From: Andrew Haley @ 2008-10-10 10:22 UTC (permalink / raw)
  To: Bill Mahoney; +Cc: gcc-help

Bill Mahoney wrote:
> Brian:
> 
> Thanks for the reply - I appreciate it.
> 
> This much I knew. However! Let me rephrase my question. Suppose I
> compile something with -finstrument-functions and don't supply my own
> function.

Then your program won't link.

> 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?

If your program links you have a definition of __cyg_ ... from
somewhere.  A linker map will tell you where it comes from.

Andrew.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Follow up on __cyg_ ... functions
  2008-10-10  0:53 ` Follow up on __cyg_ ... functions Brian Dessent
@ 2008-10-10 14:26   ` Bill Mahoney
  2008-10-10 15:16     ` Andrew Haley
  2008-10-11  2:51     ` Brian Dessent
  0 siblings, 2 replies; 8+ messages in thread
From: Bill Mahoney @ 2008-10-10 14:26 UTC (permalink / raw)
  To: gcc-help

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
>   

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Follow up on __cyg_ ... functions
  2008-10-10 14:26   ` Bill Mahoney
@ 2008-10-10 15:16     ` Andrew Haley
  2008-10-11  2:51     ` Brian Dessent
  1 sibling, 0 replies; 8+ messages in thread
From: Andrew Haley @ 2008-10-10 15:16 UTC (permalink / raw)
  To: Bill Mahoney; +Cc: gcc-help

Bill Mahoney wrote:
> 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.

Did you generate a link map, as I suggested?  That would immediately
tell you where it was coming from: it's glibc.

  gcc -Wl,-Map,map

Andrew.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Follow up on __cyg_ ... functions
  2008-10-10 14:26   ` Bill Mahoney
  2008-10-10 15:16     ` Andrew Haley
@ 2008-10-11  2:51     ` Brian Dessent
  1 sibling, 0 replies; 8+ messages in thread
From: Brian Dessent @ 2008-10-11  2:51 UTC (permalink / raw)
  To: Bill Mahoney; +Cc: gcc-help

Bill Mahoney wrote:

> 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.

As I said, glibc provides an implementation.  glibc is not part of gcc. 
The runtime referred to is the compiler support runtime (i.e. libgcc,
libstdc++, libgfortran, etc.) not libc.  gcc does not include a C
library.

Brian

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-10-11  2:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-09 20:40 Follow up on __cyg_ ... functions Bill Mahoney
2008-10-09 21:23 ` Building GCC without an assembler Gobaan_Raveendran
2008-10-10  0:59   ` Brian Dessent
2008-10-10  0:53 ` Follow up on __cyg_ ... functions Brian Dessent
2008-10-10 14:26   ` Bill Mahoney
2008-10-10 15:16     ` Andrew Haley
2008-10-11  2:51     ` Brian Dessent
2008-10-10 10:22 ` Andrew Haley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).