Depmod WARNING: *.ko needs unknown symbol _mcount when enabling dynamic ftrace on Jetson aarch64 (depmod needs unknown symbol)

Hi all,

This is a follow-up to the closed thread below, as I ran into the same warning and wanted to share the root cause I found:

https://forums.developer.nvidia.com/t/why-does-the-compiler-have-such-a-warning/319214

depmod: WARNING: /home/user/jetson_kernel/Linux_for_Tegra/rootfs/lib/modules/5.15.148-tegra/updates/drivers/pci/controller/tegra-pcie-edma.ko needs unknown symbol _mcount

etc…

On Jetson (ARM64), when CONFIG_DYNAMIC_FTRACE is enabled, the kernel switches to
FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY. In this mode, function entry uses
patchable NOPs (__fentry__) instead of real _mcount calls, so the rebuilt kernel
does not export _mcount, which is expected behavior.

However, the Jetson Linux BSP installed via apply_binaries.sh contains prebuilt
NVIDIA OOT modules
under rootfs/lib/modules/.../updates/. These modules were built
with ftrace disabled and compiled with -pg, so they still reference _mcount.

During make modules_install, the build system automatically runs depmod. At that
point:

  • the kernel symbol table no longer contains _mcount (dynamic ftrace enabled)

  • the NVIDIA prebuilt modules that reference _mcount are still present

So depmod reports warnings like:

nv_xxx.ko needs unknown symbol _mcount

After rebuilding and reinstalling the modules (or rebuilding NVIDIA OOT modules),
those prebuilt .ko files are replaced with newly built ones that no longer reference
_mcount. If make modules_install (or depmod) is run again after this replacement,
the warning no longer appears.

So the warning is accurate at the time it is printed, but it does not reflect the
final state of the system. It’s essentially an ordering/timing issue when enabling
dynamic ftrace while NVIDIA prebuilt OOT modules are still present.
Don’t forget to update the initrd using the script `l4t_update_initrd.sh’ present int Linux_for_Tegra/tools/

Posting this in case it helps others who see the same warning when enabling tracing
on Jetson.

Thanks.

2 Likes

Hi,
Thanks for the sharing. Please share which platform you are using. This sharing is in Jetson Nano category which seems incorrect.