I'd tried a number of different solutions, but none seemed to work. Don had suggested compiling it under Linux with PGO enabled and then using the .gcda files produced when recompiling it with MingW. But that never worked for me, (even though I meticulously ensured that both versions of g++ were identical). It kept complaining about the profiling data being incorrect. Finally, I've hit on a solution that works and produces an executable every bit as fast as what I'm getting out of Windows.
1. I installed the Windows version of MingW 4.8.1 under Wine in Linux, (this worked without a hitch).
2. I then modified my make file command to the following:
Code: Select all
MINGW_CC64_WIN = "/home/tlikens/.wine/drive_c/Program Files/mingw-builds/x64-4.8.1-posix-seh-rev2/mingw64/bin/x86_64-w64-mingw32-g++.exe"
##--------------------------------------------------------------------------##
## GCC 64-bit profile-gathering version targeted for 64-bit Window,
## using the MingW compiler.
##--------------------------------------------------------------------------##
win64-profile: CC = $(MINGW_CC64_WIN)
win64-profile: OPT = -DX86_64 -DFAST -m64 -Ofast -fno-rtti -fno-exceptions
win64-profile: OPT := $(OPT) -fomit-frame-pointer -march=k8 -mtune=generic
win64-profile: OPT := $(OPT) -static -DUSE_POPCNT
win64-profile: OPT := $(OPT) -fprofile-generate=profile
win64-profile: DBG = -Wall -W -Wno-sign-compare
win64-profile: LFLAGS = -fprofile-generate=profile -static
win64-profile: $(OBJS)
$(LINKER) $(LFLAGS) -o $(NAME) $(OBJS)
##--------------------------------------------------------------------------##
## GCC 64-bit profile-gathering version targeted for 64-bit Windows machines
##--------------------------------------------------------------------------##
win64-use: CC = $(MINGW_CC64_WIN)
win64-use: OPT = -DX86_64 -DFAST -m64 -Ofast -fno-rtti -fno-exceptions
win64-use: OPT := $(OPT) -fomit-frame-pointer -march=k8 -mtune=generic
win64-use: OPT := $(OPT) -static -fprofile-use -DUSE_POPCNT
win64-use: OPT := $(OPT) -fprofile-dir=profile
win64-use: DBG = -Wall -W -Wno-sign-compare
win64-use: LFLAGS = -fprofile-use=profile -static
win64-use: $(OBJS)
$(LINKER) $(LFLAGS) -o $(NAME).exe $(OBJS)
Also, it's important to realize that this runs under wine, so you'll need a working 64-bit installation of wine. Once I tried this though it all seems to work. Gcc finds the .gcda files and correctly applies them.
The beauty of all this now is that I *never* have to boot into Windows!
regards,
--tom