xref: /openbmc/linux/kernel/gcov/gcc_base.c (revision b830f94f)
1 // SPDX-License-Identifier: GPL-2.0
2 
3 #include <linux/export.h>
4 #include <linux/kernel.h>
5 #include <linux/mutex.h>
6 #include "gcov.h"
7 
8 /*
9  * __gcov_init is called by gcc-generated constructor code for each object
10  * file compiled with -fprofile-arcs.
11  */
12 void __gcov_init(struct gcov_info *info)
13 {
14 	static unsigned int gcov_version;
15 
16 	mutex_lock(&gcov_lock);
17 	if (gcov_version == 0) {
18 		gcov_version = gcov_info_version(info);
19 		/*
20 		 * Printing gcc's version magic may prove useful for debugging
21 		 * incompatibility reports.
22 		 */
23 		pr_info("version magic: 0x%x\n", gcov_version);
24 	}
25 	/*
26 	 * Add new profiling data structure to list and inform event
27 	 * listener.
28 	 */
29 	gcov_info_link(info);
30 	if (gcov_events_enabled)
31 		gcov_event(GCOV_ADD, info);
32 	mutex_unlock(&gcov_lock);
33 }
34 EXPORT_SYMBOL(__gcov_init);
35 
36 /*
37  * These functions may be referenced by gcc-generated profiling code but serve
38  * no function for kernel profiling.
39  */
40 void __gcov_flush(void)
41 {
42 	/* Unused. */
43 }
44 EXPORT_SYMBOL(__gcov_flush);
45 
46 void __gcov_merge_add(gcov_type *counters, unsigned int n_counters)
47 {
48 	/* Unused. */
49 }
50 EXPORT_SYMBOL(__gcov_merge_add);
51 
52 void __gcov_merge_single(gcov_type *counters, unsigned int n_counters)
53 {
54 	/* Unused. */
55 }
56 EXPORT_SYMBOL(__gcov_merge_single);
57 
58 void __gcov_merge_delta(gcov_type *counters, unsigned int n_counters)
59 {
60 	/* Unused. */
61 }
62 EXPORT_SYMBOL(__gcov_merge_delta);
63 
64 void __gcov_merge_ior(gcov_type *counters, unsigned int n_counters)
65 {
66 	/* Unused. */
67 }
68 EXPORT_SYMBOL(__gcov_merge_ior);
69 
70 void __gcov_merge_time_profile(gcov_type *counters, unsigned int n_counters)
71 {
72 	/* Unused. */
73 }
74 EXPORT_SYMBOL(__gcov_merge_time_profile);
75 
76 void __gcov_merge_icall_topn(gcov_type *counters, unsigned int n_counters)
77 {
78 	/* Unused. */
79 }
80 EXPORT_SYMBOL(__gcov_merge_icall_topn);
81 
82 void __gcov_exit(void)
83 {
84 	/* Unused. */
85 }
86 EXPORT_SYMBOL(__gcov_exit);
87