add support for gcov format introduced in gcc 4.7
Subsystems (4)
v2 cover add support for gcov format introduced in gcc 4.7
This is an attempt to bring support for modified gcov format in gcc 4.7 to the kernel. It tries to leverage the existing layout/abstraction, which was designed keeping in mind that the gcov format could change, but some changes had to be make. Mostly because the current model does not take into account that even the core gcov structures, like gcov_info, could change. One part that could be problematic is the addition of the .init_array section for constructors.
Tested with lcov and seems to be working fine, giving similar results as for the older format.
v2: Included suggestions/code provided by Peter Oberparleiter. Detailed
description in patches.
Frantisek Hrbata (4):
gcov: move gcov structs definitions to a gcc version specific file
gcov: add support for gcc 4.7 gcov format
gcov: compile specific gcov implementation based on gcc version
kernel: add support for init_array constructors
Documentation/gcov.txt | 4 + include/asm-generic/vmlinux.lds.h | 1 + kernel/gcov/Kconfig | 30 ++ kernel/gcov/Makefile | 32 ++- kernel/gcov/base.c | 32 ++- kernel/gcov/fs.c | 27 +- kernel/gcov/gcc_3_4.c | 115 ++++++++ kernel/gcov/gcc_4_7.c | 562 ++++++++++++++++++++++++++++++++++++++ kernel/gcov/gcov.h | 65 +---- kernel/module.c | 3 + 10 files changed, 790 insertions(+), 81 deletions(-) create mode 100644 kernel/gcov/gcc_4_7.c
Signature · 1 line
1.8.3.1
PATCH v2 1/4 gcov: move gcov structs definitions to a gcc version specific file
Since also the gcov structures(gcov_info, gcov_fn_info, gcov_ctr_info) can change between gcc releases, as shown in gcc 4.7, they cannot be defined in a common header and need to be moved to a specific gcc implemention file. This also requires to make the gcov_info structure opaque for the common code and to introduce simple helpers for accessing data inside gcov_info.
--- kernel/gcov/base.c | 26 ++++++------ kernel/gcov/fs.c | 27 ++++++------ kernel/gcov/gcc_3_4.c | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++ kernel/gcov/gcov.h | 65 +++++----------------------- 4 files changed, 153 insertions(+), 80 deletions(-)
kernel/gcov/base.c +12 -14
@@ -20,7 +20,6 @@#include <linux/mutex.h> #include "gcov.h" -static struct gcov_info *gcov_info_head;static int gcov_events_enabled;static DEFINE_MUTEX (gcov_lock);
@@ -34,7 +33,7 @@ void __gcov_init(struct gcov_info *info)mutex_lock (&gcov_lock);if (gcov_version ==0 ) { - gcov_version = info->version; + gcov_version =gcov_info_version (info);/* * Printing gcc's version magic may prove useful for debugging * incompatibility reports.
@@ -45,8 +44,7 @@ void __gcov_init(struct gcov_info *info)* Add new profiling data structure to list and inform event * listener. */ - info->next = gcov_info_head; - gcov_info_head = info; +gcov_info_link (info);if (gcov_events_enabled)gcov_event (GCOV_ADD , info);mutex_unlock (&gcov_lock);
@@ -91,13 +89,15 @@ EXPORT_SYMBOL(__gcov_merge_delta);*/ void gcov_enable_events (void ) { -struct gcov_info *info; +struct gcov_info *info =NULL ;mutex_lock (&gcov_lock); gcov_events_enabled =1 ; +/* Perform event callback for previously registered entries. */ -for (info = gcov_info_head; info; info = info->next) +while ((info =gcov_info_next (info)))gcov_event (GCOV_ADD , info); +mutex_unlock (&gcov_lock); }
@@ -112,25 +112,23 @@ static int gcov_module_notifier(struct notifier_block *nb, unsigned long event, void *data) {struct module *mod = data; -struct gcov_info *info; -struct gcov_info *prev; +struct gcov_info *info =NULL ; +struct gcov_info *prev =NULL ;if (event !=MODULE_STATE_GOING )return NOTIFY_OK ;mutex_lock (&gcov_lock); - prev =NULL ; +/* Remove entries located in module from linked list. */ -for (info = gcov_info_head; info; info = info->next) { +while ((info =gcov_info_next (info))) {if (within (info, mod->module_core, mod->core_size)) { -if (prev) - prev->next = info->next; -else - gcov_info_head = info->next; +gcov_info_unlink (prev, info);if (gcov_events_enabled)gcov_event (GCOV_REMOVE , info); }else prev = info; } +mutex_unlock (&gcov_lock);return NOTIFY_OK ;
kernel/gcov/fs.c +15 -12
@@ -242,7 +242,7 @@ static struct gcov_node *get_node_by_name(const char *name)list_for_each_entry (node, &all_head, all) { info =get_node_info (node); -if (info && (strcmp (info->filename, name) ==0 )) +if (info && (strcmp (gcov_info_filename (info), name) ==0 ))return node; }
@@ -279,7 +279,7 @@ static ssize_t gcov_seq_write(struct file *file, const char __user *addr, seq = file->private_data; info =gcov_iter_get_info (seq->private);mutex_lock (&node_lock); - node =get_node_by_name (info->filename); + node =get_node_by_name (gcov_info_filename (info));if (node) {/* Reset counts or remove node for unloaded modules. */ if (node->num_loaded ==0 )
@@ -376,8 +376,9 @@ static void add_links(struct gcov_node *node, struct dentry *parent)if (!node->links)return ;for (i =0 ; i < num; i++) { - target =get_link_target (get_node_info (node)->filename, - &gcov_link[i]); + target =get_link_target ( +gcov_info_filename (get_node_info (node)), + &gcov_link[i]);if (!target) goto out_err; basename =strrchr (target,'/' );
@@ -576,7 +577,7 @@ static void add_node(struct gcov_info *info)struct gcov_node *parent;struct gcov_node *node; - filename =kstrdup (info->filename,GFP_KERNEL ); + filename =kstrdup (gcov_info_filename (info),GFP_KERNEL );if (!filename)return ; parent = &root_node;
@@ -631,7 +632,7 @@ static void add_info(struct gcov_node *node, struct gcov_info *info) loaded_info =kcalloc (num +1 ,sizeof (struct gcov_info *),GFP_KERNEL );if (!loaded_info) {pr_warning ("could not add '%s' (out of memory)\n" , - info->filename); +gcov_info_filename (info));return ; } memcpy(loaded_info, node->loaded_info,
@@ -645,7 +646,8 @@ static void add_info(struct gcov_node *node, struct gcov_info *info)*/ if (!gcov_info_is_compatible (node->unloaded_info, info)) {pr_warning ("discarding saved data for %s " -"(incompatible version)\n" , info->filename); +"(incompatible version)\n" , +gcov_info_filename (info));gcov_info_free (node->unloaded_info); node->unloaded_info =NULL ; }
@@ -656,7 +658,7 @@ static void add_info(struct gcov_node *node, struct gcov_info *info)*/ if (!gcov_info_is_compatible (node->loaded_info[0 ], info)) {pr_warning ("could not add '%s' (incompatible " -"version)\n" , info->filename); +"version)\n" ,gcov_info_filename (info));kfree (loaded_info);return ; }
@@ -692,7 +694,8 @@ static void save_info(struct gcov_node *node, struct gcov_info *info) node->unloaded_info =gcov_info_dup (info);if (!node->unloaded_info) {pr_warning ("could not save data for '%s' " -"(out of memory)\n" , info->filename); +"(out of memory)\n" , +gcov_info_filename (info)); } } }
@@ -708,7 +711,7 @@ static void remove_info(struct gcov_node *node, struct gcov_info *info) i =get_info_index (node, info);if (i <0 ) {pr_warning ("could not remove '%s' (not found)\n" , - info->filename); +gcov_info_filename (info));return ; }if (gcov_persist)
@@ -735,7 +738,7 @@ void gcov_event(enum gcov_action action, struct gcov_info *info)struct gcov_node *node;mutex_lock (&node_lock); - node =get_node_by_name (info->filename); + node =get_node_by_name (gcov_info_filename (info));switch (action) {case GCOV_ADD :if (node)
@@ -748,7 +751,7 @@ void gcov_event(enum gcov_action action, struct gcov_info *info)remove_info (node, info); else {pr_warning ("could not remove '%s' (not found)\n" , - info->filename); +gcov_info_filename (info)); }break ; }
kernel/gcov/gcc_3_4.c +115 -0
121 lines not on this page · raw message
kernel/gcov/gcov.h +11 -54
78 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v2 2/4 gcov: add support for gcc 4.7 gcov format
In reply to Frantisek HrbataThe gcov in-memory format changed in gcc 4.7. The biggest change, which requires this special implementation, is that gcov_info no longer contains array of counters for each counter type for all functions and gcov_fn_info is not used for mapping of function's counters to these arrays(offset). Now each gcov_fn_info contans it's counters, which makes things a little bit easier.
This is heavily based on the previous gcc_3_4.c implementation and patches provided by Peter Oberparleiter. Specially the buffer gcda implementation for iterator.
v2: - removed const definition for gcov_fn_info in gcov_info
- use vmalloc for counter values in gcov_info_dup
- use iter buffer for gcda
--- kernel/gcov/base.c | 6 + kernel/gcov/gcc_4_7.c | 562 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 568 insertions(+) create mode 100644 kernel/gcov/gcc_4_7.c
kernel/gcov/base.c +6 -0
@@ -79,6 +79,12 @@ void __gcov_merge_delta(gcov_type *counters, unsigned int n_counters) }EXPORT_SYMBOL (__gcov_merge_delta); +void __gcov_merge_ior (gcov_type *counters,unsigned int n_counters) +{ +/* Unused. */ +} +EXPORT_SYMBOL (__gcov_merge_ior); +/** * gcov_enable_events - enable event reporting through gcov_event() *
kernel/gcov/gcc_4_7.c new file +562 -0
562 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Re: [PATCH v2 2/4] gcov: add support for gcc 4.7 gcov format
Quoted 9 lines · On Wed, 4 Sep 2013 16:42:54 +0200 Frantisek Hrbata <[email protected]> wrote:
The gcov in-memory format changed in gcc 4.7. The biggest change, which requires this special implementation, is that
gcov_infono longer contains array of counters for each counter type for all functions andgcov_fn_infois not used for mapping of function's counters to these arrays(offset). Now eachgcov_fn_infocontans it's counters, which makes things a little bit easier.This is heavily based on the previous
gcc_3_4.cimplementation and patches provided by Peter Oberparleiter. Specially the buffer gcda implementation for iterator.
A couple of little tweaks:
kernel/gcov/gcc_4_7.c renamed from kernel/gcov/gcc_4_7.c~gcov-add-support-for-gcc-47-gcov-format-fix +3 -4
@@ -254,11 +254,10 @@ struct gcov_info *gcov_info_dup(struct gsize_t fi_size;/* function info size */ size_t cv_size;/* counter values size */ - dup =kmalloc (sizeof (struct gcov_info ),GFP_KERNEL ); + dup =kmemdup (info,sizeof (*dup),GFP_KERNEL );if (!dup)return NULL ; - *dup = *info; dup->next =NULL ; dup->filename =NULL ; dup->functions =NULL ;
@@ -267,8 +266,8 @@ struct gcov_info *gcov_info_dup(struct gif (!dup->filename) goto err_free; - dup->functions =kzalloc (sizeof (struct gcov_fn_info *) * - info->n_functions,GFP_KERNEL ); + dup->functions =kcalloc (sizeof (struct gcov_fn_info *), + info->n_functions,GFP_KERNEL );if (!dup->functions) goto err_free;
_
Re: [PATCH v2 2/4] gcov: add support for gcc 4.7 gcov format
Quoted 7 lines · Andrew Morton
Quoted 6 lines · On Wed, 4 Sep 2013 16:42:54 +0200 Frantisek Hrbata <[email protected]> wrote:
The gcov in-memory format changed in gcc 4.7. The biggest change, which requires this special implementation, is that
gcov_infono longer contains array of counters for each counter type for all functions andgcov_fn_infois not used for mapping of function's counters to these arrays(offset). Now eachgcov_fn_infocontans it's counters, which makes things a little bit easier.
Quoted 5 lines
Quoted 3 lines
This is heavily based on the previous
gcc_3_4.cimplementation and patches provided by Peter Oberparleiter. Specially the buffer gcda implementation for iterator.A couple of little tweaks:
[]
Quoted 1 line
+++
a/kernel/gcov/gcc_4_7.c
[]
kernel/gcov/gcc_4_7.c struct gcov_info *gcov_info_dup(struct g · line 270
Quoted 8 lines
kernel/gcov/gcc_4_7.c renamed from kernel/gcov/gcc_4_7.c~gcov-add-support-for-gcc-47-gcov-format-fix +2
-2@@ -267,8 +266,8 @@ struct gcov_info *gcov_info_dup(struct gif (!dup->filename) goto err_free; - dup->functions =kzalloc (sizeof (struct gcov_fn_info *) * - info->n_functions,GFP_KERNEL ); + dup->functions =kcalloc (sizeof (struct gcov_fn_info *), + info->n_functions,GFP_KERNEL );
kcalloc(n, size_t, flags)
dup->functions = kcalloc(info->n_functions, sizeof(struct gcov_fn_info *), GFP_KERNEL);
Re: [PATCH v2 2/4] gcov: add support for gcc 4.7 gcov format
Quoted 27 lines · On Wed, 18 Sep 2013 14:27:05 -0700 Joe Perches <[email protected]> wrote:
Quoted 7 lines · Andrew Morton
Quoted 6 lines · On Wed, 4 Sep 2013 16:42:54 +0200 Frantisek Hrbata <[email protected]> wrote:
The gcov in-memory format changed in gcc 4.7. The biggest change, which requires this special implementation, is that
gcov_infono longer contains array of counters for each counter type for all functions andgcov_fn_infois not used for mapping of function's counters to these arrays(offset). Now eachgcov_fn_infocontans it's counters, which makes things a little bit easier.Quoted 5 lines
Quoted 3 lines
This is heavily based on the previous
gcc_3_4.cimplementation and patches provided by Peter Oberparleiter. Specially the buffer gcda implementation for iterator.A couple of little tweaks:
[]
Quoted 1 line
+++
a/kernel/gcov/gcc_4_7.c[]
kernel/gcov/gcc_4_7.c struct gcov_info *gcov_info_dup(struct g · line 270
Quoted 8 lines
kernel/gcov/gcc_4_7.c renamed from kernel/gcov/gcc_4_7.c~gcov-add-support-for-gcc-47-gcov-format-fix +2
-2@@ -267,8 +266,8 @@ struct gcov_info *gcov_info_dup(struct gif (!dup->filename) goto err_free; - dup->functions =kzalloc (sizeof (struct gcov_fn_info *) * - info->n_functions,GFP_KERNEL ); + dup->functions =kcalloc (sizeof (struct gcov_fn_info *), + info->n_functions,GFP_KERNEL );
kcalloc(n, size_t, flags)
Quoted 3 lines
dup->functions = kcalloc(info->n_functions, sizeof(struct gcov_fn_info *), GFP_KERNEL);
Already did that after checkpatch whined at me. Stupid thing.
Re: [PATCH v2 2/4] gcov: add support for gcc 4.7 gcov format
Quoted 29 lines · Andrew Morton
Quoted 27 lines · On Wed, 18 Sep 2013 14:27:05 -0700 Joe Perches <[email protected]> wrote:
Quoted 7 lines · Andrew Morton
Quoted 6 lines · On Wed, 4 Sep 2013 16:42:54 +0200 Frantisek Hrbata <[email protected]> wrote:
The gcov in-memory format changed in gcc 4.7. The biggest change, which requires this special implementation, is that
gcov_infono longer contains array of counters for each counter type for all functions andgcov_fn_infois not used for mapping of function's counters to these arrays(offset). Now eachgcov_fn_infocontans it's counters, which makes things a little bit easier.Quoted 5 lines
Quoted 3 lines
This is heavily based on the previous
gcc_3_4.cimplementation and patches provided by Peter Oberparleiter. Specially the buffer gcda implementation for iterator.A couple of little tweaks:
[]
Quoted 1 line
+++
a/kernel/gcov/gcc_4_7.c[]
kernel/gcov/gcc_4_7.c struct gcov_info *gcov_info_dup(struct g · line 270
Quoted 8 lines
kernel/gcov/gcc_4_7.c renamed from kernel/gcov/gcc_4_7.c~gcov-add-support-for-gcc-47-gcov-format-fix +2
-2@@ -267,8 +266,8 @@ struct gcov_info *gcov_info_dup(struct gif (!dup->filename) goto err_free; - dup->functions =kzalloc (sizeof (struct gcov_fn_info *) * - info->n_functions,GFP_KERNEL ); + dup->functions =kcalloc (sizeof (struct gcov_fn_info *), + info->n_functions,GFP_KERNEL );
kcalloc(n, size_t, flags)
Quoted 5 lines
Quoted 3 lines
dup->functions = kcalloc(info->n_functions, sizeof(struct gcov_fn_info *), GFP_KERNEL);Already did that after checkpatch whined at me. Stupid thing.
Many thanks Andrew and I'm really sorry about the "style problems". Lesson well
learned: use checkpatch before posting.
Signature · 1 line
Frantisek Hrbata
Re: [PATCH v2 2/4] gcov: add support for gcc 4.7 gcov format
In reply to Frantisek HrbataQuoted 10 lines · Frantisek Hrbata
The gcov in-memory format changed in gcc 4.7. The biggest change, which requires this special implementation, is that
gcov_infono longer contains array of counters for each counter type for all functions andgcov_fn_infois not used for mapping of function's counters to these arrays(offset). Now eachgcov_fn_infocontans it's counters, which makes things a little bit easier.This is heavily based on the previous
gcc_3_4.cimplementation and patches provided by Peter Oberparleiter. Specially the buffer gcda implementation for iterator.
Quoted 5 lines
v2: - removed const definition for
gcov_fn_infoingcov_info
- use vmalloc for counter values ingcov_info_dup
- use iter buffer for gcdaSigned-off-by Frantisek Hrbata <[email protected]>
The patch is missing an include statement:
CC kernel/gcov/gcc_4_7.okernel/gcov/gcc_4_7.c: In function gcov_info_dup:kernel/gcov/gcc_4_7.c:293:4: error: implicit declaration of function vmalloc [-Werror=implicit-function-declaration] kernel/gcov/gcc_4_7.c:293:20: warning: assignment makes pointer from integer without a cast [enabled by default]
With that added, it compiles and works with gcc 4.3.4 and 4.7.2 on kernel 3.21-rc1 on s390x.
kernel/gcov/gcc_4_7.c +1 -0
@@ -15,6 +15,7 @@#include <linux/slab.h> #include <linux/string.h> #include <linux/seq_file.h> +#include <linux/vmalloc.h> #include "gcov.h" #define GCOV_COUNTERS 8
Re: [PATCH v2 2/4] gcov: add support for gcc 4.7 gcov format
Quoted 31 lines · Peter Oberparleiter
Quoted 10 lines · Frantisek Hrbata
The gcov in-memory format changed in gcc 4.7. The biggest change, which requires this special implementation, is that
gcov_infono longer contains array of counters for each counter type for all functions andgcov_fn_infois not used for mapping of function's counters to these arrays(offset). Now eachgcov_fn_infocontans it's counters, which makes things a little bit easier.This is heavily based on the previous
gcc_3_4.cimplementation and patches provided by Peter Oberparleiter. Specially the buffer gcda implementation for iterator.Quoted 5 lines
v2: - removed const definition for
gcov_fn_infoingcov_info
- use vmalloc for counter values ingcov_info_dup
- use iter buffer for gcdaSigned-off-by Frantisek Hrbata <[email protected]>The patch is missing an include statement:
CC
kernel/gcov/gcc_4_7.okernel/gcov/gcc_4_7.c: In function ‘gcov_info_dup’:kernel/gcov/gcc_4_7.c:293:4: error: implicit declaration of function ‘vmalloc’ [-Werror=implicit-function-declaration]kernel/gcov/gcc_4_7.c:293:20: warning: assignment makes pointer from integer without a cast [enabled by default]With that added, it compiles and works with gcc 4.3.4 and 4.7.2 on kernel 3.21-rc1 on s390x.
kernel/gcov/gcc_4_7.c line 21
Quoted 7 lines
kernel/gcov/gcc_4_7.c +1
-0@@ -15,6 +15,7 @@#include <linux/slab.h> #include <linux/string.h> #include <linux/seq_file.h> +#include <linux/vmalloc.h> #include "gcov.h" #define GCOV_COUNTERS 8
Hi Peter,
I'm sorry I missed that. Many thanks. In addition, do you have any other objedtions to the code? Andrew already added the patches to the -mm tree. Andrew, should I post a follow up patch adding the vmalloc.h include or is it possible to fix it directly as you did for the previous patches? Again I'm sorry for the inconvenience.
Many thanks
Signature · 1 line
Frantisek Hrbata
Peter Oberparleiter
Reviewed-byRe: [PATCH v2 2/4] gcov: add support for gcc 4.7 gcov format
Quoted 42 lines · Frantisek Hrbata
Quoted 31 lines · Peter Oberparleiter
Quoted 10 lines · Frantisek Hrbata
The gcov in-memory format changed in gcc 4.7. The biggest change, which requires this special implementation, is that
gcov_infono longer contains array of counters for each counter type for all functions andgcov_fn_infois not used for mapping of function's counters to these arrays(offset). Now eachgcov_fn_infocontans it's counters, which makes things a little bit easier.This is heavily based on the previous
gcc_3_4.cimplementation and patches provided by Peter Oberparleiter. Specially the buffer gcda implementation for iterator.Quoted 5 lines
v2: - removed const definition for
gcov_fn_infoingcov_info
- use vmalloc for counter values ingcov_info_dup
- use iter buffer for gcdaSigned-off-by Frantisek Hrbata <[email protected]>The patch is missing an include statement:
CC
kernel/gcov/gcc_4_7.okernel/gcov/gcc_4_7.c: In function ‘gcov_info_dup’:kernel/gcov/gcc_4_7.c:293:4: error: implicit declaration of function ‘vmalloc’ [-Werror=implicit-function-declaration]kernel/gcov/gcc_4_7.c:293:20: warning: assignment makes pointer from integer without a cast [enabled by default]With that added, it compiles and works with gcc 4.3.4 and 4.7.2 on kernel 3.21-rc1 on s390x.
kernel/gcov/gcc_4_7.c line 21
Quoted 7 lines
kernel/gcov/gcc_4_7.c +1
-0@@ -15,6 +15,7 @@#include <linux/slab.h> #include <linux/string.h> #include <linux/seq_file.h> +#include <linux/vmalloc.h> #include "gcov.h" #define GCOV_COUNTERS 8Hi Peter,
Quoted 5 lines
I'm sorry I missed that. Many thanks. In addition, do you have any other objedtions to the code? Andrew already added the patches to the -mm tree. Andrew, should I post a follow up patch adding the
vmalloc.hinclude or is it possible to fix it directly as you did for the previous patches? Again I'm sorry for the inconvenience.
With the fix applied I have no further objections.
Thanks!
Signature · 2 lines
Peter Oberparleiter Linux on System z Development - IBM Germany
PATCH v2 3/4 gcov: compile specific gcov implementation based on gcc version
In reply to Frantisek HrbataCompile the correct gcov implementation file for the specific gcc version.
v2: - added possibility to explicitly select gcc version during configuration,
this is based on code provided by Peter Oberparleiter.
- added a note about gcov format selection to gcov.txt
--- Documentation/gcov.txt | 4 ++++ kernel/gcov/Kconfig | 30 ++++++++++++++++++++++++++++++ kernel/gcov/Makefile | 32 +++++++++++++++++++++++++++++++- 3 files changed, 65 insertions(+), 1 deletion(-)
Documentation/gcov.txt +4 -0
@@ -50,6 +50,10 @@ Configure the kernel with: CONFIG_DEBUG_FS=y CONFIG_GCOV_KERNEL=y +select the gcc's gcov format, default is autodetect based on gcc version: + + CONFIG_GCOV_FORMAT_AUTODETECT=y + and to get coverage data for the entire kernel: CONFIG_GCOV_PROFILE_ALL=y
kernel/gcov/Kconfig +30 -0
@@ -46,4 +46,34 @@ config GCOV_PROFILE_ALL larger and run slower. Also be sure to exclude files from profiling which are not linked to the kernel image to prevent linker errors. +choice + prompt "Specify GCOV format" + depends on GCOV_KERNEL + default GCOV_FORMAT_AUTODETECT + ---help--- + The gcov format is usually determined by the GCC version, but there are + exceptions where format changes are integrated in lower-version GCCs. + In such a case use this option to adjust the format used in the kernel + accordingly. + + If unsure, choose "Autodetect". + +config GCOV_FORMAT_AUTODETECT + bool "Autodetect" + ---help--- + Select this option to use the format that corresponds to your GCC + version. + +config GCOV_FORMAT_3_4 + bool "GCC 3.4 format" + ---help--- + Select this option to use the format defined by GCC 3.4. + +config GCOV_FORMAT_4_7 + bool "GCC 4.7 format" + ---help--- + Select this option to use the format defined by GCC 4.7. + +endchoice + endmenu
kernel/gcov/Makefile +31 -1
@@ -1,3 +1,33 @@ ccflags-y := -DSRCTREE='"$(srctree)"' -DOBJTREE='"$(objtree)"' -obj-$(CONFIG_GCOV_KERNEL) := base.o fs.o gcc_3_4.o +# if-lt +# Usage VAR := $(call if-lt, $(a), $(b)) +# Returns 1 if (a < b) +if-lt = $(shell [ $(1) -lt $(2) ] && echo 1) + +ifeq ($(CONFIG_GCOV_FORMAT_3_4),y) + cc-ver := 0304 +else ifeq ($(CONFIG_GCOV_FORMAT_4_7),y) + cc-ver := 0407 +else +# Use cc-version if available, otherwise set 0 +# +# scripts/Kbuild.include, which contains cc-version function, is not included +# during make clean "make -f scripts/Makefile.clean obj=kernel/gcov" +# Meaning cc-ver is empty causing if-lt test to fail with +# "/bin/sh: line 0: [: -lt: unary operator expected" error mesage. +# This has no affect on the clean phase, but the error message could be +# confusing/annoying. So this dummy workaround sets cc-ver to zero if cc-version +# is not available. We can probably move if-lt to Kbuild.include, so it's also +# not defined during clean or to include Kbuild.include in +# scripts/Makefile.clean. But the following workaround seems least invasive. + cc-ver := $(if $(call cc-version),$(call cc-version),0) +endif + +obj-$(CONFIG_GCOV_KERNEL) := base.o fs.o + +ifeq ($(call if-lt, $(cc-ver), 0407),1) + obj-$(CONFIG_GCOV_KERNEL) += gcc_3_4.o +else + obj-$(CONFIG_GCOV_KERNEL) += gcc_4_7.o +endif
Signature · 1 line
1.8.3.1
PATCH v2 4/4 kernel: add support for init_array constructors
In reply to Frantisek HrbataThis adds the .init_array section as yet another section with constructors. This is needed because gcc could add __gcov_init calls to .init_array or .ctors section, depending on gcc version.
v2: - reuse mod->ctors for .init_array section for modules, because gcc uses
.ctors or .init_array, but not both at the same time
--- include/asm-generic/vmlinux.lds.h | 1 + kernel/module.c | 3 +++ 2 files changed, 4 insertions(+)
include/asm-generic/vmlinux.lds.h +1 -0
@@ -468,6 +468,7 @@#define KERNEL_CTORS () . = ALIGN(8); \ VMLINUX_SYMBOL(__ctors_start) = .; \ *(.ctors) \ + *(.init_array) \ VMLINUX_SYMBOL(__ctors_end) = .;#else #define KERNEL_CTORS ()
kernel/module.c +3 -0
@@ -2760,6 +2760,9 @@ static void find_module_sections(struct module *mod, struct load_info *info)#ifdef CONFIG_CONSTRUCTORS mod->ctors =section_objs (info,".ctors" ,sizeof (*mod->ctors), &mod->num_ctors); +if (!mod->ctors) + mod->ctors =section_objs (info,".init_array" , +sizeof (*mod->ctors), &mod->num_ctors);#endif #ifdef CONFIG_TRACEPOINTS
Signature · 1 line
1.8.3.1
Re: [PATCH v2 4/4] kernel: add support for init_array constructors
Quoted 8 lines · Frantisek Hrbata
This adds the .init_array section as yet another section with constructors. This is needed because gcc could add
__gcov_initcalls to .init_array or .ctors section, depending on gcc version.v2: - reuse
mod->ctorsfor .init_array section for modules, because gcc uses
.ctors or .init_array, but not both at the same timeSigned-off-by Frantisek Hrbata <[email protected]>
Might be nice to document which gcc version changed this, so people can choose whether to cherry-pick this change?
Quoted 33 lines
--- include/asm-generic/vmlinux.lds.h | 1 + kernel/module.c | 3 +++ 2 files changed, 4 insertions(+)include/asm-generic/vmlinux.lds.h +1
-0@@ -468,6 +468,7 @@#define KERNEL_CTORS () . = ALIGN(8); \ VMLINUX_SYMBOL(__ctors_start) = .; \ *(.ctors) \ + *(.init_array) \ VMLINUX_SYMBOL(__ctors_end) = .;#else #define KERNEL_CTORS ()kernel/module.c +3
-0@@ -2760,6 +2760,9 @@ static void find_module_sections(struct module *mod, struct load_info *info)#ifdef CONFIG_CONSTRUCTORS mod->ctors =section_objs (info,".ctors" ,sizeof (*mod->ctors), &mod->num_ctors); +if (!mod->ctors) + mod->ctors =section_objs (info,".init_array" , +sizeof (*mod->ctors), &mod->num_ctors);#endif #ifdef CONFIG_TRACEPOINTS Signature · 1 line
1.8.3.1
Re: [PATCH v2 4/4] kernel: add support for init_array constructors
Quoted 5 lines · Rusty Russell
Quoted 4 lines · Frantisek Hrbata
This adds the .init_array section as yet another section with constructors. This is needed because gcc could add
__gcov_initcalls to .init_array or .ctors section, depending on gcc version.
Quoted 7 lines
Quoted 4 lines
v2: - reuse
mod->ctorsfor .init_array section for modules, because gcc uses
.ctors or .init_array, but not both at the same timeSigned-off-by Frantisek Hrbata <[email protected]>Might be nice to document which gcc version changed this, so people can choose whether to cherry-pick this change?
Thank you for pointing this out. As per gcc git this was introduced by commit ef1da80 and released in 4.7 version.
$ git describe --contains ef1da80 gcc-4_7_0-release~4358
Do you want me to post v3 with this info included in the descrition?
Quoted 2 lines
Acked-by Rusty Russell <[email protected]>
Many thanks
Quoted 34 lines
Quoted 34 lines
--- include/asm-generic/vmlinux.lds.h | 1 + kernel/module.c | 3 +++ 2 files changed, 4 insertions(+)include/asm-generic/vmlinux.lds.h +1
-0@@ -468,6 +468,7 @@#define KERNEL_CTORS () . = ALIGN(8); \ VMLINUX_SYMBOL(__ctors_start) = .; \ *(.ctors) \ + *(.init_array) \ VMLINUX_SYMBOL(__ctors_end) = .;#else #define KERNEL_CTORS ()kernel/module.c +3
-0@@ -2760,6 +2760,9 @@ static void find_module_sections(struct module *mod, struct load_info *info)#ifdef CONFIG_CONSTRUCTORS mod->ctors =section_objs (info,".ctors" ,sizeof (*mod->ctors), &mod->num_ctors); +if (!mod->ctors) + mod->ctors =section_objs (info,".init_array" , +sizeof (*mod->ctors), &mod->num_ctors);#endif #ifdef CONFIG_TRACEPOINTS Signature · 1 line
1.8.3.1
Signature · 1 line
Frantisek Hrbata
Re: [PATCH v2 4/4] kernel: add support for init_array constructors
Quoted 8 lines · Frantisek Hrbata
Quoted 7 lines
Quoted 4 lines
v2: - reuse
mod->ctorsfor .init_array section for modules, because gcc uses
.ctors or .init_array, but not both at the same timeSigned-off-by Frantisek Hrbata <[email protected]>Might be nice to document which gcc version changed this, so people can choose whether to cherry-pick this change?
Quoted 8 lines
Thank you for pointing this out. As per gcc git this was introduced by commit ef1da80 and released in 4.7 version.
$ git describe --contains ef1da80 gcc-4_7_0-release~4358Do you want me to post v3 with this info included in the descrition?
It actually depends on the combination of binutils/ld and gcc you use, not simply which gcc version you use. :/
--Kyle
Re: [PATCH v2 4/4] kernel: add support for init_array constructors
Quoted 12 lines · Kyle McMartin
Quoted 11 lines · Frantisek Hrbata
Quoted 7 lines
Quoted 4 lines
v2: - reuse
mod->ctorsfor .init_array section for modules, because gcc uses
.ctors or .init_array, but not both at the same timeSigned-off-by Frantisek Hrbata <[email protected]>Might be nice to document which gcc version changed this, so people can choose whether to cherry-pick this change?
Thank you for pointing this out. As per gcc git this was introduced by commit ef1da80 and released in 4.7 version.
Quoted 8 lines
Quoted 5 lines
$ git describe --contains ef1da80 gcc-4_7_0-release~4358Do you want me to post v3 with this info included in the descrition?
It actually depends on the combination of binutils/ld and gcc you use, not simply which gcc version you use. :/
Indeed, and seems it was binutils 20110507 which actually handled it properly.
AFAICT it's theoretically possible to have .ctors and .init_array in a module. Unlikely, but the patch should check for both and refuse to load the module in that case. Otherwise weird things would happen.
Cheers,
Rusty.
Re: [PATCH v2 4/4] kernel: add support for init_array constructors
Quoted 22 lines · Rusty Russell
Quoted 12 lines · Kyle McMartin
Quoted 11 lines · Frantisek Hrbata
Quoted 7 lines
Quoted 4 lines
v2: - reuse
mod->ctorsfor .init_array section for modules, because gcc uses
.ctors or .init_array, but not both at the same timeSigned-off-by Frantisek Hrbata <[email protected]>Might be nice to document which gcc version changed this, so people can choose whether to cherry-pick this change?
Thank you for pointing this out. As per gcc git this was introduced by commit ef1da80 and released in 4.7 version.
Quoted 8 lines
Quoted 5 lines
$ git describe --contains ef1da80 gcc-4_7_0-release~4358Do you want me to post v3 with this info included in the descrition?
It actually depends on the combination of binutils/ld and gcc you use, not simply which gcc version you use. :/
Quoted 6 lines
Indeed, and seems it was binutils 20110507 which actually handled it properly.
AFAICT it's theoretically possible to have .ctors and .init_array in a module. Unlikely, but the patch should check for both and refuse to load the module in that case. Otherwise weird things would happen.
I'm not sure if coexistence of .ctors and .init_array sections should result in denial of module, but I for sure know nothing about this :). Could you maybe privide one example of the "weird thing"?
Anyway many thanks for taking time to look at this. Below is my attepmt to implement the check you proposed.
untested/uncompiled
include/asm-generic/vmlinux.lds.h +1 -0
@@ -473,6 +473,7 @@#define KERNEL_CTORS () . = ALIGN(8); \ VMLINUX_SYMBOL(__ctors_start) = .; \ *(.ctors) \ + *(.init_array) \ VMLINUX_SYMBOL(__ctors_end) = .;#else #define KERNEL_CTORS ()
include/linux/module.h +2 -0
@@ -380,6 +380,8 @@ struct module/* Constructor functions. */ ctor_fn_t *ctors;unsigned int num_ctors; +ctor_fn_t *init_array; +unsigned int num_init_array;#endif };#ifndef MODULE_ARCH_INIT
kernel/module.c +22 -0
@@ -2768,6 +2768,9 @@ static void find_module_sections(struct module *mod, struct load_info *info)#ifdef CONFIG_CONSTRUCTORS mod->ctors =section_objs (info,".ctors" ,sizeof (*mod->ctors), &mod->num_ctors); + mod->init_array =section_objs (info,".init_array" , +sizeof (*mod->init_array), + &mod->num_init_array);#endif #ifdef CONFIG_TRACEPOINTS
@@ -2808,6 +2811,18 @@ static void find_module_sections(struct module *mod, struct load_info *info) sizeof(*info->debug), &info->num_debug); } +static void check_module_sections (struct module *mod) +{ +#ifdef CONFIG_CONSTRUCTORS +if (mod->ctors && mod->init_array) { +pr_err ("%s: .ctors and .init_array sections mishmash\n" , + mod->name); +return -EINVAL ; + } +#endif +return 0 ; +} +static int move_module (struct module *mod,struct load_info *info) {int i;
@@ -3032,6 +3047,9 @@ static void do_mod_ctors(struct module *mod)for (i =0 ; i < mod->num_ctors; i++) mod->ctors[i](); + +for (i =0 ; i < mod->num_init_array; i++) + mod->init_array[i]();#endif }
@@ -3265,6 +3283,10 @@ static int load_module(struct load_info *info, const char __user *uargs,* find optional sections. */ find_module_sections (mod, info); + err =check_module_sections (mod); +if (err) + goto free_unload; + err =check_module_license_and_versions (mod);if (err) goto free_unload;
Signature · 1 line
1.8.3.1
Quoted 3 lines
Cheers,
Rusty.
Signature · 1 line
Frantisek Hrbata
Re: [PATCH v2 4/4] kernel: add support for init_array constructors
Quoted 4 lines · Frantisek Hrbata
I'm not sure if coexistence of .ctors and .init_array sections should result in denial of module, but I for sure know nothing about this :). Could you maybe privide one example of the "weird thing"?
They shouldn't exist unless placed there intentionally... I suspect a call_if_changed Makefile target to regenerated a header would solve this problem sufficiently for a given toolchain version.
A little exposition:
.init_array and .ctors are laid out on top of each other, with an ordering that's a bit complicated... the sort of the ctor functions ends up being .ctor.x upwards towards 65535, and .init_array.x downwards from 65535 towards 0, with priority 65535-x, so that
.init_array.32768 would be called before .ctor.32768.
It's all a complete mess.
Perhaps if CONFIG_GCOV is on, we should enforce MODVERSIONS and make sure the GCC version doesn't change for the running kernel?
Maybe it would be sufficient to just detect what the toolchain supports and do that? I have a patch based on the configure.ac in gcc that does something like that, which would be trivial to use to generate a header based on gcc version.
Quoted 4 lines
Anyway many thanks for taking time to look at this. Below is my attepmt to implement the check you proposed.
untested/uncompiled
regards, Kyle
Re: [PATCH v2 4/4] kernel: add support for init_array constructors
In reply to Frantisek HrbataQuoted 26 lines · Frantisek Hrbata
Quoted 25 lines · Rusty Russell
Quoted 12 lines · Kyle McMartin
Quoted 11 lines · Frantisek Hrbata
Quoted 7 lines
Quoted 4 lines
v2: - reuse
mod->ctorsfor .init_array section for modules, because gcc uses
.ctors or .init_array, but not both at the same timeSigned-off-by Frantisek Hrbata <[email protected]>Might be nice to document which gcc version changed this, so people can choose whether to cherry-pick this change?
Thank you for pointing this out. As per gcc git this was introduced by commit ef1da80 and released in 4.7 version.
Quoted 8 lines
Quoted 5 lines
$ git describe --contains ef1da80 gcc-4_7_0-release~4358Do you want me to post v3 with this info included in the descrition?
It actually depends on the combination of binutils/ld and gcc you use, not simply which gcc version you use. :/
Indeed, and seems it was binutils 20110507 which actually handled it properly.
Quoted 7 lines
Quoted 3 lines
AFAICT it's theoretically possible to have .ctors and .init_array in a module. Unlikely, but the patch should check for both and refuse to load the module in that case. Otherwise weird things would happen.
I'm not sure if coexistence of .ctors and .init_array sections should result in denial of module, but I for sure know nothing about this :). Could you maybe privide one example of the "weird thing"?
Well, if we have both ctors and init_array, and we only call the ctors, part of the module will be uninitialized.
I was thinking about something like the following (based on your previous patch).
Thoughts?
Rusty.
From: Frantisek Hrbata <[email protected]>
Subject: kernel: add support for init_array constructors
This adds the .init_array section as yet another section with constructors. This is needed because gcc could add __gcov_init calls to .init_array or .ctors section, depending on gcc (and binutils) version .
v2: - reuse mod->ctors for .init_array section for modules, because gcc uses
.ctors or .init_array, but not both at the same time
v3: - fail to load if that does happen somehow.
include/asm-generic/vmlinux.lds.h +1 -0
@@ -473,6 +473,7 @@#define KERNEL_CTORS () . = ALIGN(8); \ VMLINUX_SYMBOL(__ctors_start) = .; \ *(.ctors) \ + *(.init_array) \ VMLINUX_SYMBOL(__ctors_end) = .;#else #define KERNEL_CTORS ()
kernel/module.c +18 -2
@@ -2738,7 +2738,7 @@ static int check_modinfo(struct module *mod, struct load_info *info, int flags)return 0 ; } -static void find_module_sections (struct module *mod,struct load_info *info) +static int find_module_sections (struct module *mod,struct load_info *info) { mod->kp =section_objs (info,"__param" ,sizeof (*mod->kp), &mod->num_kp);
@@ -2768,6 +2768,18 @@ static void find_module_sections(struct module *mod, struct load_info *info)#ifdef CONFIG_CONSTRUCTORS mod->ctors =section_objs (info,".ctors" ,sizeof (*mod->ctors), &mod->num_ctors); +if (!mod->ctors) + mod->ctors =section_objs (info,".init_array" , +sizeof (*mod->ctors), &mod->num_ctors); +else if (find_sec (info,".init_array" )) { +/* +* This shouldn't happen with same compiler and binutils +* building all parts of the module. +*/ +printk (KERN_WARNING "%s: has both .ctors and .init_array.\n" , + mod->name); +return -EINVAL ; + }#endif #ifdef CONFIG_TRACEPOINTS
@@ -2806,6 +2818,8 @@ static void find_module_sections(struct module *mod, struct load_info *info) info->debug =section_objs (info,"__verbose" ,sizeof (*info->debug), &info->num_debug); + +return 0 ; }static int move_module (struct module *mod,struct load_info *info)
@@ -3263,7 +3277,9 @@ static int load_module(struct load_info *info, const char __user *uargs,/* Now we've got everything in the final locations, we can * find optional sections. */ -find_module_sections (mod, info); + err =find_module_sections (mod, info); +if (err) + goto free_unload; err =check_module_license_and_versions (mod);if (err)
Re: [PATCH v2 4/4] kernel: add support for init_array constructors
Quoted 35 lines · Rusty Russell
Quoted 26 lines · Frantisek Hrbata
Quoted 25 lines · Rusty Russell
Quoted 12 lines · Kyle McMartin
Quoted 11 lines · Frantisek Hrbata
Quoted 7 lines
Quoted 4 lines
v2: - reuse
mod->ctorsfor .init_array section for modules, because gcc uses
.ctors or .init_array, but not both at the same timeSigned-off-by Frantisek Hrbata <[email protected]>Might be nice to document which gcc version changed this, so people can choose whether to cherry-pick this change?
Thank you for pointing this out. As per gcc git this was introduced by commit ef1da80 and released in 4.7 version.
Quoted 8 lines
Quoted 5 lines
$ git describe --contains ef1da80 gcc-4_7_0-release~4358Do you want me to post v3 with this info included in the descrition?
It actually depends on the combination of binutils/ld and gcc you use, not simply which gcc version you use. :/
Indeed, and seems it was binutils 20110507 which actually handled it properly.
Quoted 7 lines
Quoted 3 lines
AFAICT it's theoretically possible to have .ctors and .init_array in a module. Unlikely, but the patch should check for both and refuse to load the module in that case. Otherwise weird things would happen.
I'm not sure if coexistence of .ctors and .init_array sections should result in denial of module, but I for sure know nothing about this :). Could you maybe privide one example of the "weird thing"?
Quoted 8 lines
Well, if we have both ctors and
init_array, and we only call the ctors, part of the module will be uninitialized.I was thinking about something like the following (based on your previous patch).
Thoughts?
Rusty.
Thank you Rusty, from what I can say it looks ok to me. So I would go with this version. Is there anything that needs to be done to consider this as the correct version of the 4/4 patch? Meaning should we repost this as v3 or could your version of the patch be picked as you posted it?
Quoted 79 lines
From: Frantisek Hrbata <[email protected]>
Subject: kernel: add support forinit_arrayconstructorsThis adds the .init_array section as yet another section with constructors. This is needed because gcc could add
__gcov_initcalls to .init_array or .ctors section, depending on gcc (and binutils) version .v2: - reuse
mod->ctorsfor .init_array section for modules, because gcc uses
.ctors or .init_array, but not both at the same time
v3: - fail to load if that does happen somehow.Signed-off-by Frantisek Hrbata <[email protected]>Signed-off-by Rusty Russell <[email protected]>include/asm-generic/vmlinux.lds.h +1
-0@@ -473,6 +473,7 @@#define KERNEL_CTORS () . = ALIGN(8); \ VMLINUX_SYMBOL(__ctors_start) = .; \ *(.ctors) \ + *(.init_array) \ VMLINUX_SYMBOL(__ctors_end) = .;#else #define KERNEL_CTORS ()kernel/module.c +18
-2@@ -2738,7 +2738,7 @@ static int check_modinfo(struct module *mod, struct load_info *info, int flags)return 0 ; } -static void find_module_sections (struct module *mod,struct load_info *info) +static int find_module_sections (struct module *mod,struct load_info *info) { mod->kp =section_objs (info,"__param" ,sizeof (*mod->kp), &mod->num_kp);@@ -2768,6 +2768,18 @@ static void find_module_sections(struct module *mod, struct load_info *info)#ifdef CONFIG_CONSTRUCTORS mod->ctors =section_objs (info,".ctors" ,sizeof (*mod->ctors), &mod->num_ctors); +if (!mod->ctors) + mod->ctors =section_objs (info,".init_array" , +sizeof (*mod->ctors), &mod->num_ctors); +else if (find_sec (info,".init_array" )) { +/* +* This shouldn't happen with same compiler and binutils +* building all parts of the module. +*/ +printk (KERN_WARNING "%s: has both .ctors and .init_array.\n" , + mod->name); +return -EINVAL ; + }#endif #ifdef CONFIG_TRACEPOINTS @@ -2806,6 +2818,8 @@ static void find_module_sections(struct module *mod, struct load_info *info) info->debug =section_objs (info,"__verbose" ,sizeof (*info->debug), &info->num_debug); + +return 0 ; }static int move_module (struct module *mod,struct load_info *info)@@ -3263,7 +3277,9 @@ static int load_module(struct load_info *info, const char __user *uargs,/* Now we've got everything in the final locations, we can * find optional sections. */ -find_module_sections (mod, info); + err =find_module_sections (mod, info); +if (err) + goto free_unload; err =check_module_license_and_versions (mod);if (err)
Signature · 1 line
Frantisek Hrbata
Re: [PATCH v2 4/4] kernel: add support for init_array constructors
Quoted 42 lines · Frantisek Hrbata
Quoted 41 lines · Rusty Russell
Quoted 26 lines · Frantisek Hrbata
Quoted 25 lines · Rusty Russell
Quoted 12 lines · Kyle McMartin
Quoted 11 lines · Frantisek Hrbata
Quoted 7 lines
Quoted 4 lines
v2: - reuse
mod->ctorsfor .init_array section for modules, because gcc uses
.ctors or .init_array, but not both at the same timeSigned-off-by Frantisek Hrbata <[email protected]>Might be nice to document which gcc version changed this, so people can choose whether to cherry-pick this change?
Thank you for pointing this out. As per gcc git this was introduced by commit ef1da80 and released in 4.7 version.
Quoted 8 lines
Quoted 5 lines
$ git describe --contains ef1da80 gcc-4_7_0-release~4358Do you want me to post v3 with this info included in the descrition?
It actually depends on the combination of binutils/ld and gcc you use, not simply which gcc version you use. :/
Indeed, and seems it was binutils 20110507 which actually handled it properly.
Quoted 7 lines
Quoted 3 lines
AFAICT it's theoretically possible to have .ctors and .init_array in a module. Unlikely, but the patch should check for both and refuse to load the module in that case. Otherwise weird things would happen.
I'm not sure if coexistence of .ctors and .init_array sections should result in denial of module, but I for sure know nothing about this :). Could you maybe privide one example of the "weird thing"?
Well, if we have both ctors and
init_array, and we only call the ctors, part of the module will be uninitialized.I was thinking about something like the following (based on your previous patch).
Quoted 7 lines
Quoted 2 lines
Thoughts?
Rusty.Thank you Rusty, from what I can say it looks ok to me. So I would go with this version. Is there anything that needs to be done to consider this as the correct version of the 4/4 patch? Meaning should we repost this as v3 or could your version of the patch be picked as you posted it?
Take that as posted. I could push it through my tree, but I think you'll want to keep them all together.
Cheers,
Rusty.
Quoted 2 lines · Frantisek Hrbata <fhrbata <at> redhat.com> writes:
This is an attempt to bring support for modified gcov format in gcc 4.7
to
Quoted 1 line
the kernel. It tries to leverage the existing layout/abstraction, which
was
Quoted 1 line
designed keeping in mind that the gcov format could change, but some
changes had
Quoted 1 line
to be make. Mostly because the current model does not take into account
that
Quoted 1 line
even the core gcov structures, like
gcov_info, could change. One part
that could
Quoted 1 line
be problematic is the addition of the .init_array section for
constructors.
Quoted 2 lines
Tested with lcov and seems to be working fine, giving similar results as
for the
Quoted 5 lines
older format.
v2: Included suggestions/code provided by Peter Oberparleiter. Detailed
description in patches.
With suggested changes, verified on:
- gcc ARM 4.6.2
- gcc ARM 4.6.3
Christophe