On 3/9/22 10:25, Lucas De Marchi wrote:
Hi Saul,
On Wed, Mar 09, 2022 at 10:09:58AM -0800, Saul Wold wrote:
Hi Lucas,
I work on the Yocto Project and we recently started to add kernel
module .debug info in <modpath>/.debug/<module>.ko. When depmod is
run, we are seeing that it might pick up the debug module instead of
the correct module.
This will cause an "Unknown symbol" failure when it picks the .debug
.ko file.
I am wondering if the correct solution is for depmod and kmod related
tools to ignore the .debug directory instead of traversing down and
processing those modules? I think the code in
depmod_modules_search_file() should maybe ignore the .debug directory.
I looked at depmod and see that it compares priority and seems to
randomly choose between the 2 if priority is equal as sometimes the
non-debug .ko is selected.
Thoughts? Concerns with a change to ignore the .debug directory in
depmod?
I think this is very specific to the way you're adding debug
information. I'm a bit worried about ignoring a few special directories
inside the modules directory. Maybe all you need is to ship the debug
info to side directory and configure depmod.d to search there (if that
is what you want)?
Adding the .debug directory is a well documented part of binutils / gdb
and the Yocto Project / Openembedded environments use the .debug
subdirectory to store the split debug_info. The splitting is done to
help reduce the size when creating an embedded target system. But we
need those files when working on debugging the target system, so they
are optionally installable.
See man depmod.d. This would probably what you'd need for a side
"debug/" directory, where you give preference to the debug one:
search debug built-in
This is kind of opposite of what I think is needed. I don't want to
search the split .debug/<mod>.ko files as they are just needed for
debugging. The debug_info related <mod>.ko will typically fail to load
due to missing symbol info.
Would that work for you?
Honestly, not really as the Yocto Project / OpenEmbedded uses the .debug
directory to deliver the split debug_info in the standard way as defined
by binutils/gdb and other tools.
I think an ignore vs search directive might be better.
Hope this helps to clarify the reasoning.
Sau!
Please consider Cc'ing linux-modules@xxxxxxxxxxxxxxx to get additional
feeback from other distros/people.
Lucas De Marchi
Thanks for your time.
--
Sau!
--
Sau!