crt: Fix the initialization of the _commode variable

In pre_c_init, there's a statement intending to set the value of the
_commode variable in the CRT to the value of the _commode variable
defined in the local module (with a default fallback in libmingw32.a),
like this:

  * __MINGW_IMP_SYMBOL(_commode) = _commode;

However, due to the earlier _commode define,
  #define _commode (* __MINGW_IMP_SYMBOL(_commode))
the assignment statement evaluates to a no-op assigment. Fix this
by removing the define (and the duplicate declaration of
__MINGW_IMP_SYMBOL(_commode).)

Normally that whole assignment is optimized out altogether - but if
crtexe.c is built without optimization, the accesses to __imp__commode
are left intact.

This restores the intent of the code, initializing the CRT's _commode
variable, just like _fmode is initailized.

Signed-off-by: Martin Storsjö <martin@martin.st>
1 file changed