Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

static_call: allow using STATIC_CALL_TRAMP_STR() from assembly

STATIC_CALL_TRAMP_STR() could not be used from .S files because
static_call_types.h was not safe to include in assembly as it pulled in C
types/constructs that are unavailable under __ASSEMBLY__.
Make the header assembly-friendly by adding __ASSEMBLY__ checks and
providing only the minimal definitions needed for assembly, so that it
can be safely included by .S code. This enables emitting the static call
trampoline symbol name via STATIC_CALL_TRAMP_STR() directly in assembly
sources, to be used with 'call' instruction. Also, move a certain
definitions out of __ASSEMBLY__ checks in compiler_types.h to meet
the dependencies.

No functional change for C compilation.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Naman Jain <namjain@linux.microsoft.com>
Signed-off-by: Wei Liu <wei.liu@kernel.org>

authored by

Naman Jain and committed by
Wei Liu
796ef5a7 c91fe5f1

+12 -4
+4 -4
include/linux/compiler_types.h
··· 11 11 #define __has_builtin(x) (0) 12 12 #endif 13 13 14 + /* Indirect macros required for expanded argument pasting, eg. __LINE__. */ 15 + #define ___PASTE(a, b) a##b 16 + #define __PASTE(a, b) ___PASTE(a, b) 17 + 14 18 #ifndef __ASSEMBLY__ 15 19 16 20 /* ··· 82 78 # define ACCESS_PRIVATE(p, member) ((p)->member) 83 79 # define __builtin_warning(x, y...) (1) 84 80 #endif /* __CHECKER__ */ 85 - 86 - /* Indirect macros required for expanded argument pasting, eg. __LINE__. */ 87 - #define ___PASTE(a,b) a##b 88 - #define __PASTE(a,b) ___PASTE(a,b) 89 81 90 82 #ifdef __KERNEL__ 91 83
+4
include/linux/static_call_types.h
··· 25 25 #define STATIC_CALL_SITE_INIT 2UL /* init section */ 26 26 #define STATIC_CALL_SITE_FLAGS 3UL 27 27 28 + #ifndef __ASSEMBLY__ 29 + 28 30 /* 29 31 * The static call site table needs to be created by external tooling (objtool 30 32 * or a compiler plugin). ··· 101 99 ((typeof(STATIC_CALL_TRAMP(name))*)(STATIC_CALL_KEY(name).func)) 102 100 103 101 #endif /* CONFIG_HAVE_STATIC_CALL */ 102 + 103 + #endif /* __ASSEMBLY__ */ 104 104 105 105 #endif /* _STATIC_CALL_TYPES_H */
+4
tools/include/linux/static_call_types.h
··· 25 25 #define STATIC_CALL_SITE_INIT 2UL /* init section */ 26 26 #define STATIC_CALL_SITE_FLAGS 3UL 27 27 28 + #ifndef __ASSEMBLY__ 29 + 28 30 /* 29 31 * The static call site table needs to be created by external tooling (objtool 30 32 * or a compiler plugin). ··· 101 99 ((typeof(STATIC_CALL_TRAMP(name))*)(STATIC_CALL_KEY(name).func)) 102 100 103 101 #endif /* CONFIG_HAVE_STATIC_CALL */ 102 + 103 + #endif /* __ASSEMBLY__ */ 104 104 105 105 #endif /* _STATIC_CALL_TYPES_H */