You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm somewhat undecided if it's actually worthwhile implementing COMDAT support. I don't really see why it's needed. The idea of COMDAT sections seems to be that you can group multiple sections together then keep or discard those sections as a group. The alternative to COMDAT, which is what Wild currently does, is to take advantage of these symbols being weak. Since they're weak, wild will pick the first definition of the symbol and use that. COMDAT seems to be designed to make sure that we don't mix and match, taking some of a related group of functions / data from one object and others from another object. But even with weak symbols, that should never happen, since we'll pick all of the related weak symbols from the first object that defines them.
Another supposed advantage of COMDAT groups is that the linker discards the duplicate groups, keeping only one. However if you're linking with --gc-sections, then the sections containing duplicate weak symbols will also be discarded, so I'm not sure I buy that as an advantage.
I'd be very interested if someone could show a legitimate use where COMDAT is actually needed. Ideally in a higher level language like C or C++ rather than in assembly and ideally without ODR violations.
The text was updated successfully, but these errors were encountered:
I'm somewhat undecided if it's actually worthwhile implementing COMDAT support. I don't really see why it's needed. The idea of COMDAT sections seems to be that you can group multiple sections together then keep or discard those sections as a group. The alternative to COMDAT, which is what Wild currently does, is to take advantage of these symbols being weak. Since they're weak, wild will pick the first definition of the symbol and use that. COMDAT seems to be designed to make sure that we don't mix and match, taking some of a related group of functions / data from one object and others from another object. But even with weak symbols, that should never happen, since we'll pick all of the related weak symbols from the first object that defines them.
Another supposed advantage of COMDAT groups is that the linker discards the duplicate groups, keeping only one. However if you're linking with
--gc-sections
, then the sections containing duplicate weak symbols will also be discarded, so I'm not sure I buy that as an advantage.I'd be very interested if someone could show a legitimate use where COMDAT is actually needed. Ideally in a higher level language like C or C++ rather than in assembly and ideally without ODR violations.
The text was updated successfully, but these errors were encountered: