What is a 'linkonce' section, and for extra kudos how does it differ from a comdat section?
To be clear, I'm familiar with how comdat sections work, how they're used, etc. In googling, linkonce is almost exclusively discussed in forums where it's assumed the meaning/intent/purpose of that section is already fairly well understood.
http://gcc.gnu.org/ml/gcc/2003-09/msg00984.html seems to discuss this very thing ...
edit
To summarize:
According to that thread, COMDAT is a bit more nebulous in the sense that there's no single correct/standard definition of what constitutes a true COMDAT implementation. g++'s linkonce is /an/ implementation of the concept.
In the COMDAT implementations used by MSVC++ and Wind River's 'diab' compiler, their implementations of COMDAT allow it to remove unused sections; eg, if main.cpp links against foo.cpp, the main binary can exclude any COMDAT sections from foo.o if the section is not referenced.
I'm uncertain whether this type of folding is applied to the g++ linkonce sections, but it seems logical.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With