On 2019-12-18 14:19 +0100, Jan Hubicka wrote: > The problem here is that we lie to the compiler (by pretending that > foo_v2 is exported from DSO while it is not) and force user to do the > same. > > We support two ways to hide symbol - either at compile time via > attribute((visibility("hidden"))) or at link-time via map file. The > first produces better code because compiler can do more optimizations > knowing that the symbol can not be interposed.
I just get your point: if the library calls foo_v2 it won't be interposed. If it supposes a call to be interposed it should call foo() [foo@@VER_2] instead of foo_v2(). But it seems there is no way we can do this [even with traditional __asm__("symver foo, foo@@VER_2")]. For this purpose we should either: 1. Change GAS (introducing some new syntax like '@@@@' or '.symver_export') or 2. Add some mangled symbol name in GCC (like ".LSYMVERx" or "foo_v2.symver_export"). -- Xi Ruoyao <xry...@mengyan1223.wang> School of Aerospace Science and Technology, Xidian University