mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	kprobes/trace: Fix kprobe selftest for gcc 4.6
With gcc 4.6, the self test kprobe function: kprobe_trace_selftest_target() is optimized such that kallsyms does not list it. The kprobes test uses this function to insert a probe and test it. But it will fail the test if the function is not listed in kallsyms. Adding a __used annotation keeps the symbol in the kallsyms table. Suggested-by: David Daney <ddaney@caviumnetworks.com> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
This commit is contained in:
		
							parent
							
								
									0aff1c0cef
								
							
						
					
					
						commit
						265a5b7ee3
					
				
					 1 changed files with 6 additions and 2 deletions
				
			
		| 
						 | 
					@ -1870,7 +1870,11 @@ fs_initcall(init_kprobe_trace);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef CONFIG_FTRACE_STARTUP_TEST
 | 
					#ifdef CONFIG_FTRACE_STARTUP_TEST
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int kprobe_trace_selftest_target(int a1, int a2, int a3,
 | 
					/*
 | 
				
			||||||
 | 
					 * The "__used" keeps gcc from removing the function symbol
 | 
				
			||||||
 | 
					 * from the kallsyms table.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					static __used int kprobe_trace_selftest_target(int a1, int a2, int a3,
 | 
				
			||||||
					       int a4, int a5, int a6)
 | 
										       int a4, int a5, int a6)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return a1 + a2 + a3 + a4 + a5 + a6;
 | 
						return a1 + a2 + a3 + a4 + a5 + a6;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue