mirror of
				https://github.com/torvalds/linux.git
				synced 2025-10-31 16:48:26 +02:00 
			
		
		
		
	 826eba0d77
			
		
	
	
		826eba0d77
		
	
	
	
	
		
			
			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>
		
			
				
	
	
		
			86 lines
		
	
	
	
		
			1.8 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			86 lines
		
	
	
	
		
			1.8 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| // 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);
 |