diff options
author | Billy Donahue <billy.donahue@mongodb.com> | 2020-02-05 22:43:22 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-02-14 16:58:34 +0000 |
commit | c1e1c591e67a6be9ef1128de5c45229e91d94bd9 (patch) | |
tree | ab78eba5d8c1400af5663185f180b6f4cc58ffc7 /SConstruct | |
parent | 1c69f63fe4597062055041a4f1b4e54d11dea34e (diff) | |
download | mongo-c1e1c591e67a6be9ef1128de5c45229e91d94bd9.tar.gz |
SERVER-45677 libunwind on by default where possible
- tcmalloc to not use libunwind API, as it uses slow cursor steps.
- Remove UNW_LOCAL_ONLY from CXXFLAGS everywhere.
Diffstat (limited to 'SConstruct')
-rw-r--r-- | SConstruct | 49 |
1 files changed, 35 insertions, 14 deletions
diff --git a/SConstruct b/SConstruct index 6d00e2799a5..9a81312bb33 100644 --- a/SConstruct +++ b/SConstruct @@ -503,10 +503,10 @@ add_option('msvc-debugging-format', ) add_option('use-libunwind', - choices=["on", "off"], + choices=["on", "off", "auto"], const="on", - default="off", - help="Enable libunwind for backtraces (experimental)", + default="auto", + help="Enable libunwind for backtraces", nargs="?", type='choice', ) @@ -1021,17 +1021,6 @@ usemozjs = (jsEngine.startswith('mozjs')) if not serverJs and not usemozjs: print("Warning: --server-js=off is not needed with --js-engine=none") -use_libunwind = get_option("use-libunwind") == "on" -if use_libunwind: - use_system_libunwind = use_system_version_of_library("libunwind") - use_vendored_libunwind = not use_system_libunwind -else: - if use_system_version_of_library("libunwind"): - print("Error: --use-system-libunwind requires --use-libunwind") - Exit(1) - - use_system_libunwind = use_vendored_libunwind = False - # We defer building the env until we have determined whether we want certain values. Some values # in the env actually have semantics for 'None' that differ from being absent, so it is better # to build it up via a dict, and then construct the Environment in one shot with kwargs. @@ -1383,6 +1372,38 @@ link_model = get_option('link-model') if link_model == "auto": link_model = "static" +# libunwind configuration. +# In which the following globals are set and normalized to bool: +# - use_libunwind +# - use_system_libunwind +# - use_vendored_libunwind +use_libunwind = get_option("use-libunwind") +use_system_libunwind = use_system_version_of_library("libunwind") + +# Assume system libunwind works if it's installed and selected. +# Vendored libunwind, however, works only on linux-x86_64. +can_use_libunwind = (use_system_libunwind or + env.TargetOSIs('linux') and env['TARGET_ARCH'] == 'x86_64') + +if use_libunwind == "off": + use_libunwind = False + use_system_libunwind = False +elif use_libunwind == "on": + use_libunwind = True + if not can_use_libunwind: + env.ConfError("libunwind not supported on target platform") + Exit(1) +elif use_libunwind == "auto": + use_libunwind = can_use_libunwind + +use_vendored_libunwind = use_libunwind and not use_system_libunwind +if use_system_libunwind and not use_libunwind: + print("Error: --use-system-libunwind requires --use-libunwind") + Exit(1) +if use_libunwind == True: + env.SetConfigHeaderDefine("MONGO_CONFIG_USE_LIBUNWIND") + + # Windows can't currently support anything other than 'object' or 'static', until # we have both hygienic builds and have annotated functions for export. if env.TargetOSIs('windows') and link_model not in ['object', 'static', 'dynamic-sdk']: |