summaryrefslogtreecommitdiffstats
path: root/make
diff options
context:
space:
mode:
authorNomis101 <[email protected]>2020-01-16 21:20:04 -0500
committerBradley Sepos <[email protected]>2020-01-16 21:31:45 -0500
commit88b4faef0f35efbc1b2948636098f872fe58bbf0 (patch)
tree7a56886ac2a2e66295dbc82aa78cbc99cb0df8dc /make
parent19942009ba94c0b2f56284e56ef531314303dc83 (diff)
build: Add --optimize=size-aggressive (-Oz).
Compiles with -Oz. -Oz is like -Os but further reduces total size even at the expense of speed.
Diffstat (limited to 'make')
-rw-r--r--make/configure.py13
-rw-r--r--make/include/gcc.defs59
2 files changed, 40 insertions, 32 deletions
diff --git a/make/configure.py b/make/configure.py
index d70138be6..095cfc0c7 100644
--- a/make/configure.py
+++ b/make/configure.py
@@ -1617,9 +1617,6 @@ try:
for tool in ToolProbe.tools:
tool.run()
- debugMode = SelectMode( 'debug', ('none','none'), ('min','min'), ('std','std'), ('max','max') )
- optimizeMode = SelectMode( 'optimize', ('none','none'), ('speed','speed'), ('size','size'), default='speed' )
-
## find xcconfig values
xcconfigMode = SelectMode( 'xcconfig', ('none',None), what='' )
if build_tuple.match( '*-*-darwin*' ):
@@ -1639,6 +1636,16 @@ try:
tool.__init__( tool.var, tool.option, '%s-%s' % (cross,tool.name), **tool.kwargs )
tool.run()
+ debugMode = SelectMode( 'debug', ('none','none'), ('min','min'), ('std','std'), ('max','max') )
+
+ Oz_check_command = '%s -Oz -S -o /dev/null -xc /dev/null > /dev/null 2>&1' % Tools.gcc.pathname
+ Oz_check = ShellProbe('checking for -Oz', '%s' % Oz_check_command)
+ Oz_check.run()
+ if Oz_check.fail is False:
+ optimizeMode = SelectMode( 'optimize', ('none','none'), ('speed','speed'), ('size','size'), ('size-aggressive','size-aggressive'), default='speed' )
+ else:
+ optimizeMode = SelectMode( 'optimize', ('none','none'), ('speed','speed'), ('size','size'), default='speed' )
+
# run host tuple and arch actions
host_tuple = HostTupleAction(cross)
arch = ArchAction(); arch.run()
diff --git a/make/include/gcc.defs b/make/include/gcc.defs
index 1f1c7d8dd..a40ef6b22 100644
--- a/make/include/gcc.defs
+++ b/make/include/gcc.defs
@@ -41,37 +41,38 @@ GCC.extra.cpp_o = 1
GCC.extra.dylib++ = 1
GCC.extra.exe++ = 1
-GCC.args.pipe = -pipe
-GCC.args.strip = -Wl,-S
-GCC.args.dylib = -dynamiclib
-GCC.args.ML = -fmessage-length=0
-GCC.args.H = -H
-GCC.args.W = -W$(1)
+GCC.args.pipe = -pipe
+GCC.args.strip = -Wl,-S
+GCC.args.dylib = -dynamiclib
+GCC.args.ML = -fmessage-length=0
+GCC.args.H = -H
+GCC.args.W = -W$(1)
ifeq (darwin,$(HOST.system))
- GCC.args.archs = -arch $(1)
+ GCC.args.archs = -arch $(1)
endif
-GCC.args.sysroot = --sysroot=$(1)
-GCC.args.minver = -mmacosx-version-min=$(1)
-GCC.args.vis = -fvisibility=hidden
-GCC.args.pic = -fPIC
-GCC.args.c_std = -std=gnu99
-GCC.args.cxx_std = -std=c++98
-GCC.args.g.none = -g0
-GCC.args.g.min = -gdwarf-2 -g1
-GCC.args.g.std = -gdwarf-2
-GCC.args.g.max = -gdwarf-2 -g3
-GCC.args.O.none = -O0
-GCC.args.O.size = -Os
-GCC.args.O.speed = -O3
-GCC.args.D = -D$(1)
-GCC.args.I = -I$(1)
-GCC.args.muldefs = -Wl,--allow-multiple-definition
-GCC.args.start = -Wl,--start-group
-GCC.args.F = -F$(1)
-GCC.args.f = -framework $(1)
-GCC.args.L = -L$(1)
-GCC.args.l = -l$(1)
-GCC.args.end = -Wl,--end-group
+GCC.args.sysroot = --sysroot=$(1)
+GCC.args.minver = -mmacosx-version-min=$(1)
+GCC.args.vis = -fvisibility=hidden
+GCC.args.pic = -fPIC
+GCC.args.c_std = -std=gnu99
+GCC.args.cxx_std = -std=c++98
+GCC.args.g.none = -g0
+GCC.args.g.min = -gdwarf-2 -g1
+GCC.args.g.std = -gdwarf-2
+GCC.args.g.max = -gdwarf-2 -g3
+GCC.args.O.none = -O0
+GCC.args.O.size = -Os
+GCC.args.O.size-aggressive = -Oz
+GCC.args.O.speed = -O3
+GCC.args.D = -D$(1)
+GCC.args.I = -I$(1)
+GCC.args.muldefs = -Wl,--allow-multiple-definition
+GCC.args.start = -Wl,--start-group
+GCC.args.F = -F$(1)
+GCC.args.f = -framework $(1)
+GCC.args.L = -L$(1)
+GCC.args.l = -l$(1)
+GCC.args.end = -Wl,--end-group
ifeq ($(HOST.machine),$(filter $(HOST.machine),i686 x86_64))
GCC.args.extra = $(CFLAGS) $(CPPFLAGS) -mfpmath=sse -msse2