On Fri, Oct 14, 2022 at 04:02:02PM +0200, Olivier Matz wrote:
> Hi Robin,
> 
> On Thu, Oct 13, 2022 at 03:41:25PM +0200, Robin Jarry wrote:
> > Some environments (buildroot) do not have the ldd utility installed by
> > default. However, ldd is often only a wrapper shell script that actually
> > checks that the arguments are valid ELF files and executes them with
> > the LD_TRACE_LOADED_OBJECTS=1 variable set in the environment.
> > 
> > Since ld.so is the actual ELF interpreter which is loaded first when
> > executing a program, executing any dynamic ELF program/library with that
> > variable set will cause all dependent dynamic libraries to be printed
> > and ld.so will exit before even running main.
> > 
> > Excerpt from ld.so(7) man page:
> > 
> >   LD_TRACE_LOADED_OBJECTS
> >     If set (to any value), causes the program to list its dynamic
> >     dependencies, as if run by ldd(1), instead of running normally.
> > 
> > Change dpdk-pmdinfo.py to actually "execute" the files provided on the
> > command line with LD_TRACE_LOADED_OBJECTS=1 set. Ensure that the files
> > are valid dynamically executable ELF programs to avoid obscure and
> > confusing errors.
> > 
> > Reported-by: Olivier Matz <olivier.m...@6wind.com>
> > Signed-off-by: Robin Jarry <rja...@redhat.com>
> 
> Tested on buildroot without ldd.
> 
> Reviewed-by: Olivier Matz <olivier.m...@6wind.com>

After some more tests, it appears that it only works for an executable
binary, but it does not work for .so PMDs:

# LD_TRACE_LOADED_OBJECTS=1 
/usr/lib/x86_64-linux-gnu/dpdk/pmds-22.0/librte_net_ixgbe.so
Segmentation fault (core dumped)

So it is maybe better to keep the original code using ldd.

Thank you Robin anyway.

Reply via email to