http://bugs.winehq.org/show_bug.cgi?id=28275
Summary: -Wall and -fno-strict-aliasing not applied to .cross.o files Product: Wine Version: 1.3.27 Platform: x86 OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: build-env AssignedTo: wine-bugs@winehq.org ReportedBy: dank@kegel.com
If you force -Wall -Werror into CFLAGS (not EXTRACFLAGS), you observe build errors like
i586-mingw32msvc-gcc -c -I. -I. -I../../include -I../../include -D__WINESRC__ -DWINE_CROSSTEST -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 -o dllfunc.cross.o dllfunc.c cc1: warnings being treated as errors dllfunc.c: In function ‘AMovieDllRegisterServer2’: dllfunc.c:180: warning: dereferencing type-punned pointer will break strict-aliasing rules
There is some chance that -O2 on the files with those warnings will generate bad code without -fno-strict-aliasing. (See e.g. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42907 for an explanation.)
In Make.rules.in, the .c.cross.o rule wants $(EXTRACFLAGS), but lacks it because some of the options in it are not safe for the cross-compiler, because WINE_TRY_CFLAGS in aclocal.m4 only tests the main compiler. So cross-compiled source doesn't get compiled with -fno-strict-aliasing (and in maintainer mode, they don't get compiled with -Wall or -Werror).
A plausible fix would be to extend WINE_TRY_CFLAGS to also try with the cross-compiler, append the options that work there to a new variable CROSS_EXTRACFLAGS, and use that in the .c.cross.o rule.