[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241226224521.2d159a02@batman.local.home>
Date: Thu, 26 Dec 2024 22:45:21 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: LKML <linux-kernel@...r.kernel.org>, Linux Trace Kernel
<linux-trace-kernel@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
linux-kbuild@...r.kernel.org, Masami Hiramatsu <mhiramat@...nel.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>, Peter Zijlstra
<peterz@...radead.org>, Masahiro Yamada <masahiroy@...nel.org>, Nathan
Chancellor <nathan@...nel.org>, Nicolas Schier <nicolas@...sle.eu>, Zheng
Yejian <zhengyejian1@...wei.com>, Martin Kelly
<martin.kelly@...wdstrike.com>, Christophe Leroy
<christophe.leroy@...roup.eu>, Josh Poimboeuf <jpoimboe@...hat.com>, Mark
Rutland <mark.rutland@....com>
Subject: Re: [POC][RFC][PATCH] build: Make weak functions visible in
kallsyms
On Thu, 26 Dec 2024 19:35:18 -0800
Linus Torvalds <torvalds@...ux-foundation.org> wrote:
> On Thu, 26 Dec 2024 at 13:49, Steven Rostedt <rostedt@...dmis.org> wrote:
> >
> > But then, when the linker removes these functions because they were
> > overridden, the code does not disappear, leaving the pointers in the
> > __mcount_loc locations.
>
> Btw, does this actually happen when the compiler does the mcount thing for us?
Yes.
I believe the issue is that the mcount_loc is created during the
compile phase, and it just points to the call to fentry/mcount. The
linker phase doesn't remove the code, just the symbols that are
overridden. That means the pointer to the fentry/mcount calls still
point to the same locations, as the code is still there.
I even sent an email about this to the gcc folks, and Peter responded
basically explaining the above.
https://lore.kernel.org/all/20241014210841.5a4764de@gandalf.local.home/
-- Steve
Powered by blists - more mailing lists