yugr / Implib.so

POSIX equivalent of Windows DLL import libraries
MIT License
229 stars 33 forks source link

Hide the generated symbols #33

Closed ilya-fedin closed 1 year ago

ilya-fedin commented 1 year ago

Is there a way to hide the generated symbols? I have the following situation:

  1. The binary is built with -rdynamic due to breakpad's requirement
  2. There are generated implib stubs for libva.so.1 as the application is built on CentOS 7
  3. User system's libvdpau loads system's libvdpau_va_gl which is linked with system's libva.so.2
  4. Dynamic linker starts finding the symbols from the executable binary itself and loads implib stubs that of course try to load libva.so.1 and fail (as apparently new library ABI's symbols have the same name as the library with old ABI had)
ilya-fedin commented 1 year ago

I guess specifying -fvisibility=hidden would just actually revert the effect of -rdynamic for backtraces and there's a custom allocator linked statically which I guess works to that dynamic linker's magic. If implib can add something like __attribute__ ((visibility ("hidden"))) for its generated functions and this works with -rdynamic, I guess it's the best solution. I'm also doubt anyone would like these generated symbols to leak into the symbol table and affect other linked libraries.

ilya-fedin commented 1 year ago

Oops, looks like I was too fast at opening the issue. This was the first possible cause I had in my mind when seeing the traces with libvdpau_va_gl but I see with readelf now that those symbols aren't exported so this couldn't be the cause. Apparently it's a problem with the driver itself..

yugr commented 1 year ago

Sorry for late reply, I was on vacation. Let me know if there are any further issues.