6.1 Intercepting without using LD_PRELOAD

Sometimes it might not be possible to use LD_PRELOAD, for example if LD_PRELOAD is already being used for another purpose.

In such cases, you must define both LD_LIBRARY_PATH and MGD_LIBRARY_PATH as follows:

LD_LIBRARY_PATH=/path/to/intercept/dir/:$LD_LIBRARY_PATH
MGD_LIBRARY_PATH=/path/to/original/drivers/dir/

In this example, /path/to/intercept/dir/ is the directory on the target where the installation files were copied to. This directory must contain libinterceptor.so, and include symlinks to libinterceptor.so named libEGL.so, libGLESv2.so, and libGLESv1_CM.so.

You can set up the required symlinks for libinterceptor.so as follows:

ln -s /path/to/intercept/libinterceptor.so /path/to/intercept/libEGL.so
ln -s /path/to/intercept/libinterceptor.so /path/to/intercept/libGLESv1_CM.so
ln -s /path/to/intercept/libinterceptor.so /path/to/intercept/libGLESv2.so
ln -s /path/to/intercept/libinterceptor.so /path/to/intercept/libOpenCL.so

The directory /path/to/original/drivers/dir/ should contain the pre-existing libGLESv2.so and libEGL.so files from the graphics driver installation.

LD_PRELOAD does not need to be defined when using this method.

When a graphics application runs, the Graphics Analyzer interceptor libraries are loaded from the LD_LIBRARY_PATH first. These interceptor libraries dynamically load the original graphics libraries from the MGD_LIBRARY_PATH location, as required.

Important:

You might find that the original Mali™ drivers pointed to by MGD_LIBRARY_PATH are small shim libraries that do not export any entry points, but instead depend on libmali.so. If so, the interceptor fails to correctly load the driver libraries unless MGD_LIBRARY_PATH also contains libmali.so. If this is not the case, you can either point MGD_LIBRARY_PATH to the location of libmali.so, regardless of whether that location also contains the libEGL or libGLES libraries, or you can point MGD_LIBRARY_PATH to a location that contains symlinks to libmali.so instead.
Non-Confidential - RELPDF file icon PDF version101545__00_en
Copyright © 2020–2022, 2024 Arm Limited or its affiliates. All rights reserved.