* We need to ensure we remodify LD_LIBRARY_PATH and LD_PRELOAD before fork/exec
if the application (say bash running a script) has overwritten them. We also
don't want these to be accidentally inherited into children if we're not
hooking children - the same for the vulkan env var, which can't be unset
immediately on process injection like the others because it needs to hang
around indefinitely.
* Some distribution packages (Ubuntu at least I think) point the nvidia
vulkan ICD registration at libGL.so. Since for libGL hooking we have
to redirect dlopen("libGL.so") to ourselves, this means the vulkan
loader loads librenderdoc instead of libGL. If we don't export the VK
ICD entry points, it will fail to load that ICD.
* This solution isn't perfect - we export all three main ICD entry
points. If the real ICD doesn't export one, we will fail and cause
problems, since the loader won't fall back to older paths unless the
symbol is completely missing. For now though this is fine since the
nvidia ICD exports all three.
* The only way to solve that properly would be to intercept all calls to
dlsym and redirect these functions by name to go to the real handle
instead of ourselves - vastly overcomplicated for this edge case.
* When statically linking libstdc++ by default the symbols are all
default visibility. This causes a problem if you statically link an
old libstdc++ then inject librenderdoc.so, and the application starts
using the old libstdc++ instead of the system's.
* Really we only want to use the static one for calls from
librenderdoc.so. In theory -Wl,--exclude-libs,libstdc++ should do this
for us, but it starts to cause bizarre crashes.
* Instead, we have to resort to a manual linker script which whitelists
which symbols should be visible. Normally we can do this just for our
own symbols with -fvisibility=hidden and __attribute__((visibility))
but that doesn't work for linked symbols apparently.