Preloading a library from /etc/ to a snap application

On a linux system (ubuntu 20), there is a shared library that must be preloaded for each program when the program starts. The path to this library is written in /etc/ The library itself (named is located in the /usr/lib/libsToPreload/ directory.

I noticed that when any applications installed via snap are launched, errors from the dynamic linker are printed, stating that /usr/lib/libsToPreload/ cannot be preloaded (for example for pycharm-community snap):

ibse@ibse-desktop:~$ sudo snap install pycharm-community --classic
pycharm-community 2022.3.1 from jetbrains✓ installed
ibse@ibse-desktop:~$ pycharm-community
ERROR: object '/usr/lib/libsToPreload/' from /etc/ cannot be preloaded        (failed to map segment from shared object): ignored.

As I managed to understand reading the snap documentation, this is because the file /usr/lib/libsToPreload/ is not visible from the sandbox where the application is launched. But what is unclear is why then the /etc/ file is visible from the sandbox. It turns out that the linker sees the contents of /etc/, tries to load it, but does not see /usr/lib/libsToPreload/ and prints errors. It turns out that one part of the files (the one where /etc/ from the host file system is shared with the sandbox, and the other (the one where /usr/lib/libsToPreload/ is not? If so, can I as a user manage this? For example, to make /etc/ not visible from the sandbox, as well as /usr/lib/libsToPreload/ so that the linker would not try to preload anything.

The error is not critical and pycharm is successfully launched without the library written to /etc/, but it is necessary that these errors are not printed every time a snap application is launched. If I see the problem correctly, I need to ensure that either both files /etc/ and /usr/lib/libsToPreload/ are visible from the sandbox or both are invisible. Not so that one file is visible, and the second is not

Maybe I’m missing something obvious, but could you explain a bit more about What is the exact usecase where you encounter this? Typically there is no preloading needed for most programs.