From: Steven Rostedt <rostedt@goodmis.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Linux Trace Kernel <linux-trace-kernel@vger.kernel.org>,
bpf <bpf@vger.kernel.org>,
linux-kbuild@vger.kernel.org,
Masami Hiramatsu <mhiramat@kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Peter Zijlstra <peterz@infradead.org>,
Masahiro Yamada <masahiroy@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
Nicolas Schier <nicolas@fjasle.eu>,
Zheng Yejian <zhengyejian1@huawei.com>,
Martin Kelly <martin.kelly@crowdstrike.com>,
Christophe Leroy <christophe.leroy@csgroup.eu>,
Josh Poimboeuf <jpoimboe@redhat.com>,
Mark Rutland <mark.rutland@arm.com>
Subject: Re: [POC][RFC][PATCH] build: Make weak functions visible in kallsyms
Date: Thu, 26 Dec 2024 22:45:21 -0500 [thread overview]
Message-ID: <20241226224521.2d159a02@batman.local.home> (raw)
In-Reply-To: <CAHk-=wiL8B2=fPaRwDPGgQhVs=3G=8Gy=QyR59L85L0GF67Gbg@mail.gmail.com>
On Thu, 26 Dec 2024 19:35:18 -0800
Linus Torvalds <torvalds@linux-foundation.org> wrote:
> On Thu, 26 Dec 2024 at 13:49, Steven Rostedt <rostedt@goodmis.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
next prev parent reply other threads:[~2024-12-27 3:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-26 21:49 [POC][RFC][PATCH] build: Make weak functions visible in kallsyms Steven Rostedt
2024-12-26 23:01 ` Linus Torvalds
2024-12-27 2:19 ` Steven Rostedt
2024-12-27 2:52 ` Masahiro Yamada
2024-12-27 3:03 ` Linus Torvalds
2024-12-27 2:58 ` Linus Torvalds
2024-12-27 3:35 ` Linus Torvalds
2024-12-27 3:45 ` Steven Rostedt [this message]
2024-12-27 18:09 ` Linus Torvalds
2024-12-27 19:19 ` Steven Rostedt
2025-01-03 11:00 ` Peter Zijlstra
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=20241226224521.2d159a02@batman.local.home \
--to=rostedt@goodmis.org \
--cc=bpf@vger.kernel.org \
--cc=christophe.leroy@csgroup.eu \
--cc=jpoimboe@redhat.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=martin.kelly@crowdstrike.com \
--cc=masahiroy@kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=nathan@kernel.org \
--cc=nicolas@fjasle.eu \
--cc=peterz@infradead.org \
--cc=torvalds@linux-foundation.org \
--cc=zhengyejian1@huawei.com \
/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