From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Yoshinori Sato <ysato@users.sourceforge.jp>,
Rich Felker <dalias@libc.org>,
linux-sh@vger.kernel.org
Subject: [for-next][PATCH 10/12] ftrace/sh: Add arch_ftrace_ops_list_func stub to have compressed image still link
Date: Tue, 26 Oct 2021 12:23:25 -0400 [thread overview]
Message-ID: <20211026162349.204017174@goodmis.org> (raw)
In-Reply-To: 20211026162315.297389528@goodmis.org
From: "linux-sh@vger.kernel.org" <linux-sh@vger.kernel.org>
Using the linker script to fix an issue where some archs call the
function tracer with just the ip (instruction pointer) and pip (parent
instruction pointer) where as more up to date archs also pass in the
associated ftrace_ops and the ftrace_regs pointer, the generic code
will be called either with two parameters or four. To avoid any C
undefined behavior of calling two parameters to four or four to two
parameter function, two functions are created, where a preprocessor
macro uses the one that matches the architecture. As the function
pointers for them may be different, a typecast is used. But this
triggers issues with newer compilers that will fail due to -Werror.
A linker trick is now used to map the generic function to the function
that is used (note the generic function is only used to set the default
function callback). The linker trick defines ftrace_ops_list_func (the
generic function) to arch_ftrace_ops_list_func (the arch defined one).
Link: https://lore.kernel.org/all/20200617165616.52241bde@oasis.local.home/
But this fails sh arch because their linker script is included in their
compressed image that does not define arch_ftrace_ops_list_func at all
sh4-linux-ld:arch/sh/boot/compressed/../../kernel/vmlinux.lds:32: undefined symbol `arch_ftrace_ops_list_func' referenced in expression
Included a stub by that name in the misc.c to allow the code to
compile and link, even though it's not used.
This is similar to what was done for ftrace_stub:
b83b43ffc6e4b ("fgraph: Fix function type mismatches of
ftrace_graph_return using ftrace_stub")
Link: https://lkml.kernel.org/r/20211021221627.5d7270de@rorschach.local.home
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: linux-sh@vger.kernel.org
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
arch/sh/boot/compressed/misc.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/sh/boot/compressed/misc.c b/arch/sh/boot/compressed/misc.c
index a03b6680a9d9..ca05c99a3d5b 100644
--- a/arch/sh/boot/compressed/misc.c
+++ b/arch/sh/boot/compressed/misc.c
@@ -115,6 +115,9 @@ void __stack_chk_fail(void)
void ftrace_stub(void)
{
}
+void arch_ftrace_ops_list_func(void)
+{
+}
#define stackalign 4
--
2.33.0
next prev parent reply other threads:[~2021-10-26 16:24 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-26 16:23 [for-next][PATCH 00/12] tracing: More updates for 5.16 Steven Rostedt
2021-10-26 16:23 ` [for-next][PATCH 01/12] ftrace: Make ftrace_profile_pages_init static Steven Rostedt
2021-10-26 16:23 ` [for-next][PATCH 02/12] tools/latency-collector: Use correct size when writing queue_full_warning Steven Rostedt
2021-10-26 16:23 ` [for-next][PATCH 03/12] perf/core: allow ftrace for functions in kernel/event/core.c Steven Rostedt
2021-10-26 16:23 ` [for-next][PATCH 04/12] trace/osnoise: Fix an ifdef comment Steven Rostedt
2021-10-26 16:23 ` [for-next][PATCH 05/12] tracing/doc: Fix typos on the timerlat tracer documentation Steven Rostedt
2021-10-26 16:23 ` [for-next][PATCH 06/12] trace/osnoise: Add migrate-disabled field to the osnoise header Steven Rostedt
2021-10-26 16:23 ` [for-next][PATCH 07/12] trace/timerlat: Add migrate-disabled field to the timerlat header Steven Rostedt
2021-10-26 16:23 ` [for-next][PATCH 08/12] tracing: Fix missing trace_boot_init_histograms kstrdup NULL checks Steven Rostedt
2021-10-26 16:23 ` [for-next][PATCH 09/12] tracing/hwlat: Make some internal symbols static Steven Rostedt
2021-10-26 16:23 ` Steven Rostedt [this message]
2021-10-27 8:58 ` [for-next][PATCH 10/12] ftrace/sh: Add arch_ftrace_ops_list_func stub to have compressed image still link Sergey Shtylyov
2021-10-27 12:01 ` Steven Rostedt
2021-10-26 16:23 ` [for-next][PATCH 11/12] lib/bootconfig: Make xbc_alloc_mem() and xbc_free_mem() as __init function Steven Rostedt
2021-10-26 16:23 ` [for-next][PATCH 12/12] kprobes: Add a test case for stacktrace from kretprobe handler Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211026162349.204017174@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=dalias@libc.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=ysato@users.sourceforge.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox