build: use gold linker and enable linker optimizations
On Linux, gold is more than 2x faster than traditional bfd-based ld
Change-Id: I8b1c3275b542d60e976bad05dac522ca49e921cb
diff --git a/.waf-tools/default-compiler-flags.py b/.waf-tools/default-compiler-flags.py
index 538553a..850b09f 100644
--- a/.waf-tools/default-compiler-flags.py
+++ b/.waf-tools/default-compiler-flags.py
@@ -4,7 +4,7 @@
def options(opt):
opt.add_option('--debug', '--with-debug', action='store_true', default=False, dest='debug',
- help='''Compile in debugging mode without optimizations (-O0 or -Og)''')
+ help='''Compile in debugging mode with minimal optimizations (-O0 or -Og)''')
def configure(conf):
cxx = conf.env['CXX_NAME'] # CXX_NAME represents generic name of the compiler
@@ -112,6 +112,7 @@
'-Wno-error=maybe-uninitialized', # Bug #1615
'-Wno-error=deprecated-declarations', # Bug #3795
]
+ flags['LINKFLAGS'] += ['-fuse-ld=gold', '-Wl,-O1']
return flags
def getOptimizedFlags(self, conf):
@@ -124,6 +125,7 @@
'-Wnon-virtual-dtor',
'-Wno-unused-parameter',
]
+ flags['LINKFLAGS'] += ['-fuse-ld=gold', '-Wl,-O1']
return flags
class GccFlags(GccBasicFlags):