Just marking a symbol as weak_odr/linkonce_odr isn't enough for actually tolerating multiple copies of it at linking on windows, it has to be made a proper comdat.
This should hopefully fix https://bugzilla.mozilla.org/show_bug.cgi?id=1566288.
Differential D71572
[ItaniumCXXABI] Make tls wrappers properly comdat mstorsjo on Dec 16 2019, 2:24 PM. Authored by
Details Just marking a symbol as weak_odr/linkonce_odr isn't enough for actually tolerating multiple copies of it at linking on windows, it has to be made a proper comdat. This should hopefully fix https://bugzilla.mozilla.org/show_bug.cgi?id=1566288.
Diff Detail
Event Timeline
Comment Actions Actually, this doesn't seem to be enough for the case at hand (used with -ffunction-sections -fdata-sections), I'll have to continue looking into it tomorrow.
Comment Actions Changed to make it a comdat; unless I'm mistaken, neither linkonce_odr nor weak_odr actually make it possible to link multiple copies of the symbol on windows, unless it's made a comdat. With that in place, the previous change (weak_odr to linkonce_odr) actually isn't needed.
Comment Actions Looks like @rsmith did this here: I see that it was replacing a CHECK for a specific comdat group with no comdat at all. I *think* that's not correct, we should be checking for the trivial comdat group, the one for the wrapper function, not the comdat group of the TLS variable. Let's get input from Richard, though.
Comment Actions Making the tls wrappers comdat on any platform that supports comdat; updated tests accordingly. Comment Actions lgtm This will be a small change in behavior, but nobody on ELF should notice because things with vague linkage there are both ELF-weak and comdat.
|
I would say that this is inaccurate. It greatly affects what the optimizer is allowed to do.
It looks like we forgot to put a comdat on these things, is that not the correct fix?