When compiling a cpp program with g ++ -O0, I noticed that my binary does not contain the empty string character (basic_string): _S_empty_rep_storage When I compile the same program with -O2, I notice that the aforementioned character is actually contained inside the binary as follows ( using nm in the hopper):
00000000006029a0 V _ZNSs4_Rep20_S_empty_rep_storageE @@ GLIBCXX_3.4
My application uses several .so (dynamic libraries), and when my applications load, I notice that some of these .so files are linked as follows (I set LD_DEBUG = all and run my program):
28596: binding file /home/bbazso/usr/local/lib/mydynamiclib.so [0] to /usr/lib64/libstdc++.so.6 [0]: normal symbol `_ZNSs4_Rep20_S_empty_rep_storageE' [GLIBCXX_3.4]
28596: binding file /home/bbazso/usr/local/lib/mydynamiclib.so [0] to /home/bbazso/workspace/mytestapplication [0]: normal symbol `_ZNSs4_Rep20_S_empty_rep_storageE' [GLIBCXX_3.4]
28596: binding file /home/bbazso/workspace/mytestapplication [0] to /usr/lib64/libstdc++.so.6 [0]: normal symbol `_ZNSs4_Rep20_S_empty_rep_storageE' [GLIBCXX_3.4]**
But I also noticed that one of my .so links only as follows:
28087: binding file /home/bbazso/usr/local/lib/anotherdynamiclib.so [0] to /usr/lib64/libstdc++.so.6 [0]: normal symbol `_ZNSs4_Rep20_S_empty_rep_storageE' [GLIBCXX_3.4]
but it never binds to binary (mytestapplication) as shown above for mydynamiclib.so.
So, I was wondering what that really means? Does this mean that anotherdynamiclib.so will use a different character for the empty string higher than the rest of the application? I suppose I'm really asking how character binding works in the context of the above example?
Thank!
source
share