From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 822CCF4F1; Fri, 27 Dec 2024 03:45:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735271125; cv=none; b=F4L8wYGmUhPvvlp2hbLsT3ZudcMK769vjAlihoDovjLwWV1wQEW8QKGuXeGyo3yl/5McLq++DNstbb5D7OIdSb4zwgYJ5HOaUIZRj1Dgpswk2tFiY62v++YghBVbUv3G1ccl7jKQB9uF0LhgWfaiKbRKcNMBp5Su7s5QMo8LR1o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735271125; c=relaxed/simple; bh=BHFNRIy84ix+cmpRswqeg1N+pU50oo8r026fuQsgnl0=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=IO/x142/lw89LS1qaaSZBjHiKSHt4yMa5nVqRAeW9Fnf6InQkoGQAy/2dZr+pSctqcjOGOWUziY0ILWeac97KmLWvsJDchmvZTlBlQCoL6GQCBqAyNFBV8GZB1gnnItLjxPVVa8QGdClz9/GjtzGmouDq9esTQbW6/22ngm1Xg0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52D65C4CED0; Fri, 27 Dec 2024 03:45:23 +0000 (UTC) Date: Thu, 26 Dec 2024 22:45:21 -0500 From: Steven Rostedt To: Linus Torvalds Cc: LKML , Linux Trace Kernel , bpf , linux-kbuild@vger.kernel.org, Masami Hiramatsu , Mathieu Desnoyers , Peter Zijlstra , Masahiro Yamada , Nathan Chancellor , Nicolas Schier , Zheng Yejian , Martin Kelly , Christophe Leroy , Josh Poimboeuf , Mark Rutland Subject: Re: [POC][RFC][PATCH] build: Make weak functions visible in kallsyms Message-ID: <20241226224521.2d159a02@batman.local.home> In-Reply-To: References: <20241226164957.5cab9f2d@gandalf.local.home> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 26 Dec 2024 19:35:18 -0800 Linus Torvalds wrote: > On Thu, 26 Dec 2024 at 13:49, Steven Rostedt 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