Pablo Galindo Salgado
Pablo Galindo Salgado
> Ah, interesting. So it must appear in `nm --dynamic` otherwise memray wouldn't find it? That is a sufficient condition but not necessary. The other option is that it should...
> Hmm. How would you do that using gcc or clang? Is there a function attribute (preferably) or perhaps compiler/linker flag? I think you can do it with `__attribute__((visibility("default")))` but...
An alternative view of this problem is that code with `LD_PRELOAD` should be able to interpose the symbol. We do the same but reimplementing the linker > (also, we use...
It looks like if you statically compile the allocator and use `-fno-semantic-interposition` you are preventing any memory profiler to interpose calls to the allocators. (This also includes LD_PRELOAD based ones...
> however, it's just that I don't know how to do that without affecting other symbols. I think trying to use a `__attribute__((visibility("default")))` or marking the symbol as weak (`__attribute__((weak))`)...
A quick check you can do when trying things out is to load a library with the same definition via `LD_PRELOAD` and check if its interposed or not.
Some interesting info: Apparently the way QT does this is to use `-Bsymbolic-functions` and: ``` --dynamic-list=dynamic-list-file Specify the name of a dynamic list file to the linker. This is typically...
> Also, a radical solution might be to first try `dlsym`ing the symbols, and then fallback on the local symbol. I think that won't work for profilers that attach or...
Maybe you can wrap the allocator in some call that's exported and use that internally and mark that wrapper as `__attribute__((visibility("default")))`. We could override the wrapper.
> I might misunderstanding how relocation works, but do these profilers patch all call sites at runtime? No, they patch the Global Offset Table at runtime. All call sites point...