mirror of
https://github.com/holub/mame
synced 2025-06-06 21:03:47 +03:00
Allow current toolchain for mingw to work and allow GCC 5.2 to also work if gcc-ar is current enough. Add a little more info about lto (nw)
This commit is contained in:
parent
254c14b3f3
commit
7c302af80f
@ -850,27 +850,32 @@ if _OPTIONS["OPTIMIZE"] then
|
||||
end
|
||||
if _OPTIONS["LTO"]=="1" then
|
||||
buildoptions {
|
||||
"-flto=2",
|
||||
-- these next flags allow MAME to compile in linux GCC 5.2. odr warnings should be fixed as LTO randomly crashes otherwise
|
||||
"-fno-fat-lto-objects", "-Wodr",
|
||||
"-flto-compression-level=9", -- lto didn't work with anything less on linux with < 12G RAM
|
||||
-- windows native mingw GCC 5.2 fails with -flto=x with x > 1. bug unfixed as of this date
|
||||
"-flto=1",
|
||||
"-fuse-linker-plugin",
|
||||
-- these next flags allow MAME to compile in GCC 5.2. odr warnings should be fixed as LTO randomly crashes otherwise
|
||||
-- some GCC 4.9.x on Windows do not have -Wodr and -flto-odr-type-merging enabled. adjust accordingly...
|
||||
-- -ffat-lto-objects lets you link non-lto version without rebuilding all .o/.a
|
||||
"-ffat-lto-objects",
|
||||
"-flto-odr-type-merging",
|
||||
"-flto-report", -- if you get an error in lto after [WPA] stage, but before [LTRANS] stage, you need more memory!
|
||||
"-fmem-report-wpa","-fmem-report","-fpre-ipa-mem-report","-fpost-ipa-mem-report","-flto-report-wpa","-fmem-report","-fuse-linker-plugin",
|
||||
|
||||
"-Wodr",
|
||||
"-flto-compression-level=9", -- lto didn't work with anything <9 on linux with < 12G RAM
|
||||
-- "-flto-report", -- if you get an error in lto after [WPA] stage, but before [LTRANS] stage, you need more memory!
|
||||
-- "-fmem-report-wpa","-fmem-report","-fpre-ipa-mem-report","-fpost-ipa-mem-report","-flto-report-wpa","-fmem-report",
|
||||
}
|
||||
-- same flags are needed by linker
|
||||
linkoptions {
|
||||
"-flto=2",
|
||||
-- these next flags allow MAME to compile in linux GCC 5.2. odr warnings should be fixed as LTO randomly crashes otherwise
|
||||
"-fno-fat-lto-objects", "-Wodr",
|
||||
"-flto-compression-level=9", -- lto didn't work with anything less on linux with < 12G RAM
|
||||
"-Wl,-no-keep-memory",
|
||||
"-flto=1",
|
||||
"-fuse-linker-plugin",
|
||||
"-ffat-lto-objects",
|
||||
"-flto-odr-type-merging",
|
||||
"-flto-report", -- if you get an error in lto after [WPA] stage printout, but before any [LTRANS] section printout, you need more memory!
|
||||
"-fmem-report-wpa","-fmem-report","-fpre-ipa-mem-report","-fpost-ipa-mem-report","-flto-report-wpa","-fmem-report","-fuse-linker-plugin",
|
||||
"-Wodr",
|
||||
"-flto-compression-level=9", -- lto didn't work with anything < 9 on linux with < 12G RAM
|
||||
-- "-flto-report", -- if you get an error in lto after [WPA] stage, but before [LTRANS] stage, you need more memory!
|
||||
-- "-fmem-report-wpa","-fmem-report","-fpre-ipa-mem-report","-fpost-ipa-mem-report","-flto-report-wpa","-fmem-report",
|
||||
}
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@ -1000,11 +1005,11 @@ end
|
||||
"-Wno-extern-c-compat",
|
||||
}
|
||||
end
|
||||
if (version >= 70000) then
|
||||
buildoptions {
|
||||
"-Wno-tautological-undefined-compare",
|
||||
}
|
||||
end
|
||||
if (version >= 70000) then
|
||||
buildoptions {
|
||||
"-Wno-tautological-undefined-compare",
|
||||
}
|
||||
end
|
||||
else
|
||||
if (version == 40201) then
|
||||
buildoptions {
|
||||
@ -1041,13 +1046,12 @@ end
|
||||
-- next two should work, but compiler complains about end conditions that are int when loop variable is unsigned. maybe these can be fixed
|
||||
-- "-funsafe-loop-optimizations",
|
||||
-- "-Wunsafe-loop-optimizations",
|
||||
-- this six flag combo lets MAME compile with LTO=1 on linux with no errors (whew!--Cowering) someone should probably pretty this up as you can't really debug with them enabled
|
||||
"-fdevirtualize-at-ltrans","-fgcse-sm","-fgcse-las",
|
||||
"-fipa-pta","-fipa-icf","-fvariable-expansion-in-unroller",
|
||||
-- this six flag combo lets MAME compile with LTO=1 on linux with no errors and ~2% speed boost, but compile time is much longer
|
||||
-- "-fdevirtualize-at-ltrans","-fgcse-sm","-fgcse-las",
|
||||
-- "-fipa-pta","-fipa-icf","-fvariable-expansion-in-unroller",
|
||||
|
||||
}
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
--ifeq ($(findstring arm,$(UNAME)),arm)
|
||||
|
@ -195,9 +195,14 @@ function toolchain(_buildDir, _subDir)
|
||||
end
|
||||
premake.gcc.cc = "$(MINGW32)/bin/i686-w64-mingw32-gcc"
|
||||
premake.gcc.cxx = "$(MINGW32)/bin/i686-w64-mingw32-g++"
|
||||
premake.gcc.ar = "$(MINGW32)/bin/ar"
|
||||
-- lto docs say to use gcc-ar so that plugin is completely setup, but this doesn't work in windows with the current build tools' copy of gcc-ar.exe
|
||||
-- premake.gcc.ar = "$(MINGW32)/bin/gcc-ar"
|
||||
-- work around GCC 4.9.2 not having proper linker for LTO=1 usage
|
||||
local version_4_ar = str_to_version(_OPTIONS["gcc_version"])
|
||||
if (version_4_ar < 50000) then
|
||||
premake.gcc.ar = "$(MINGW32)/bin/i686-w64-mingw32-ar"
|
||||
end
|
||||
if (version_4_ar >= 50000) then
|
||||
premake.gcc.ar = "$(MINGW32)/bin/i686-w64-mingw32-gcc-ar"
|
||||
end
|
||||
location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-mingw32-gcc")
|
||||
end
|
||||
|
||||
@ -207,9 +212,14 @@ function toolchain(_buildDir, _subDir)
|
||||
end
|
||||
premake.gcc.cc = "$(MINGW64)/bin/x86_64-w64-mingw32-gcc"
|
||||
premake.gcc.cxx = "$(MINGW64)/bin/x86_64-w64-mingw32-g++"
|
||||
premake.gcc.ar = "$(MINGW64)/bin/ar"
|
||||
-- lto docs say to use gcc-ar so that plugin is completely setup, but this doesn't work in windows with the current build tools' copy of gcc-ar.exe
|
||||
-- premake.gcc.ar = "$(MINGW64)/bin/gcc-ar"
|
||||
-- work around GCC 4.9.2 not having proper linker for LTO=1 usage
|
||||
local version_4_ar = str_to_version(_OPTIONS["gcc_version"])
|
||||
if (version_4_ar < 50000) then
|
||||
premake.gcc.ar = "$(MINGW64)/bin/x86_64-w64-mingw32-ar"
|
||||
end
|
||||
if (version_4_ar >= 50000) then
|
||||
premake.gcc.ar = "$(MINGW64)/bin/x86_64-w64-mingw32-gcc-ar"
|
||||
end
|
||||
location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-mingw64-gcc")
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user