[llvm-dev] xray && shared library support

Billie Alsup (balsup) via llvm-dev llvm-dev at lists.llvm.org
Wed Jul 7 11:11:30 PDT 2021


Not the answer I was hoping for, but thanks for the information!

From: David Blaikie <dblaikie at gmail.com>
Date: Friday, July 2, 2021 at 2:42 PM
To: Billie Alsup (balsup) <balsup at cisco.com>
Cc: llvm-dev at lists.llvm.org <llvm-dev at lists.llvm.org>
Subject: Re: [llvm-dev] xray && shared library support
Last I was aware xray's basically unmaintained - so probably the "current status" is whatever's checked in and not much more than that.

On Thu, Jul 1, 2021 at 11:48 AM Billie Alsup (balsup) via llvm-dev <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>> wrote:
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?


_______________________________________________
LLVM Developers mailing list
llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210707/24ecbb2b/attachment.html>


More information about the llvm-dev mailing list