forked from Minki/linux
gcov: clang: move common GCC code into gcc_base.c
Patch series "gcov: add Clang support", v4. This patch (of 3): base.c contains a few callbacks specific to GCC's gcov implementation. Move these into their own module in preparation for Clang support. Link: http://lkml.kernel.org/r/20190318025411.98014-2-trong@android.com Signed-off-by: Greg Hackmann <ghackmann@android.com> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Tri Vo <trong@android.com> Tested-by: Trilok Soni <tsoni@quicinc.com> Tested-by: Prasad Sodagudi <psodagud@quicinc.com> Tested-by: Tri Vo <trong@android.com> Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com> Cc: Daniel Mentz <danielmentz@google.com> Cc: Petri Gynther <pgynther@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
ce528c4c20
commit
826eba0d77
@ -2,5 +2,5 @@
|
||||
ccflags-y := -DSRCTREE='"$(srctree)"' -DOBJTREE='"$(objtree)"'
|
||||
|
||||
obj-y := base.o fs.o
|
||||
obj-$(CONFIG_GCOV_FORMAT_3_4) += gcc_3_4.o
|
||||
obj-$(CONFIG_GCOV_FORMAT_4_7) += gcc_4_7.o
|
||||
obj-$(CONFIG_GCOV_FORMAT_3_4) += gcc_base.o gcc_3_4.o
|
||||
obj-$(CONFIG_GCOV_FORMAT_4_7) += gcc_base.o gcc_4_7.o
|
||||
|
@ -22,88 +22,8 @@
|
||||
#include <linux/sched.h>
|
||||
#include "gcov.h"
|
||||
|
||||
static int gcov_events_enabled;
|
||||
static DEFINE_MUTEX(gcov_lock);
|
||||
|
||||
/*
|
||||
* __gcov_init is called by gcc-generated constructor code for each object
|
||||
* file compiled with -fprofile-arcs.
|
||||
*/
|
||||
void __gcov_init(struct gcov_info *info)
|
||||
{
|
||||
static unsigned int gcov_version;
|
||||
|
||||
mutex_lock(&gcov_lock);
|
||||
if (gcov_version == 0) {
|
||||
gcov_version = gcov_info_version(info);
|
||||
/*
|
||||
* Printing gcc's version magic may prove useful for debugging
|
||||
* incompatibility reports.
|
||||
*/
|
||||
pr_info("version magic: 0x%x\n", gcov_version);
|
||||
}
|
||||
/*
|
||||
* Add new profiling data structure to list and inform event
|
||||
* listener.
|
||||
*/
|
||||
gcov_info_link(info);
|
||||
if (gcov_events_enabled)
|
||||
gcov_event(GCOV_ADD, info);
|
||||
mutex_unlock(&gcov_lock);
|
||||
}
|
||||
EXPORT_SYMBOL(__gcov_init);
|
||||
|
||||
/*
|
||||
* These functions may be referenced by gcc-generated profiling code but serve
|
||||
* no function for kernel profiling.
|
||||
*/
|
||||
void __gcov_flush(void)
|
||||
{
|
||||
/* Unused. */
|
||||
}
|
||||
EXPORT_SYMBOL(__gcov_flush);
|
||||
|
||||
void __gcov_merge_add(gcov_type *counters, unsigned int n_counters)
|
||||
{
|
||||
/* Unused. */
|
||||
}
|
||||
EXPORT_SYMBOL(__gcov_merge_add);
|
||||
|
||||
void __gcov_merge_single(gcov_type *counters, unsigned int n_counters)
|
||||
{
|
||||
/* Unused. */
|
||||
}
|
||||
EXPORT_SYMBOL(__gcov_merge_single);
|
||||
|
||||
void __gcov_merge_delta(gcov_type *counters, unsigned int n_counters)
|
||||
{
|
||||
/* Unused. */
|
||||
}
|
||||
EXPORT_SYMBOL(__gcov_merge_delta);
|
||||
|
||||
void __gcov_merge_ior(gcov_type *counters, unsigned int n_counters)
|
||||
{
|
||||
/* Unused. */
|
||||
}
|
||||
EXPORT_SYMBOL(__gcov_merge_ior);
|
||||
|
||||
void __gcov_merge_time_profile(gcov_type *counters, unsigned int n_counters)
|
||||
{
|
||||
/* Unused. */
|
||||
}
|
||||
EXPORT_SYMBOL(__gcov_merge_time_profile);
|
||||
|
||||
void __gcov_merge_icall_topn(gcov_type *counters, unsigned int n_counters)
|
||||
{
|
||||
/* Unused. */
|
||||
}
|
||||
EXPORT_SYMBOL(__gcov_merge_icall_topn);
|
||||
|
||||
void __gcov_exit(void)
|
||||
{
|
||||
/* Unused. */
|
||||
}
|
||||
EXPORT_SYMBOL(__gcov_exit);
|
||||
int gcov_events_enabled;
|
||||
DEFINE_MUTEX(gcov_lock);
|
||||
|
||||
/**
|
||||
* gcov_enable_events - enable event reporting through gcov_event()
|
||||
|
86
kernel/gcov/gcc_base.c
Normal file
86
kernel/gcov/gcc_base.c
Normal file
@ -0,0 +1,86 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
#include <linux/export.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/mutex.h>
|
||||
#include "gcov.h"
|
||||
|
||||
/*
|
||||
* __gcov_init is called by gcc-generated constructor code for each object
|
||||
* file compiled with -fprofile-arcs.
|
||||
*/
|
||||
void __gcov_init(struct gcov_info *info)
|
||||
{
|
||||
static unsigned int gcov_version;
|
||||
|
||||
mutex_lock(&gcov_lock);
|
||||
if (gcov_version == 0) {
|
||||
gcov_version = gcov_info_version(info);
|
||||
/*
|
||||
* Printing gcc's version magic may prove useful for debugging
|
||||
* incompatibility reports.
|
||||
*/
|
||||
pr_info("version magic: 0x%x\n", gcov_version);
|
||||
}
|
||||
/*
|
||||
* Add new profiling data structure to list and inform event
|
||||
* listener.
|
||||
*/
|
||||
gcov_info_link(info);
|
||||
if (gcov_events_enabled)
|
||||
gcov_event(GCOV_ADD, info);
|
||||
mutex_unlock(&gcov_lock);
|
||||
}
|
||||
EXPORT_SYMBOL(__gcov_init);
|
||||
|
||||
/*
|
||||
* These functions may be referenced by gcc-generated profiling code but serve
|
||||
* no function for kernel profiling.
|
||||
*/
|
||||
void __gcov_flush(void)
|
||||
{
|
||||
/* Unused. */
|
||||
}
|
||||
EXPORT_SYMBOL(__gcov_flush);
|
||||
|
||||
void __gcov_merge_add(gcov_type *counters, unsigned int n_counters)
|
||||
{
|
||||
/* Unused. */
|
||||
}
|
||||
EXPORT_SYMBOL(__gcov_merge_add);
|
||||
|
||||
void __gcov_merge_single(gcov_type *counters, unsigned int n_counters)
|
||||
{
|
||||
/* Unused. */
|
||||
}
|
||||
EXPORT_SYMBOL(__gcov_merge_single);
|
||||
|
||||
void __gcov_merge_delta(gcov_type *counters, unsigned int n_counters)
|
||||
{
|
||||
/* Unused. */
|
||||
}
|
||||
EXPORT_SYMBOL(__gcov_merge_delta);
|
||||
|
||||
void __gcov_merge_ior(gcov_type *counters, unsigned int n_counters)
|
||||
{
|
||||
/* Unused. */
|
||||
}
|
||||
EXPORT_SYMBOL(__gcov_merge_ior);
|
||||
|
||||
void __gcov_merge_time_profile(gcov_type *counters, unsigned int n_counters)
|
||||
{
|
||||
/* Unused. */
|
||||
}
|
||||
EXPORT_SYMBOL(__gcov_merge_time_profile);
|
||||
|
||||
void __gcov_merge_icall_topn(gcov_type *counters, unsigned int n_counters)
|
||||
{
|
||||
/* Unused. */
|
||||
}
|
||||
EXPORT_SYMBOL(__gcov_merge_icall_topn);
|
||||
|
||||
void __gcov_exit(void)
|
||||
{
|
||||
/* Unused. */
|
||||
}
|
||||
EXPORT_SYMBOL(__gcov_exit);
|
@ -83,4 +83,7 @@ struct gcov_link {
|
||||
};
|
||||
extern const struct gcov_link gcov_link[];
|
||||
|
||||
extern int gcov_events_enabled;
|
||||
extern struct mutex gcov_lock;
|
||||
|
||||
#endif /* GCOV_H */
|
||||
|
Loading…
Reference in New Issue
Block a user