|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v3] gcov: add new interface and 3.4 and 4.7 format support
On Wed, Oct 12, 2016 at 06:42:53AM -0600, Jan Beulich wrote:
> >>> On 11.10.16 at 12:31, <wei.liu2@xxxxxxxxxx> wrote:
> > --- /dev/null
> > +++ b/xen/common/gcov/gcc_4_7.c
> > @@ -0,0 +1,205 @@
> > +/*
> > + * This code provides functions to handle gcc's profiling data format
> > + * introduced with gcc 4.7.
> > + *
> > + * This file is based heavily on gcc_3_4.c file.
> > + *
> > + * For a better understanding, refer to gcc source:
> > + * gcc/gcov-io.h
> > + * libgcc/libgcov.c
> > + *
> > + * Uses gcc-internal data definitions.
> > + *
> > + * Imported from Linux and modified for Xen by
> > + * Wei Liu <wei.liu2@xxxxxxxxxx>
> > + */
> > +
> > +#include <xen/string.h>
> > +
> > +#include "gcov.h"
> > +
> > +#if GCC_VERSION < 40700
> > +#error "Wrong version of GCC used to compile gcov"
> > +#endif
> > +
> > +#if (__GNUC__ > 5) || (__GNUC__ == 5 && __GNUC_MINOR__ >= 1)
> > +#define GCOV_COUNTERS 10
> > +#elif __GNUC__ == 4 && __GNUC_MINOR__ >= 9
> > +#define GCOV_COUNTERS 9
> > +#else
> > +#define GCOV_COUNTERS 8
> > +#endif
>
> I'm sorry for not having pointed this out on v2 (I had noticed it,
> but then didn't finish analyzing the situation), but I'm afraid this
> together with ...
>
> > +struct gcov_info {
> > + unsigned int version;
> > + struct gcov_info *next;
> > + unsigned int stamp;
> > + const char *filename;
> > + void (*merge[GCOV_COUNTERS])(gcov_type *, unsigned int);
> > + unsigned int n_functions;
> > + struct gcov_fn_info **functions;
> > +};
>
> ... this structure's trailing fields actually getting used by the code
> won't work well when changing compiler versions without cleaning
> the tree. I think instead you need thin gcc_5.c and gcc_4_9.c
> #define-ing their GCOV_COUNTERS and then #include-ing this
> shared source file. Plus btw, I don't think gcc 5.0.x (the
> development variant of 5.x) would use anything different from
> 5.1.x or 5.2.x; in fact use of __GNUC_MINOR__ should not
> normally be necessary anymore with gcc 5+.
>
I think you misread here: __GNUC_MINOR__ is the "x" part of 5.x.y, the
"y" part is __GNUC_PATCHLEVEL__.
I've broken down things into several files as well as provided
corresponding Kconfig options:
gcc_4_7_base.c: the body of what is now gcc_4_7.c, better name is
welcome
gcc_4_7.c: gcov format in gcc version [4.7, 4,9), nr counters 8
gcc_4_9.c: gcov format in gcc version [4.9, 5.1), nr counters 9
gcc_5_1.c: gcov format in gcc version [5.1, ...), nr counters 10
Wei.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |