summaryrefslogtreecommitdiff
path: root/platform/x11
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2019-03-18 14:37:25 +0100
committerHugo Locurcio <hugo.locurcio@hugo.pro>2019-03-18 16:52:00 +0100
commitfd7f253649acc3cca498951f71533f012cef1b9e (patch)
tree8bbed7a8cf1e453307852ca91cd6761bbbb2f561 /platform/x11
parentdf7d3708c5b535c3696943322a14ec19a175e30c (diff)
Add support for linking using LLD on X11
LLD is often faster than GNU ld and gold, resulting in a better development experience. This closes #15364.
Diffstat (limited to 'platform/x11')
-rw-r--r--platform/x11/detect.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index b5ad59e60a..1b39cdca38 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -58,11 +58,12 @@ def get_opts():
return [
BoolVariable('use_llvm', 'Use the LLVM compiler', False),
+ BoolVariable('use_lld', 'Use the LLD linker', False),
BoolVariable('use_static_cpp', 'Link libgcc and libstdc++ statically for better portability', False),
BoolVariable('use_ubsan', 'Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)', False),
BoolVariable('use_asan', 'Use LLVM/GCC compiler address sanitizer (ASAN))', False),
BoolVariable('use_lsan', 'Use LLVM/GCC compiler leak sanitizer (LSAN))', False),
- BoolVariable('pulseaudio', 'Detect & use pulseaudio', True),
+ BoolVariable('pulseaudio', 'Detect and use PulseAudio', True),
BoolVariable('udev', 'Use udev for gamepad connection callbacks', False),
EnumVariable('debug_symbols', 'Add debugging symbols to release builds', 'yes', ('yes', 'no', 'full')),
BoolVariable('separate_debug_symbols', 'Create a separate file containing debugging symbols', False),
@@ -130,6 +131,12 @@ def configure(env):
env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
env.extra_suffix = ".llvm" + env.extra_suffix
+ if env['use_lld']:
+ if env['use_llvm']:
+ env.Append(LINKFLAGS=['-fuse-ld=lld'])
+ else:
+ print("Using LLD with GCC is not supported yet, try compiling with 'use_llvm=yes'.")
+ sys.exit(255)
if env['use_ubsan'] or env['use_asan'] or env['use_lsan']:
env.extra_suffix += "s"
@@ -148,6 +155,7 @@ def configure(env):
if env['use_lto']:
env.Append(CCFLAGS=['-flto'])
+
if not env['use_llvm'] and env.GetOption("num_jobs") > 1:
env.Append(LINKFLAGS=['-flto=' + str(env.GetOption("num_jobs"))])
else: