diff options
Diffstat (limited to 'src/third_party')
-rw-r--r-- | src/third_party/SConscript | 124 | ||||
-rw-r--r-- | src/third_party/gperftools/SConscript | 9 | ||||
-rw-r--r-- | src/third_party/unwind/SConscript | 10 |
3 files changed, 37 insertions, 106 deletions
diff --git a/src/third_party/SConscript b/src/third_party/SConscript index 0c2674ff356..fbd884fbf1e 100644 --- a/src/third_party/SConscript +++ b/src/third_party/SConscript @@ -1,12 +1,8 @@ # -*- mode: python -*- -import SCons - -from site_scons.mongo import insort_wrapper import json Import("env use_system_version_of_library usemozjs get_option") -Import("get_option") Import("use_libunwind") Import("use_system_libunwind") Import("use_vendored_libunwind") @@ -85,59 +81,6 @@ def injectMozJS(thisEnv): env.AddMethod(injectMozJS, 'InjectMozJS'); -def add_shim_allocator_hack(target, source, env): - - # If we allowed conftests to become dependent, any TryLink - # that happened after we made the below modifications would - # cause the configure steps to try to compile tcmalloc and any - # of its dependencies. Oops! - if any('conftest' in str(t) for t in target): - return target, source - - # It is possible that 'env' isn't a unique - # OverrideEnvironment, since if you didn't pass any kw args - # into your builder call, you just reuse the env you were - # called with. That could mean that we see the same - # environment here multiple times. But that is really OK, - # since the operation we are performing would be performed on - # all of them anyway. The flag serves as a way to disable the - # auto-injection for the handful of libraries where we must do - # so to avoid forming a cycle. - if not env.get('DISABLE_ALLOCATOR_SHIM_INJECTION', False): - lds = env.get('LIBDEPS', []) - shim_allocator = '$BUILD_DIR/third_party/shim_allocator' - if shim_allocator not in lds: - insort_wrapper(lds, shim_allocator) - env['LIBDEPS'] = lds - - return target, source - - -if get_option("build-tools") == "stable": - for builder_name in ('Program', 'SharedLibrary', 'LoadableModule', 'StaticLibrary'): - builder = env['BUILDERS'][builder_name] - base_emitter = builder.emitter - builder.emitter = SCons.Builder.ListEmitter([add_shim_allocator_hack, base_emitter]) - - -def shim_library(env, name, needs_link=False, *args, **kwargs): - nodes = env.Library( - target=f"shim_{name}" if name else name, - source=[ - f"shim_{name}.cpp" if name else name, - ], - *args, - **kwargs - ) - - for n in nodes: - setattr(n.attributes, "needs_link", needs_link) - - return nodes - -env.AddMethod(shim_library, 'ShimLibrary') - - if not use_system_version_of_library('tcmalloc'): # GPerftools does this slightly differently than the others. thirdPartyEnvironmentModifications['gperftools'] = {} @@ -287,11 +230,11 @@ s2Env.SConscript('s2/SConscript', exports={'env' : s2Env}) if use_libunwind: unwindEnv = env.Clone( - LIBDEPS_GLOBAL=[ - dep - for dep in env.get('LIBDEPS_GLOBAL', []) - if not dep.endswith('shim_allocator') - ] + LIBDEPS_NO_INHERIT=[ + '$BUILD_DIR/shim_crt', + '$BUILD_DIR/shim_cxx', + '$BUILD_DIR/third_party/shim_allocator', + ], ) if use_system_libunwind: unwindEnv = unwindEnv.Clone( @@ -319,11 +262,6 @@ if use_libunwind: unwindEnv.ShimLibrary( name="unwind", - # We don't want the shim_allocator hack to apply to this library, since - # otherwise we would create a loop, since tcmalloc might use us. That should - # be OK, unless libunwind had static initializers that invoked malloc. - # TODO: Remove when SERVER-48291 is merged into stable build tools - DISABLE_ALLOCATOR_SHIM_INJECTION=True, ) fmtEnv = env.Clone() @@ -447,7 +385,9 @@ else: 'zlib' + zlibSuffix + '/zlib', ]) -zlibEnv.ShimLibrary(name="zlib") +zlibEnv.ShimLibrary( + name="zlib", +) zstdEnv = env.Clone() if use_system_version_of_library("zstd"): @@ -464,7 +404,9 @@ else: 'zstandard' + zstdSuffix + '/zstd', ]) -zstdEnv.ShimLibrary(name="zstd") +zstdEnv.ShimLibrary( + name="zstd", +) benchmarkEnv = env.Clone() if use_system_version_of_library("google-benchmark"): @@ -504,14 +446,16 @@ if "tom" in env["MONGO_CRYPTO"]: 'tomcrypt' + tomcryptSuffix + '/tomcrypt', ]) - tomcryptEnv.ShimLibrary(name="tomcrypt") + tomcryptEnv.ShimLibrary( + name="tomcrypt", + ) gperftoolsEnv = env.Clone( - LIBDEPS_GLOBAL=[ - dep - for dep in env.get('LIBDEPS_GLOBAL', []) - if not dep.endswith('shim_allocator') + LIBDEPS_NO_INHERIT=[ + '$BUILD_DIR/shim_crt', + '$BUILD_DIR/shim_cxx', + '$BUILD_DIR/third_party/shim_allocator', ], ) if gperftoolsEnv['MONGO_ALLOCATOR'] in ["tcmalloc", "tcmalloc-experimental"]: @@ -539,19 +483,17 @@ if gperftoolsEnv['MONGO_ALLOCATOR'] in ["tcmalloc", "tcmalloc-experimental"]: gperftoolsEnv.ShimLibrary( name="allocator", - # TODO: Remove when SERVER-48291 is merged into stable build tools - DISABLE_ALLOCATOR_SHIM_INJECTION=True, LIBDEPS_TAGS=[ - # TODO: Remove all of these when SERVER-48291 is merged into stable build tools - # The shim allocator must be linked to every node, including what would - # be considered a leaf node to ensure the system allocator - # is not linked in before tcmalloc. This tag allows nodes tagged as - # leaf nodes to still get the correct allocator. + # TODO: Remove when SERVER-48291 is merged into stable build tools. + # An inserted dependency must be linked to every node, including what would + # be considered a leaf node to ensure that a system dependency is not linked + # in before this one. This tag allows nodes tagged as leaf nodes to still + # get the correct allocator. 'lint-leaf-node-allowed-dep', - # This tag allows the allocator to be linked to nodes marked as not + # This tag allows this dependency to be linked to nodes marked as not # allowed to have public dependencies. 'lint-public-dep-allowed' - ], + ] ) @@ -598,7 +540,9 @@ timelibEnv = timelibEnv.Clone( 'timelib' + timelibSuffix + '/timelib', ]) -timelibEnv.ShimLibrary(name='timelib') +timelibEnv.ShimLibrary( + name='timelib', +) wiredtigerEnv = env.Clone() if wiredtiger: @@ -650,7 +594,9 @@ else: 'IntelRDFPMathLib20U1/intel_decimal128', ]) -intelDecimal128Env.ShimLibrary(name="intel_decimal128") +intelDecimal128Env.ShimLibrary( + name="intel_decimal128", +) icuEnv = env.Clone() if use_system_version_of_library("icu"): @@ -669,7 +615,9 @@ else: 'icu4c' + icuSuffix + '/source/icu_i18n', ]) -icuEnv.ShimLibrary(name="icu") +icuEnv.ShimLibrary( + name="icu", +) kmsEnv = env.Clone() if get_option('ssl') == 'on': @@ -687,5 +635,7 @@ if get_option('ssl') == 'on': 'kms-message/kms-message', ]) - kmsEnv.ShimLibrary(name="kms_message") + kmsEnv.ShimLibrary( + name="kms_message", + ) diff --git a/src/third_party/gperftools/SConscript b/src/third_party/gperftools/SConscript index 2025d7a9ea6..4cc7596feb4 100644 --- a/src/third_party/gperftools/SConscript +++ b/src/third_party/gperftools/SConscript @@ -123,13 +123,4 @@ env.Library( LIBDEPS_PRIVATE=[ '$BUILD_DIR/third_party/shim_unwind' if use_libunwind else [], ], - # We don't want the shim_allocator hack to apply to this library, since - # otherwise we would create a loop. - LIBDEPS_GLOBAL=[ - dep - for dep in env.get('LIBDEPS_GLOBAL', []) - if not dep.endswith('shim_allocator') - ], - # TODO: Remove when SERVER-48291 is merged into stable build tools - DISABLE_ALLOCATOR_SHIM_INJECTION=True, ) diff --git a/src/third_party/unwind/SConscript b/src/third_party/unwind/SConscript index 983478dd22a..adbd0114832 100644 --- a/src/third_party/unwind/SConscript +++ b/src/third_party/unwind/SConscript @@ -125,14 +125,4 @@ env.Append( env.Library( target='unwind', source=env.File(unwind_sources, unwind_src_dir), - # We don't want the shim_allocator hack to apply to this library, since - # otherwise we would create a loop, since tcmalloc might use us. That should - # be OK, unless libunwind had static initializers that invoked malloc. - LIBDEPS_GLOBAL=[ - dep - for dep in env.get('LIBDEPS_GLOBAL', []) - if not dep.endswith('shim_allocator') - ], - # TODO: Remove when SERVER-48291 is merged into stable build tools - DISABLE_ALLOCATOR_SHIM_INJECTION=True, ) |