Don't strip by default, allow custom flags in make.sh, fix some win64 warnings

This commit is contained in:
Alcaro
2020-02-08 11:28:01 +01:00
parent 7d59bcec42
commit cc44e5da9c
4 changed files with 18 additions and 14 deletions

View File

@@ -11,6 +11,7 @@ FNAME_windows := flips.exe
FNAME_cli := flips
CXX ?= g++
CFLAGS ?= -g
XFILES :=
@@ -98,4 +99,4 @@ ifeq ($(TARGET),gtk)
endif
$(FNAME_$(TARGET)): $(SOURCES) $(XFILES)
$(CXX) $^ -std=c++98 $(CFLAGS_G) $(MOREFLAGS) $(OPTFLAGS) $(CPPFLAGS) $(CFLAGS) $(CXXFLAGS) $(LFLAGS) -o$@
$(CXX) $^ -std=c++98 $(CFLAGS_G) $(MOREFLAGS) $(CPPFLAGS) $(CFLAGS) $(CXXFLAGS) $(LFLAGS) -o$@

View File

@@ -803,10 +803,14 @@ struct errorinfo ApplyPatchMem2(file* patch, struct mem inrom, bool verifyinput,
//http://msdn.microsoft.com/en-us/library/vstudio/tcxf1dw6.aspx says %zX is not supported
//this is true up to and including Windows Vista; 7 adds support for it
//I could define it to "I", but my GCC does not acknowledge its legitimacy and throws bogus warnings
//instead, let's just define it to size_t's underlying type: unsigned int / long long unsigned int
//nor does my GCC accept any supported alternative, so let's just nuke the entire warning.
//it's a poor solution, but it's the best I can find
#ifdef _WIN32
# ifdef _WIN64
# define z "ll"
# ifdef __GNUC__
# pragma GCC diagnostic ignored "-Wformat"
# endif
# define z "I64"
# else
# define z ""
# endif

View File

@@ -27,13 +27,13 @@ mingwver 64 || true # this is a script that sets the Wine PATH
#FLAGS=$FLAGS' Z:/home/alcaro/tools/mingw64-8.1.0/x86_64-w64-mingw32/lib/libwinpthread.a'
echo 'Windows (1/3)'
rm obj/* flips.exe; wine mingw32-make TARGET=windows OPTFLAGS="$FLAGS -fprofile-generate -lgcov"
rm obj/* flips.exe; wine mingw32-make TARGET=windows CFLAGS="$FLAGS -fprofile-generate -lgcov"
[ -e flips.exe ] || exit
echo 'Windows (2/3)'
/usr/bin/time --verbose wine flips.exe --create --bps-delta profile/firefox-10.0esr.tar profile/firefox-17.0esr.tar /dev/null
/usr/bin/time --verbose wine flips.exe --create --bps-delta-moremem profile/firefox-10.0esr.tar profile/firefox-17.0esr.tar /dev/null
echo 'Windows (3/3)'
rm flips.exe; wine mingw32-make TARGET=windows OPTFLAGS="$FLAGS -fprofile-use"
rm flips.exe; wine mingw32-make TARGET=windows CFLAGS="$FLAGS -fprofile-use -s"
#verify that there are no unexpected dependencies
objdump -p flips.exe | grep 'DLL Name' | \

17
make.sh
View File

@@ -6,11 +6,10 @@ FLAGS='-Wall -Werror -O3 -flto -fuse-linker-plugin -fomit-frame-pointer -fmerge-
FLAGS=$FLAGS' -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables'
FLAGS=$FLAGS' -ffunction-sections -fdata-sections -Wl,--gc-sections -fprofile-dir=obj/'
#Linux flags, they don't make sense on Windows
#make-release.sh uses this
#make-maintainer.sh uses this
LINFLAGS=' -Wl,-z,relro,-z,now,--as-needed,--hash-style=gnu,--relax'
PROFILE=yes
STRIP="-s"
for i in "$@"; do
case "$i" in
@@ -24,14 +23,14 @@ case "$i" in
# Without PGO, it takes 2.5 seconds and 75MB RAM. However, the resulting binary is about 2% slower.
PROFILE=no
;;
--strip=no)
STRIP="-g"
--cflags=*|--lflags=*)
FLAGS=$FLAGS" ${i#*=}"
;;
--harden=no|--strip=yes|--profile=yes)
--harden=no|--profile=yes)
;;
*)
echo "Unknown argument $1; valid arguments are:"
echo "--harden=no --harden=yes --profile=no --profile=no-once --profile=yes"
echo "--harden=yes --profile=no --cflags=(...) --lflags=(...)"
exit 1
;;
esac
@@ -40,7 +39,7 @@ done
if [ $PROFILE = yes ]; then
echo 'GTK+ (1/3)'
rm obj/* flips; TARGET=gtk make OPTFLAGS="$FLAGS$LINFLAGS -fprofile-generate -lgcov" || exit $?
rm obj/* flips; TARGET=gtk make CFLAGS="$FLAGS$LINFLAGS -fprofile-generate -lgcov" || exit $?
[ -e flips ] || exit 1
echo 'GTK+ (2/3)'
@@ -51,7 +50,7 @@ echo 'GTK+ (2/3)'
/usr/bin/time --verbose ./flips --create --bps-delta-moremem profile/firefox-10.0esr.tar profile/firefox-17.0esr.tar /dev/null
echo 'GTK+ (3/3)'
rm flips; TARGET=gtk make OPTFLAGS="$FLAGS$LINFLAGS -fprofile-use" || exit $?
rm flips; TARGET=gtk make CFLAGS="$FLAGS$LINFLAGS -fprofile-use" || exit $?
else
rm flips; TARGET=gtk make OPTFLAGS="$FLAGS$LINFLAGS" || exit $?
rm flips; TARGET=gtk make CFLAGS="$FLAGS$LINFLAGS" || exit $?
fi