LLVM XRay does not log functions in shared libraries

I’m having a difficult time getting XRay to work nicely with shared libraries. Here’s a simple test I set up:

$ cat lib.cpp 
long fib(long n) {
    long a = 0, b = 1, c, i;
    if( n == 0)
        return a;
    for(i = 2; i <= n; i++)
    {
       c = a + b;
       a = b;
       b = c;
    }
    return b;
}
$ cat main.cpp
extern long fib(long);

int main() {
    long accum = 0;
    for (int i = 5000; i < 1000000; i += 1000) {
        accum += fib(i);
    }
    return accum;
}
$ cat Makefile
CXXFLAGS=-O2 -g -fxray-instrument

fib_static: Makefile main.cpp lib.cpp
	clang++ $(CXXFLAGS) main.cpp lib.cpp -o fib_static

fib_shared: Makefile main.cpp lib.cpp
	clang++ $(CXXFLAGS) -shared -o libfib.so lib.cpp
	clang++ $(CXXFLAGS) main.cpp  -Wl,-rpath=\$$ORIGIN -L . -lfib -o fib_shared
$ make fib_shared fib_static
$ XRAY_OPTIONS="patch_premain=true xray_mode=xray-basic" ./fib_static
$ XRAY_OPTIONS="patch_premain=true xray_mode=xray-basic" ./fib_shared
$ llvm-xray convert --symbolize --output-format=trace_event xray-log.fib_shared.6WRTKa --instr_map=./fib_shared > trace_shared.txt
$ llvm-xray convert --symbolize --output-format=trace_event xray-log.fib_static.bD89Mz --instr_map=./fib_static > trace_static.txt

These traces were then loaded in ui.perfetto.dev and the shared version gives this:

And the static version gives:

I more or less assume that it’s a problem with --instr_map not having the full map, but you can only pass that argument once.

At the very least it would be good to get a documentation update mentioning that this is not possible, but of course best would be a guide to get it to work properly.

Thanks for the time!

EDIT: I now see Xray with shared libraries? i see it’s a know limitation. Sorry for the noise–I assume there was no progress made on that front.