Hi Tobias, I love your patch! Perhaps something to improve: [auto build test WARNING on bpf-next/master] url: https://github.com/0day-ci/linux/commits/Tobias-Klauser/bpf-x86-Factor-common-x86-JIT-code/20200630-045932 base: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master config: x86_64-randconfig-a002-20200630 (attached as .config) compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project cf1d04484344be52ada8178e41d18fd15a9b880c) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install x86_64 cross compiling tool for clang build # apt-get install binutils-x86-64-linux-gnu # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All warnings (new ones prefixed by >>): arch/x86/purgatory/purgatory.c:57:6: warning: no previous prototype for function 'warn' [-Wmissing-prototypes] void warn(const char *msg) {} ^ arch/x86/purgatory/purgatory.c:57:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void warn(const char *msg) {} ^ static 1 warning generated. >> arch/x86/net/bpf_jit_comp64.c:1713:5: warning: no previous prototype for function 'arch_prepare_bpf_dispatcher' [-Wmissing-prototypes] int arch_prepare_bpf_dispatcher(void *image, s64 *funcs, int num_funcs) ^ arch/x86/net/bpf_jit_comp64.c:1713:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int arch_prepare_bpf_dispatcher(void *image, s64 *funcs, int num_funcs) ^ static arch/x86/mm/init.c:81:6: warning: no previous prototype for function 'x86_has_pat_wp' [-Wmissing-prototypes] bool x86_has_pat_wp(void) ^ arch/x86/mm/init.c:81:1: note: declare 'static' if the function is not intended to be used outside of this translation unit bool x86_has_pat_wp(void) ^ static arch/x86/mm/init.c:86:22: warning: no previous prototype for function 'pgprot2cachemode' [-Wmissing-prototypes] enum page_cache_mode pgprot2cachemode(pgprot_t pgprot) ^ arch/x86/mm/init.c:86:1: note: declare 'static' if the function is not intended to be used outside of this translation unit enum page_cache_mode pgprot2cachemode(pgprot_t pgprot) ^ static In file included from arch/x86/boot/compressed/string.c:11: arch/x86/boot/compressed/../string.c:43:5: warning: no previous prototype for function 'bcmp' [-Wmissing-prototypes] int bcmp(const void *s1, const void *s2, size_t len) ^ arch/x86/boot/compressed/../string.c:43:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int bcmp(const void *s1, const void *s2, size_t len) ^ static arch/x86/boot/compressed/../string.c:145:6: warning: no previous prototype for function 'simple_strtol' [-Wmissing-prototypes] long simple_strtol(const char *cp, char **endp, unsigned int base) ^ arch/x86/boot/compressed/../string.c:145:1: note: declare 'static' if the function is not intended to be used outside of this translation unit long simple_strtol(const char *cp, char **endp, unsigned int base) ^ static arch/x86/boot/compressed/string.c:53:7: warning: no previous prototype for function 'memmove' [-Wmissing-prototypes] void *memmove(void *dest, const void *src, size_t n) ^ arch/x86/boot/compressed/string.c:53:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void *memmove(void *dest, const void *src, size_t n) ^ static 3 warnings generated. 2 warnings generated. 1 warning generated. arch/x86/entry/common.c:274:24: warning: no previous prototype for function 'prepare_exit_to_usermode' [-Wmissing-prototypes] __visible noinstr void prepare_exit_to_usermode(struct pt_regs *regs) ^ arch/x86/entry/common.c:274:19: note: declare 'static' if the function is not intended to be used outside of this translation unit __visible noinstr void prepare_exit_to_usermode(struct pt_regs *regs) ^ static arch/x86/entry/common.c:336:24: warning: no previous prototype for function 'syscall_return_slowpath' [-Wmissing-prototypes] __visible noinstr void syscall_return_slowpath(struct pt_regs *regs) ^ arch/x86/entry/common.c:336:19: note: declare 'static' if the function is not intended to be used outside of this translation unit __visible noinstr void syscall_return_slowpath(struct pt_regs *regs) ^ static arch/x86/entry/vdso/vgetcpu.c:14:1: warning: no previous prototype for function '__vdso_getcpu' [-Wmissing-prototypes] __vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused) ^ arch/x86/entry/vdso/vgetcpu.c:13:9: note: declare 'static' if the function is not intended to be used outside of this translation unit notrace long ^ static 1 warning generated. 2 warnings generated. arch/x86/kernel/i8259.c:237: warning: Function parameter or member 'trigger' not described in 'restore_ELCR' arch/x86/mm/ioremap.c:737:17: warning: no previous prototype for function 'early_memremap_pgprot_adjust' [-Wmissing-prototypes] pgprot_t __init early_memremap_pgprot_adjust(resource_size_t phys_addr, ^ arch/x86/mm/ioremap.c:737:1: note: declare 'static' if the function is not intended to be used outside of this translation unit pgprot_t __init early_memremap_pgprot_adjust(resource_size_t phys_addr, ^ static arch/x86/mm/extable.c:26:16: warning: no previous prototype for function 'ex_handler_default' [-Wmissing-prototypes] __visible bool ex_handler_default(const struct exception_table_entry *fixup, ^ arch/x86/mm/extable.c:26:11: note: declare 'static' if the function is not intended to be used outside of this translation unit __visible bool ex_handler_default(const struct exception_table_entry *fixup, ^ static arch/x86/mm/extable.c:36:16: warning: no previous prototype for function 'ex_handler_fault' [-Wmissing-prototypes] __visible bool ex_handler_fault(const struct exception_table_entry *fixup, ^ arch/x86/mm/extable.c:36:11: note: declare 'static' if the function is not intended to be used outside of this translation unit __visible bool ex_handler_fault(const struct exception_table_entry *fixup, ^ static arch/x86/mm/extable.c:57:16: warning: no previous prototype for function 'ex_handler_fprestore' [-Wmissing-prototypes] __visible bool ex_handler_fprestore(const struct exception_table_entry *fixup, ^ arch/x86/mm/extable.c:57:11: note: declare 'static' if the function is not intended to be used outside of this translation unit __visible bool ex_handler_fprestore(const struct exception_table_entry *fixup, ^ static arch/x86/mm/extable.c:72:16: warning: no previous prototype for function 'ex_handler_uaccess' [-Wmissing-prototypes] __visible bool ex_handler_uaccess(const struct exception_table_entry *fixup, ^ -- arch/x86/purgatory/purgatory.c:57:6: warning: no previous prototype for function 'warn' [-Wmissing-prototypes] void warn(const char *msg) {} ^ arch/x86/purgatory/purgatory.c:57:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void warn(const char *msg) {} ^ static 1 warning generated. >> arch/x86/net/bpf_jit_comp64.c:1713:5: warning: no previous prototype for function 'arch_prepare_bpf_dispatcher' [-Wmissing-prototypes] int arch_prepare_bpf_dispatcher(void *image, s64 *funcs, int num_funcs) ^ arch/x86/net/bpf_jit_comp64.c:1713:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int arch_prepare_bpf_dispatcher(void *image, s64 *funcs, int num_funcs) ^ static arch/x86/mm/init.c:81:6: warning: no previous prototype for function 'x86_has_pat_wp' [-Wmissing-prototypes] bool x86_has_pat_wp(void) ^ arch/x86/mm/init.c:81:1: note: declare 'static' if the function is not intended to be used outside of this translation unit bool x86_has_pat_wp(void) ^ static arch/x86/mm/init.c:86:22: warning: no previous prototype for function 'pgprot2cachemode' [-Wmissing-prototypes] enum page_cache_mode pgprot2cachemode(pgprot_t pgprot) ^ arch/x86/mm/init.c:86:1: note: declare 'static' if the function is not intended to be used outside of this translation unit enum page_cache_mode pgprot2cachemode(pgprot_t pgprot) ^ static In file included from arch/x86/boot/compressed/string.c:11: arch/x86/boot/compressed/../string.c:43:5: warning: no previous prototype for function 'bcmp' [-Wmissing-prototypes] int bcmp(const void *s1, const void *s2, size_t len) ^ arch/x86/boot/compressed/../string.c:43:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int bcmp(const void *s1, const void *s2, size_t len) ^ static arch/x86/boot/compressed/../string.c:145:6: warning: no previous prototype for function 'simple_strtol' [-Wmissing-prototypes] long simple_strtol(const char *cp, char **endp, unsigned int base) ^ arch/x86/boot/compressed/../string.c:145:1: note: declare 'static' if the function is not intended to be used outside of this translation unit long simple_strtol(const char *cp, char **endp, unsigned int base) ^ static arch/x86/boot/compressed/string.c:53:7: warning: no previous prototype for function 'memmove' [-Wmissing-prototypes] void *memmove(void *dest, const void *src, size_t n) ^ arch/x86/boot/compressed/string.c:53:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void *memmove(void *dest, const void *src, size_t n) ^ static 3 warnings generated. 2 warnings generated. 1 warning generated. arch/x86/entry/common.c:274:24: warning: no previous prototype for function 'prepare_exit_to_usermode' [-Wmissing-prototypes] __visible noinstr void prepare_exit_to_usermode(struct pt_regs *regs) ^ arch/x86/entry/common.c:274:19: note: declare 'static' if the function is not intended to be used outside of this translation unit __visible noinstr void prepare_exit_to_usermode(struct pt_regs *regs) ^ static arch/x86/entry/common.c:336:24: warning: no previous prototype for function 'syscall_return_slowpath' [-Wmissing-prototypes] __visible noinstr void syscall_return_slowpath(struct pt_regs *regs) ^ arch/x86/entry/common.c:336:19: note: declare 'static' if the function is not intended to be used outside of this translation unit __visible noinstr void syscall_return_slowpath(struct pt_regs *regs) ^ static arch/x86/entry/vdso/vgetcpu.c:14:1: warning: no previous prototype for function '__vdso_getcpu' [-Wmissing-prototypes] __vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused) ^ arch/x86/entry/vdso/vgetcpu.c:13:9: note: declare 'static' if the function is not intended to be used outside of this translation unit notrace long ^ static 1 warning generated. 2 warnings generated. arch/x86/kernel/i8259.c:237: warning: Function parameter or member 'trigger' not described in 'restore_ELCR' arch/x86/mm/ioremap.c:737:17: warning: no previous prototype for function 'early_memremap_pgprot_adjust' [-Wmissing-prototypes] pgprot_t __init early_memremap_pgprot_adjust(resource_size_t phys_addr, ^ arch/x86/mm/ioremap.c:737:1: note: declare 'static' if the function is not intended to be used outside of this translation unit pgprot_t __init early_memremap_pgprot_adjust(resource_size_t phys_addr, ^ static arch/x86/mm/extable.c:26:16: warning: no previous prototype for function 'ex_handler_default' [-Wmissing-prototypes] __visible bool ex_handler_default(const struct exception_table_entry *fixup, ^ arch/x86/mm/extable.c:26:11: note: declare 'static' if the function is not intended to be used outside of this translation unit __visible bool ex_handler_default(const struct exception_table_entry *fixup, ^ static arch/x86/mm/extable.c:36:16: warning: no previous prototype for function 'ex_handler_fault' [-Wmissing-prototypes] __visible bool ex_handler_fault(const struct exception_table_entry *fixup, ^ arch/x86/mm/extable.c:36:11: note: declare 'static' if the function is not intended to be used outside of this translation unit __visible bool ex_handler_fault(const struct exception_table_entry *fixup, ^ static arch/x86/mm/extable.c:57:16: warning: no previous prototype for function 'ex_handler_fprestore' [-Wmissing-prototypes] __visible bool ex_handler_fprestore(const struct exception_table_entry *fixup, ^ arch/x86/mm/extable.c:57:11: note: declare 'static' if the function is not intended to be used outside of this translation unit __visible bool ex_handler_fprestore(const struct exception_table_entry *fixup, ^ static arch/x86/mm/extable.c:72:16: warning: no previous prototype for function 'ex_handler_uaccess' [-Wmissing-prototypes] __visible bool ex_handler_uaccess(const struct exception_table_entry *fixup, ^ -- >> arch/x86/net/bpf_jit_comp64.c:1713:5: warning: no previous prototype for function 'arch_prepare_bpf_dispatcher' [-Wmissing-prototypes] int arch_prepare_bpf_dispatcher(void *image, s64 *funcs, int num_funcs) ^ arch/x86/net/bpf_jit_comp64.c:1713:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int arch_prepare_bpf_dispatcher(void *image, s64 *funcs, int num_funcs) ^ static 1 warning generated. -- arch/x86/purgatory/purgatory.c:57:6: warning: no previous prototype for function 'warn' [-Wmissing-prototypes] void warn(const char *msg) {} ^ arch/x86/purgatory/purgatory.c:57:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void warn(const char *msg) {} ^ static 1 warning generated. arch/x86/mm/init.c:81:6: warning: no previous prototype for function 'x86_has_pat_wp' [-Wmissing-prototypes] bool x86_has_pat_wp(void) ^ arch/x86/mm/init.c:81:1: note: declare 'static' if the function is not intended to be used outside of this translation unit bool x86_has_pat_wp(void) ^ static arch/x86/mm/init.c:86:22: warning: no previous prototype for function 'pgprot2cachemode' [-Wmissing-prototypes] enum page_cache_mode pgprot2cachemode(pgprot_t pgprot) ^ arch/x86/mm/init.c:86:1: note: declare 'static' if the function is not intended to be used outside of this translation unit enum page_cache_mode pgprot2cachemode(pgprot_t pgprot) ^ static >> arch/x86/net/bpf_jit_comp64.c:1713:5: warning: no previous prototype for function 'arch_prepare_bpf_dispatcher' [-Wmissing-prototypes] int arch_prepare_bpf_dispatcher(void *image, s64 *funcs, int num_funcs) ^ arch/x86/net/bpf_jit_comp64.c:1713:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int arch_prepare_bpf_dispatcher(void *image, s64 *funcs, int num_funcs) ^ static arch/x86/entry/common.c:274:24: warning: no previous prototype for function 'prepare_exit_to_usermode' [-Wmissing-prototypes] __visible noinstr void prepare_exit_to_usermode(struct pt_regs *regs) ^ arch/x86/entry/common.c:274:19: note: declare 'static' if the function is not intended to be used outside of this translation unit __visible noinstr void prepare_exit_to_usermode(struct pt_regs *regs) ^ static arch/x86/entry/common.c:336:24: warning: no previous prototype for function 'syscall_return_slowpath' [-Wmissing-prototypes] __visible noinstr void syscall_return_slowpath(struct pt_regs *regs) ^ arch/x86/entry/common.c:336:19: note: declare 'static' if the function is not intended to be used outside of this translation unit __visible noinstr void syscall_return_slowpath(struct pt_regs *regs) ^ static 2 warnings generated. 2 warnings generated. In file included from arch/x86/boot/compressed/string.c:11: arch/x86/boot/compressed/../string.c:43:5: warning: no previous prototype for function 'bcmp' [-Wmissing-prototypes] int bcmp(const void *s1, const void *s2, size_t len) ^ arch/x86/boot/compressed/../string.c:43:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int bcmp(const void *s1, const void *s2, size_t len) ^ static arch/x86/boot/compressed/../string.c:145:6: warning: no previous prototype for function 'simple_strtol' [-Wmissing-prototypes] long simple_strtol(const char *cp, char **endp, unsigned int base) ^ arch/x86/boot/compressed/../string.c:145:1: note: declare 'static' if the function is not intended to be used outside of this translation unit long simple_strtol(const char *cp, char **endp, unsigned int base) ^ static arch/x86/boot/compressed/string.c:53:7: warning: no previous prototype for function 'memmove' [-Wmissing-prototypes] void *memmove(void *dest, const void *src, size_t n) ^ arch/x86/boot/compressed/string.c:53:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void *memmove(void *dest, const void *src, size_t n) ^ static 3 warnings generated. arch/x86/entry/vdso/vgetcpu.c:14:1: warning: no previous prototype for function '__vdso_getcpu' [-Wmissing-prototypes] __vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused) ^ arch/x86/entry/vdso/vgetcpu.c:13:9: note: declare 'static' if the function is not intended to be used outside of this translation unit notrace long ^ static 1 warning generated. 1 warning generated. arch/x86/kernel/i8259.c:237: warning: Function parameter or member 'trigger' not described in 'restore_ELCR' arch/x86/mm/ioremap.c:737:17: warning: no previous prototype for function 'early_memremap_pgprot_adjust' [-Wmissing-prototypes] pgprot_t __init early_memremap_pgprot_adjust(resource_size_t phys_addr, ^ arch/x86/mm/ioremap.c:737:1: note: declare 'static' if the function is not intended to be used outside of this translation unit pgprot_t __init early_memremap_pgprot_adjust(resource_size_t phys_addr, ^ static 1 warning generated. arch/x86/mm/extable.c:26:16: warning: no previous prototype for function 'ex_handler_default' [-Wmissing-prototypes] __visible bool ex_handler_default(const struct exception_table_entry *fixup, ^ arch/x86/mm/extable.c:26:11: note: declare 'static' if the function is not intended to be used outside of this translation unit __visible bool ex_handler_default(const struct exception_table_entry *fixup, ^ static arch/x86/mm/extable.c:36:16: warning: no previous prototype for function 'ex_handler_fault' [-Wmissing-prototypes] __visible bool ex_handler_fault(const struct exception_table_entry *fixup, ^ arch/x86/mm/extable.c:36:11: note: declare 'static' if the function is not intended to be used outside of this translation unit __visible bool ex_handler_fault(const struct exception_table_entry *fixup, ^ static arch/x86/mm/extable.c:57:16: warning: no previous prototype for function 'ex_handler_fprestore' [-Wmissing-prototypes] __visible bool ex_handler_fprestore(const struct exception_table_entry *fixup, ^ arch/x86/mm/extable.c:57:11: note: declare 'static' if the function is not intended to be used outside of this translation unit __visible bool ex_handler_fprestore(const struct exception_table_entry *fixup, ^ static arch/x86/mm/extable.c:72:16: warning: no previous prototype for function 'ex_handler_uaccess' [-Wmissing-prototypes] __visible bool ex_handler_uaccess(const struct exception_table_entry *fixup, ^ arch/x86/mm/extable.c:72:11: note: declare 'static' if the function is not intended to be used outside of this translation unit __visible bool ex_handler_uaccess(const struct exception_table_entry *fixup, ^ static arch/x86/mm/extable.c:83:16: warning: no previous prototype for function 'ex_handler_rdmsr_unsafe' [-Wmissing-prototypes] __visible bool ex_handler_rdmsr_unsafe(const struct exception_table_entry *fixup, ^ arch/x86/mm/extable.c:83:11: note: declare 'static' if the function is not intended to be used outside of this translation unit __visible bool ex_handler_rdmsr_unsafe(const struct exception_table_entry *fixup, ^ static arch/x86/mm/extable.c:100:16: warning: no previous prototype for function 'ex_handler_wrmsr_unsafe' [-Wmissing-prototypes] __visible bool ex_handler_wrmsr_unsafe(const struct exception_table_entry *fixup, vim +/arch_prepare_bpf_dispatcher +1713 arch/x86/net/bpf_jit_comp64.c 75ccbef6369e94 arch/x86/net/bpf_jit_comp.c Björn Töpel 2019-12-13 1712 75ccbef6369e94 arch/x86/net/bpf_jit_comp.c Björn Töpel 2019-12-13 @1713 int arch_prepare_bpf_dispatcher(void *image, s64 *funcs, int num_funcs) 75ccbef6369e94 arch/x86/net/bpf_jit_comp.c Björn Töpel 2019-12-13 1714 { 75ccbef6369e94 arch/x86/net/bpf_jit_comp.c Björn Töpel 2019-12-13 1715 u8 *prog = image; 75ccbef6369e94 arch/x86/net/bpf_jit_comp.c Björn Töpel 2019-12-13 1716 75ccbef6369e94 arch/x86/net/bpf_jit_comp.c Björn Töpel 2019-12-13 1717 sort(funcs, num_funcs, sizeof(funcs[0]), cmp_ips, NULL); 75ccbef6369e94 arch/x86/net/bpf_jit_comp.c Björn Töpel 2019-12-13 1718 return emit_bpf_dispatcher(&prog, 0, num_funcs - 1, funcs); 75ccbef6369e94 arch/x86/net/bpf_jit_comp.c Björn Töpel 2019-12-13 1719 } 75ccbef6369e94 arch/x86/net/bpf_jit_comp.c Björn Töpel 2019-12-13 1720 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org