I’ve come across an email thread from 2018 regarding xray support for shared libraries. Is there a current status on this effort?
If this is not in active development, has there been any analysis on the effort required to add such support?
I have experimented with clang-12 and see that shared library functions are still not patched automatically via patch_premain.
I have not yet looked at any APIs that might allow me to pass in a shared-library-specific table of addresses to patch.
Similarly, it is unclear how function ids should be adjusted (if necessary) to be globally unique across shared objects.
I’m not even sure what kind of APIs would be needed.
Should patch/unpatch be global in nature, or should we be able to target a specific shared library (or set of shared libraries)?
I do see an API to patch/unpatch an individual function, but it is unclear if that would actually work against a function in a shared library due to the single XrayInstrMap involved.
Should APIs take such a map as a parameter? Should a new dynamic XrayInstrMap be computed with all preloaded shared libraries?
How should dlopen’d libraries be handled?
I also note that even with -fxray-instrument, the shared library does not automatically get the xray support functions from compiler-rt.
That has implications for dlopen’d libraries without an xray-enabled primary elf object.
For example, trying to get statistics from an xray-instrumented shared library loaded from python.
I’m guessing this is just the tip of the iceberg, and am hoping there is already a design, or perhaps some discussion about the issues involved with supporting shared libraries.
Ideally, someone would come back and say it is already being worked, and will be available in release X !
Where might I find information related to this topic?
https://llvm.org/docs/XRay.html mentions a number of ongoing efforts for expanding the toolset, but doesn’t link to them.
https://llvm.org/docs/XRayExample.html has some Next Steps, but doesn’t mention shared libraries.
Is there another wiki that goes into more detail?