xref: /openbmc/linux/arch/s390/include/asm/ftrace.lds.h (revision de5012b4)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef DIV_ROUND_UP
3 #define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
4 #endif
5 
6 #define SIZEOF_MCOUNT_LOC_ENTRY 8
7 #define SIZEOF_FTRACE_HOTPATCH_TRAMPOLINE 24
8 #define FTRACE_HOTPATCH_TRAMPOLINES_SIZE(n)				       \
9 	DIV_ROUND_UP(SIZEOF_FTRACE_HOTPATCH_TRAMPOLINE * (n),		       \
10 		     SIZEOF_MCOUNT_LOC_ENTRY)
11 
12 #ifdef CONFIG_FUNCTION_TRACER
13 #define FTRACE_HOTPATCH_TRAMPOLINES_TEXT				       \
14 	. = ALIGN(8);							       \
15 	__ftrace_hotpatch_trampolines_start = .;			       \
16 	. = . + FTRACE_HOTPATCH_TRAMPOLINES_SIZE(__stop_mcount_loc -	       \
17 						 __start_mcount_loc);	       \
18 	__ftrace_hotpatch_trampolines_end = .;
19 #else
20 #define FTRACE_HOTPATCH_TRAMPOLINES_TEXT
21 #endif
22