ELF .so compatibility
I have a question regarding a compatibility issue when modification is made to the code in a .so library.
I have set up some simple sample code. In my library libtest.so, I have a class A with a virtual method foo(). In my executable a.out main(), I have an instance of A as a stack object. main() calls a.foo().
Despite foo() is virtual, since the instance of A was declared as a stack object, the compiler was able to figure out it is A::foo() that main() is calling without having to go through the vtable. This explains the entry of _ZN1A4fooEv in the .dynsym table of a.out when I used readelf on a.out.
Everything makes sense so far. However, what bothers me was the "Size" information on the .dynsym entry for A::foo(). Whenever I change the implementation of A::foo(), the size of _ZN1A4fooEv in the .dynsym table changes in a.out after re-linking. How is this size information used by the dynamic linker? If I create a version of the library as libtest.so.1.1 and link a.out with it, then I changed the implementation of A::foo() and create libtest.so.1.2. Without re-linking a.out, will a.out be compatible with libtest.so.1.2?
Thanks.
|