linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: "llvm@lists.linux.dev" <llvm@lists.linux.dev>,
	Nick Desaulniers <ndesaulniers@google.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Nathan Chancellor <nathan@kernel.org>,
	"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH 2/2] recordmcount: Handle sections with no non-weak symbols
Date: Tue, 3 May 2022 12:25:33 -0400	[thread overview]
Message-ID: <20220503122533.6033647e@rorschach.local.home> (raw)
In-Reply-To: <6d5ff91a-560e-56ea-0047-175f712872c2@csgroup.eu>

On Tue, 3 May 2022 11:20:22 +0000
Christophe Leroy <christophe.leroy@csgroup.eu> wrote:

> Maybe I misunderstood. When you say 'after linking', do you mean vmlinux 
> or vmlinux.o ?

Whichever ;-)

> 
> In vmlinux, the addresses to be saved in __mcount_loc table might not 
> contain anymore a call to _mcount but a call to a trampoline that jumps 
> to _mcount, in case _mcount is too far from the said location at link 
> time. That's what I meant.

But how is that different than what is done today? And at linking,
everything still calls mcount. It's not until runtime things change.

The point I'm talking about is that after linking, if the linker
removed unused code (which would include unused weak functions,
right?), then the calls to mcount that were in the weak functions would
be gone too, and they would not be added by recordmcount, and for those
that are still around, then using their symbols as the reference point
would also not be an issue.

The problem we have right now is that the only symbol we have is a weak
function to reference the mcount call location in the __mcount_loc
section. But if all the global entries are not used and the linker
removes them, then the references using those symbols in the
__mcount_loc section will be "undefined". After linking, everything in
the vmlinux(.o) is set, and we are free to use that as a reference
point for the call sites.

-- Steve

  reply	other threads:[~2022-05-03 16:26 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-27  9:31 [PATCH 0/2] ftrace/recordmcount: Handle object files without section symbols Naveen N. Rao
2022-04-27  9:31 ` [PATCH 1/2] ftrace: Drop duplicate mcount locations Naveen N. Rao
2022-04-27 13:46   ` Steven Rostedt
2022-04-27  9:31 ` [PATCH 2/2] recordmcount: Handle sections with no non-weak symbols Naveen N. Rao
2022-04-27 13:54   ` Steven Rostedt
2022-04-28  7:45     ` Naveen N. Rao
2022-04-28 14:06       ` Steven Rostedt
2022-04-28 17:24         ` Naveen N. Rao
2022-04-28 17:31         ` Naveen N. Rao
2022-05-02 14:44         ` Christophe Leroy
2022-05-02 23:52           ` Steven Rostedt
2022-05-03 11:20             ` Christophe Leroy
2022-05-03 16:25               ` Steven Rostedt [this message]
2022-05-04 16:50                 ` Christophe Leroy
2022-05-04 17:06                   ` Steven Rostedt
2022-05-04 17:10                     ` Christophe Leroy
2022-08-16 14:04 ` [PATCH 0/2] ftrace/recordmcount: Handle object files without section symbols Steven Rostedt
2022-08-16 17:05   ` Naveen N. Rao

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=20220503122533.6033647e@rorschach.local.home \
    --to=rostedt@goodmis.org \
    --cc=christophe.leroy@csgroup.eu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=naveen.n.rao@linux.vnet.ibm.com \
    --cc=ndesaulniers@google.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;
as well as URLs for NNTP newsgroup(s).