New parameter in GCC

Andi Hellmund andi@mail.lxgcc.net
Tue Aug 9 11:12:00 GMT 2011


Hi Harry,

>> ../../../gcc-4.6.0/libgcc/../gcc/gcov-io.c: 38:31: error:
>> 'GCOV_IP_ADDRESS' undeclared here (not in a function)

>> # if IN_LIBGCOV
>> const char * gcov_ip_address = GCOV_IP_ADDRESS;
>> # endif

gcov-io.c is part of the compiler, but not part of your program. When you specific the -DGCOV_IP_ADDRESS=aa.bb.cc.dd macro, this macro is available within your program, but not within GCC. So, this macro is not available once you build libgcov. And BTW, you don't want to rebuild libgcov for each new IP adress, do you? :-)

The way Ian described the solution is - if I understood it correctly - that your program has to define the symbol 'gcov_ip_address' so that libgcov is then able to read the IP address from this symbol. 

So, the code snippet:

const char * gcov_ip_address = GCOV_IP_ADDRESS;

must be part of your program. In libgcov source code, you would then have to add the following declaration:

extern const char *gcov_ip_address;

and then use use 'gcov_ip_address' from within the libgcov code. 

I hope this makes things clearer ...

Andi



More information about the Gcc-help mailing list