http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57375

Sriraman Tallam <tmsriram at google dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |davidxl at google dot com

--- Comment #2 from Sriraman Tallam <tmsriram at google dot com> ---
IMO, This is working as expected.

You define corei7 only in mv12-aux1.cc, so the compilation of mv12.C and
mv12-aux.cc do not see the corei7 version.  The version resolver function that
is generated is a comdat function, and there are 2 copies generated for the 2
source files with a call to foo, mv12.C and mv12-aux1.cc. However, one of the
copies is different, that generated when compiling mv12-aux1.cc because it has
the extra corei7  version.  So, depending on the link order whichever comdat
copy gets kept either calls the corei7 version or not. Usually, the linker
keeps the first comdat copy seen so if you put mv12-aux1.cc ahead of mv12.C,
the corei7 version will be called and the reverse will not call it.

The fix is in the source. Either make every source file see the corei7 version
or hide it from all. 

The linker can be made to complain that the comdats differ if it could be
taught about version resolvers. This may be more involved.

Reply via email to