diff options
author | Andrew Morrow <acm@mongodb.com> | 2021-07-23 15:12:54 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-07-26 18:35:34 +0000 |
commit | 787d5a2aee7d69572345e0b33447a8b2c92ea982 (patch) | |
tree | 8abb3fa2a5dfe0ccc14e6bc7514b4f695f55cd53 /src | |
parent | 99408f871e41dc488d3148a2f0dda0fb3c476972 (diff) | |
download | mongo-787d5a2aee7d69572345e0b33447a8b2c92ea982.tar.gz |
SERVER-48291 Remove support for shim_cxx and shim_crt libraries
Diffstat (limited to 'src')
-rw-r--r-- | src/SConscript | 128 | ||||
-rw-r--r-- | src/mongo/platform/SConscript | 10 | ||||
-rw-r--r-- | src/third_party/SConscript | 4 |
3 files changed, 0 insertions, 142 deletions
diff --git a/src/SConscript b/src/SConscript index 28c848a675e..0c3a05f8d81 100644 --- a/src/SConscript +++ b/src/SConscript @@ -9,7 +9,6 @@ from site_scons.mongo import insort_wrapper import SCons -Import('dynamicRT') Import('env') Import('get_option') Import('has_option') @@ -52,34 +51,6 @@ def shim_hack(target, source, env, inject_target=None, exclusions=None): return target, source -def nodefaultlibs_hack(target, source, env): - if any('conftest' in str(t) for t in target): - return target, source - - runtime_shim_names = [ - 'shim_crt', - 'shim_cxx', - ] - runtime_shims = [f"$BUILD_DIR/{name}" for name in runtime_shim_names] - - # If we're building either the CRT or CXX shim, don't insert the - # nodefaultlibs argument because it makes static library insertion not work - # in clang and gcc. - if any(name in str(t) for name in runtime_shim_names for t in target): - return target, source - - libdeps_no_inherit = set(env.get('LIBDEPS_NO_INHERIT', [])) - - if not any(shim in libdeps_no_inherit for shim in runtime_shims): - linkflags = env.get('LINKFLAGS', []) - if '-nodefaultlibs' not in linkflags: - linkflags = ['-nodefaultlibs'] + linkflags - - env['LINKFLAGS'] = linkflags - - return target, source - - def hack_builder_emitters(env, hack_method): for builder_name in ('Program', 'SharedLibrary', 'LoadableModule', 'StaticLibrary'): builder = env['BUILDERS'][builder_name] @@ -87,115 +58,16 @@ def hack_builder_emitters(env, hack_method): builder.emitter = SCons.Builder.ListEmitter([hack_method, base_emitter]) -# Here, we "hoist" libgcc*.a symbols out of the toolchain and stuff them into -# our own library so they don't get added piecemeal to every shared object and -# executable in a build directly out of the toolchain. -libcrtEnv = env.Clone(LIBS=[]) -libcxxEnv = env.Clone(LIBS=[]) -if dynamicRT == "force": - - if env.ToolchainIs('gcc', 'clang'): - # Clang ang GCC get configured here because the dynamic runtimes are - # injected in ways that would not be fully applied to conftests. The - # only way to fix that means running part of the build before we can - # run conftests. It may be worth it to do that at some point, but it's - # complexity we should consider later if it's determined we need it. - - hack_builder_emitters(env, nodefaultlibs_hack) - - libcrtEnv.AppendUnique( - LINKFLAGS=[ - "-Wl,-z,muldefs", - "-static-libgcc", - "-Wl,--push-state", - "-Wl,-Bstatic", - "-Wl,--no-warn-execstack", - "-Wl,--whole-archive", - "-lgcc", - "-lgcc_eh", - "-Wl,--no-whole-archive", - "-Wl,--pop-state", - ], - SYSLIBDEPS=[ - ':libgcc_s.so', - ] - ) - - if has_option("libc++"): - cxx_lib = "c++" - else: - cxx_lib = "stdc++" - - libcxxEnv.AppendUnique( - LINKFLAGS=[ - "-Wl,-z,muldefs", - f"-static-lib{cxx_lib}", - "-Wl,--push-state", - "-Wl,-Bstatic", - "-Wl,--no-warn-execstack", - "-Wl,--whole-archive", - f"-l{cxx_lib}", - "-Wl,--no-whole-archive", - "-Wl,--pop-state", - ] - ) - -libcrtEnv.ShimLibrary( - name="crt", - needs_link=(dynamicRT == "force"), - LIBDEPS_TAGS=[ - # 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 this dependency to be linked to nodes marked as not - # allowed to have public dependencies. - 'lint-public-dep-allowed' - ] -) - -libcxxEnv.ShimLibrary( - name="cxx", - needs_link=(dynamicRT == "force"), - LIBDEPS_TAGS=[ - # 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 this dependency to be linked to nodes marked as not - # allowed to have public dependencies. - 'lint-public-dep-allowed' - ] -) - - if get_option("build-tools") == "next": # Add any "global" dependencies here. This is where we make every build node # depend on a list of other build nodes, such as an allocator or libunwind # or libstdx or similar. env.AppendUnique( LIBDEPS_GLOBAL=[ - '$BUILD_DIR/shim_crt' if dynamicRT == "force" else [], - '$BUILD_DIR/shim_cxx' if dynamicRT == "force" else [], '$BUILD_DIR/third_party/shim_allocator', ], ) else: - if dynamicRT == "force": - hack_builder_emitters( - env, - partial( - shim_hack, - inject_target='shim_crt')) - hack_builder_emitters( - env, - partial( - shim_hack, - inject_target='shim_cxx')) hack_builder_emitters( env, partial( diff --git a/src/mongo/platform/SConscript b/src/mongo/platform/SConscript index 193a62de65c..68ab49dad4c 100644 --- a/src/mongo/platform/SConscript +++ b/src/mongo/platform/SConscript @@ -43,8 +43,6 @@ env.Library( ], LIBDEPS_NO_INHERIT=[ '$BUILD_DIR/third_party/shim_allocator', - '$BUILD_DIR/shim_crt', - '$BUILD_DIR/shim_cxx', ], LIBDEPS=[], MONGO_API_NAME="visibility_test_libcommon", @@ -57,8 +55,6 @@ env.Library( ], LIBDEPS_NO_INHERIT=[ '$BUILD_DIR/third_party/shim_allocator', - '$BUILD_DIR/shim_crt', - '$BUILD_DIR/shim_cxx', ], LIBDEPS=[], LIBDEPS_PRIVATE=[ @@ -74,8 +70,6 @@ env.Library( ], LIBDEPS_NO_INHERIT=[ '$BUILD_DIR/third_party/shim_allocator', - '$BUILD_DIR/shim_crt', - '$BUILD_DIR/shim_cxx', ], LIBDEPS=[ "visibility_test_lib1", @@ -93,8 +87,6 @@ visibility_test1 = env.Program( ], LIBDEPS_NO_INHERIT=[ '$BUILD_DIR/third_party/shim_allocator', - '$BUILD_DIR/shim_crt', - '$BUILD_DIR/shim_cxx', ], LIBDEPS=[ "visibility_test_lib1", @@ -114,8 +106,6 @@ visibility_test2 = env.Program( ], LIBDEPS_NO_INHERIT=[ '$BUILD_DIR/third_party/shim_allocator', - '$BUILD_DIR/shim_crt', - '$BUILD_DIR/shim_cxx', ], LIBDEPS=[ "visibility_test_lib2", diff --git a/src/third_party/SConscript b/src/third_party/SConscript index 6ee43dbd14e..08b2c2cdc35 100644 --- a/src/third_party/SConscript +++ b/src/third_party/SConscript @@ -243,8 +243,6 @@ s2Env.SConscript('s2/SConscript', exports={'env' : s2Env}) if use_libunwind: unwindEnv = env.Clone( LIBDEPS_NO_INHERIT=[ - '$BUILD_DIR/shim_crt', - '$BUILD_DIR/shim_cxx', '$BUILD_DIR/third_party/shim_allocator', ], ) @@ -465,8 +463,6 @@ if "tom" in env["MONGO_CRYPTO"]: gperftoolsEnv = env.Clone( LIBDEPS_NO_INHERIT=[ - '$BUILD_DIR/shim_crt', - '$BUILD_DIR/shim_cxx', '$BUILD_DIR/third_party/shim_allocator', ], ) |