When annotating a symbol with declspec(selectany), Clang assigns it comdat 2 while GCC assigns it comdat 3. This patch enables two object files that contain a declspec(selectany) symbol, one created by gcc and the other by clang, to be linked together instead of issuing a duplicate symbol error.
Would need someone to commit this for me if accepted.
Does ld.bfd implement the same size check? If so, it might be more conservative to use IMAGE_COMDAT_SELECT_SAME_SIZE for the leader.
I see that GCC only allows this attribute to apply to data, not code, so "same size" makes sense, even if it ignores that "selectany" really means IMAGE_COMDAT_SELECT_ANY. :)