On Thu, 26 May 2022 10:05:30 -0700 Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote: > On Thu, 26 May 2022 10:38:10 -0400 Steven Rostedt <rostedt@xxxxxxxxxxx> wrote: > > > If an unused weak function was traced, it's call to fentry will still > > exist, which gets added into the __mcount_loc table. Ftrace will use > > kallsyms to retrieve the name for each location in __mcount_loc to display > > it in the available_filter_functions and used to enable functions via the > > name matching in set_ftrace_filter/notrace. Enabling these functions do > > nothing but enable an unused call to ftrace_caller. If a traced weak > > function is overridden, the symbol of the function would be used for it, > > which will either created duplicate names, or if the previous function was > > not traced, it would be incorrectly listed in available_filter_functions > > as a function that can be traced. > > This might be dependent on binutils version. In some situations the > unused __weak function might be dropped altogether. This change > (https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=d1bcae833b32f1) > tripped up recordmcount > (https://lore.kernel.org/all/20220518181828.645877-1-naveen.n.rao@xxxxxxxxxxxxxxxxxx/T/#u). > > The kexec fix will be to just give up on using __weak. Yes that's as separate issue with weak functions. Which reminds me, I told Jon Corbet I would write up an article about the problems of weak functions and ftrace ;-) -- Steve