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

x86/asm: Differentiate between code and function alignment

Create SYM_F_ALIGN to differentiate alignment requirements between
SYM_CODE and SYM_FUNC.

This distinction is useful later when adding padding in front of
functions; IOW this allows following the compiler's
patchable-function-entry option.

[peterz: Changelog]

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20220915111143.824822743@infradead.org

authored by

Thomas Gleixner and committed by
Peter Zijlstra
8eb5d34e d49a0626

+9 -5
+9 -5
arch/x86/include/asm/linkage.h
··· 12 12 #define asmlinkage CPP_ASMLINKAGE __attribute__((regparm(0))) 13 13 #endif /* CONFIG_X86_32 */ 14 14 15 - #ifdef __ASSEMBLY__ 16 - 17 15 #define __ALIGN .balign CONFIG_FUNCTION_ALIGNMENT, 0x90; 18 16 #define __ALIGN_STR __stringify(__ALIGN) 17 + 18 + #define ASM_FUNC_ALIGN __ALIGN_STR 19 + #define __FUNC_ALIGN __ALIGN 20 + #define SYM_F_ALIGN __FUNC_ALIGN 21 + 22 + #ifdef __ASSEMBLY__ 19 23 20 24 #if defined(CONFIG_RETHUNK) && !defined(__DISABLE_EXPORTS) && !defined(BUILD_VDSO) 21 25 #define RET jmp __x86_return_thunk ··· 59 55 60 56 /* SYM_FUNC_START -- use for global functions */ 61 57 #define SYM_FUNC_START(name) \ 62 - SYM_START(name, SYM_L_GLOBAL, SYM_A_ALIGN) \ 58 + SYM_START(name, SYM_L_GLOBAL, SYM_F_ALIGN) \ 63 59 ENDBR 64 60 65 61 /* SYM_FUNC_START_NOALIGN -- use for global functions, w/o alignment */ ··· 69 65 70 66 /* SYM_FUNC_START_LOCAL -- use for local functions */ 71 67 #define SYM_FUNC_START_LOCAL(name) \ 72 - SYM_START(name, SYM_L_LOCAL, SYM_A_ALIGN) \ 68 + SYM_START(name, SYM_L_LOCAL, SYM_F_ALIGN) \ 73 69 ENDBR 74 70 75 71 /* SYM_FUNC_START_LOCAL_NOALIGN -- use for local functions, w/o alignment */ ··· 79 75 80 76 /* SYM_FUNC_START_WEAK -- use for weak functions */ 81 77 #define SYM_FUNC_START_WEAK(name) \ 82 - SYM_START(name, SYM_L_WEAK, SYM_A_ALIGN) \ 78 + SYM_START(name, SYM_L_WEAK, SYM_F_ALIGN) \ 83 79 ENDBR 84 80 85 81 /* SYM_FUNC_START_WEAK_NOALIGN -- use for weak functions, w/o alignment */