This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: gcov and initialized data


> From: Nathan Sidwell [mailto:nathanmsidwell@gmail.com] On Behalf Of
> Nathan Sidwell
> Sent: Thursday, May 3, 2018 1:58 PM
> To: taylor, david; gcc@gcc.gnu.org
> Subject: Re: gcov and initialized data
> 
> On 05/03/2018 01:09 PM, taylor, david wrote:
> 
> > When you build your program for code coverage (-ftest-coverage
> > -fprofile-arcs), GCC creates some initialized read-write GCOV related
> > data.  Has anyone modified GCC to, presumably either under control of
> > a command line option or possibly a configure time option, to initialize such
> data at run-time instead of compile-time?
> 
> How is this distinct to having to support regular C code such as:
> 
>    int x = 5;
> 
> ?  (I'm guessing the simplest solution would be to post-process the statically
> linked image to do some kind of run-length compression on its .data section
> and squirrel that away somewhere that a decompressor can find it early on)

There's a linker script.  It sets the size of the .data section to 0.  Any attempt to
use initialized read-write data overflows the .data section and fails the build.
 
> nathan
> 
> --
> Nathan Sidwell

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]