diff options
author | Andrew Morrow <acm@mongodb.com> | 2017-05-20 09:02:32 -0400 |
---|---|---|
committer | Andrew Morrow <acm@mongodb.com> | 2017-05-24 23:42:49 -0400 |
commit | 3e1461b80c42deda1f6b9478e2e574c6d88052f2 (patch) | |
tree | 5a5d1d5a465fadaa8caa61a261f6392d75762921 /SConstruct | |
parent | dab9d2681c07717eeb97ba5bf2875c1e39518782 (diff) | |
download | mongo-3e1461b80c42deda1f6b9478e2e574c6d88052f2.tar.gz |
SERVER-27380 Re-enable the thin archive tool
This refactors the thin_archive tool to use emitters and scanners
to note that when linking to a thin archive, you must also depend on
the children of that thin archive. Failing to do so is an error,
because a changed .o does not necessarily lead to a different .a,
which would subvert the SCons dependency mechanism.
This also includes a refactoring of the ABILINK tool to use a similar
mechanism, to achieve the opposite effect. For ABILINK, we want to
depend not on the actual .so, but on the hash of its abidw result. We
use emitters, actions, and scanners to produce an associated .abidw
file for each .so we build, and then update the scanner to depend on
the .abidw of our libraries, not the library itself. This allows us to
elide needless relinks.
Diffstat (limited to 'SConstruct')
-rw-r--r-- | SConstruct | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/SConstruct b/SConstruct index 6222566afe7..e4813b3de65 100644 --- a/SConstruct +++ b/SConstruct @@ -1189,13 +1189,6 @@ env['BUILDERS']['LibraryObject'] = env['BUILDERS']['StaticObject'] if link_model.startswith("dynamic"): - # Add in the abi linking tool if the user requested and it is - # supported on this platform. - if env.get('ABIDW'): - abilink = Tool('abilink') - if abilink.exists(env): - abilink(env) - # Redirect the 'Library' target, which we always use instead of 'StaticLibrary' for things # that can be built in either mode, to point to SharedLibrary. env['BUILDERS']['Library'] = env['BUILDERS']['SharedLibrary'] @@ -1359,6 +1352,20 @@ if env['_LIBDEPS'] == '$_LIBDEPS_OBJS': libdeps.setup_environment(env, emitting_shared=(link_model.startswith("dynamic"))) +# Both the abidw tool and the thin archive tool must be loaded after +# libdeps, so that the scanners they inject can see the library +# dependencies added by libdeps. +if link_model.startswith("dynamic"): + # Add in the abi linking tool if the user requested and it is + # supported on this platform. + if env.get('ABIDW'): + abilink = Tool('abilink') + if abilink.exists(env): + abilink(env) + +if env['_LIBDEPS'] == '$_LIBDEPS_LIBS': + env.Tool('thin_archive') + if env.TargetOSIs('linux', 'freebsd', 'openbsd'): env['LINK_LIBGROUP_START'] = '-Wl,--start-group' env['LINK_LIBGROUP_END'] = '-Wl,--end-group' |