Re: [POC][RFC][PATCH] build: Make weak functions visible in kallsyms
From: Steven Rostedt <rostedt@goodmis.org>
Date: 2024-12-27 03:45:25
Also in:
bpf, linux-kbuild, lkml
From: Steven Rostedt <rostedt@goodmis.org>
Date: 2024-12-27 03:45:25
Also in:
bpf, linux-kbuild, lkml
On Thu, 26 Dec 2024 19:35:18 -0800 Linus Torvalds [off-list ref] wrote:
On Thu, 26 Dec 2024 at 13:49, Steven Rostedt [off-list ref] wrote:quoted
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/ (local) -- Steve