Skip to contentSkip to conversation

include/linux/ftrace.h:190:9: error: call to undeclared function 'arch_ftrace_get_regs'; ISO C99 and later do not support implicit function declarations

DISCUSSION kernel test robot 2 participants 2 messages Jun 19, 2025 – Jun 20, 2025

Subsystems (2)
lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   fb4d33ab452ea254e2c319bac5703d1b56d895bf
commit: d0262e907e2991ae09ca476281fc8cae3ec57850 riscv: ftrace: support PREEMPT
date:   2 weeks ago
config: riscv-randconfig-r071-20250619 (https://download.01.org/0day-ci/archive/20250619/[email protected]/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project 875b36a8742437b95f623bab1e0332562c7b4b3f)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250619/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

In file included from arch/riscv/kernel/asm-offsets.c:10:

>> include/linux/ftrace.h:190:9: error: call to undeclared function 'arch_ftrace_get_regs'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     190 |         return arch_ftrace_get_regs(fregs);
         |                ^
   include/linux/ftrace.h:190:9: note: did you mean 'ftrace_get_regs'?
   include/linux/ftrace.h:185:40: note: 'ftrace_get_regs' declared here
     185 | static __always_inline struct pt_regs *ftrace_get_regs(struct ftrace_regs *fregs)
         |                                        ^
     186 | {
     187 |         if (!fregs)
     188 |                 return NULL;
     189 | 
     190 |         return arch_ftrace_get_regs(fregs);
         |                ~~~~~~~~~~~~~~~~~~~~
         |                ftrace_get_regs
>> include/linux/ftrace.h:190:9: error: incompatible integer to pointer conversion returning 'int' from a function with result type 'struct pt_regs *' [-Wint-conversion]
     190 |         return arch_ftrace_get_regs(fregs);
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~

2 errors generated.
make[3]: *** [scripts/Makefile.build:98: arch/riscv/kernel/asm-offsets.s] Error 1 make[3]: Target 'prepare' not remade because of errors.
make[2]: *** [Makefile:1282: prepare0] Error 2
make[2]: Target 'prepare' not remade because of errors.
make[1]: *** [Makefile:248: __sub-make] Error 2
make[1]: Target 'prepare' not remade because of errors.
make: *** [Makefile:248: __sub-make] Error 2
make: Target 'prepare' not remade because of errors.

vim +/arch_ftrace_get_regs +190 include/linux/ftrace.h

762abbc0d09f7a Masami Hiramatsu (Google  2024-12-26  184) 
d19ad0775dcd64 Steven Rostedt (VMware    2020-10-28  185) static __always_inline struct pt_regs *ftrace_get_regs(struct ftrace_regs *fregs)
d19ad0775dcd64 Steven Rostedt (VMware    2020-10-28  186) {
d19ad0775dcd64 Steven Rostedt (VMware    2020-10-28  187) 	if (!fregs)
d19ad0775dcd64 Steven Rostedt (VMware    2020-10-28  188) 		return NULL;
d19ad0775dcd64 Steven Rostedt (VMware    2020-10-28  189) 
02a474ca266a47 Steven Rostedt (VMware    2020-10-27 @190) 	return arch_ftrace_get_regs(fregs);
d19ad0775dcd64 Steven Rostedt (VMware    2020-10-28  191) }
d19ad0775dcd64 Steven Rostedt (VMware    2020-10-28  192) 

:::::: The code at line 190 was first introduced by commit
:::::: 02a474ca266a47ea8f4d5a11f4ffa120f83730ad ftrace/x86: Allow for arguments to be passed in to ftrace_regs by default

:::::: TO: Steven Rostedt (VMware) <[email protected]> :::::: CC: Steven Rostedt (VMware) <[email protected]>

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#1 lore raw
Quoted 31 lines · kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   fb4d33ab452ea254e2c319bac5703d1b56d895bf
commit: d0262e907e2991ae09ca476281fc8cae3ec57850 riscv: ftrace: support PREEMPT
date:   2 weeks ago
config: riscv-randconfig-r071-20250619 (https://download.01.org/0day-ci/archive/20250619/[email protected]/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project 875b36a8742437b95f623bab1e0332562c7b4b3f)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250619/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

In file included from arch/riscv/kernel/asm-offsets.c:10:

Quoted 1 line
Quoted 1 line

include/linux/ftrace.h:190:9: error: call to undeclared function 'arch_ftrace_get_regs'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

     190 |         return arch_ftrace_get_regs(fregs);
         |                ^
   include/linux/ftrace.h:190:9: note: did you mean 'ftrace_get_regs'?
   include/linux/ftrace.h:185:40: note: 'ftrace_get_regs' declared here
     185 | static __always_inline struct pt_regs *ftrace_get_regs(struct ftrace_regs *fregs)
         |                                        ^
     186 | {
     187 |         if (!fregs)
     188 |                 return NULL;
     189 |
     190 |         return arch_ftrace_get_regs(fregs);
         |                ~~~~~~~~~~~~~~~~~~~~
         |                ftrace_get_regs
Quoted 3 lines
Quoted 1 line
Quoted 1 line

include/linux/ftrace.h:190:9: error: incompatible integer to pointer conversion returning 'int' from a function with result type 'struct pt_regs *' [-Wint-conversion]

     190 |         return arch_ftrace_get_regs(fregs);
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~

This is what I came up with because after fixing this ^, we get other similar failures. My level of confidence on this one is pretty low though, so if someone can confirm, that'd be nice:

arch/riscv/include/asm/ftrace.h +1 -2
index 22ebea3c2b26c..28319c50d0315 100644
@@ -49,7 +49,7 @@ struct dyn_arch_ftrace {
 };
 #endif
 
-#ifdef CONFIG_DYNAMIC_FTRACE
+#ifdef CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS
 /*
  * A general call in RISC-V is a pair of insts:
  * 1) auipc: setting high-20 pc-related bits to ra register
@@ -117,7 +117,6 @@ struct dyn_ftrace;
 int ftrace_init_nop(struct module *mod, struct dyn_ftrace *rec);
 #define ftrace_init_nop ftrace_init_nop
 
-#ifdef CONFIG_DYNAMIC_FTRACE_WITH_ARGS
 #define arch_ftrace_get_regs(regs) NULL
 #define HAVE_ARCH_FTRACE_REGS
 struct ftrace_ops;
@@ -233,8 +232,6 @@ static inline void

arch_ftrace_set_direct_caller(struct ftrace_regs *fregs, unsi
}
#endif /* CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS */

-#endif /* CONFIG_DYNAMIC_FTRACE_WITH_ARGS */
-
#endif /* __ASSEMBLY__ */

#endif /* CONFIG_DYNAMIC_FTRACE */

arch/riscv/kernel/asm-offsets.c +1 -1
index 6e8c0d6feae9e..f29b33358a328 100644
@@ -505,7 +505,7 @@ void asm_offsets(void)
 #endif /* CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS */
 #endif
 
-#ifdef CONFIG_DYNAMIC_FTRACE_WITH_ARGS
+#ifdef CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS
        DEFINE(FREGS_SIZE_ON_STACK, ALIGN(sizeof(struct
__arch_ftrace_regs), STACK_ALIGN));
        DEFINE(FREGS_EPC,           offsetof(struct __arch_ftrace_regs, epc));
        DEFINE(FREGS_RA,            offsetof(struct __arch_ftrace_regs, ra));

Thanks,

Alex

Quoted 32 lines

2 errors generated.
make[3]: *** [scripts/Makefile.build:98: arch/riscv/kernel/asm-offsets.s] Error 1 make[3]: Target 'prepare' not remade because of errors.
make[2]: *** [Makefile:1282: prepare0] Error 2
make[2]: Target 'prepare' not remade because of errors.
make[1]: *** [Makefile:248: __sub-make] Error 2
make[1]: Target 'prepare' not remade because of errors.
make: *** [Makefile:248: __sub-make] Error 2
make: Target 'prepare' not remade because of errors.

vim +/arch_ftrace_get_regs +190 include/linux/ftrace.h

762abbc0d09f7a Masami Hiramatsu (Google  2024-12-26  184)
d19ad0775dcd64 Steven Rostedt (VMware    2020-10-28  185) static __always_inline struct pt_regs *ftrace_get_regs(struct ftrace_regs *fregs)
d19ad0775dcd64 Steven Rostedt (VMware    2020-10-28  186) {
d19ad0775dcd64 Steven Rostedt (VMware    2020-10-28  187)       if (!fregs)
d19ad0775dcd64 Steven Rostedt (VMware    2020-10-28  188)               return NULL;
d19ad0775dcd64 Steven Rostedt (VMware    2020-10-28  189)
02a474ca266a47 Steven Rostedt (VMware    2020-10-27 @190)       return arch_ftrace_get_regs(fregs);
d19ad0775dcd64 Steven Rostedt (VMware    2020-10-28  191) }
d19ad0775dcd64 Steven Rostedt (VMware    2020-10-28  192)

:::::: The code at line 190 was first introduced by commit
:::::: 02a474ca266a47ea8f4d5a11f4ffa120f83730ad ftrace/x86: Allow for arguments to be passed in to ftrace_regs by default

:::::: TO: Steven Rostedt (VMware) <[email protected]> :::::: CC: Steven Rostedt (VMware) <[email protected]>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki