summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Morrow <acm@mongodb.com>2017-05-20 11:11:53 -0400
committerAndrew Morrow <acm@mongodb.com>2017-05-24 23:41:24 -0400
commitdab9d2681c07717eeb97ba5bf2875c1e39518782 (patch)
tree24dc95258ee3087c4a3ba2bbdd5a7d37f7cf0ef8
parent173463532abfa79c980579a3b1605e5716e616cb (diff)
downloadmongo-dab9d2681c07717eeb97ba5bf2875c1e39518782.tar.gz
SERVER-29220 Default to archive based linking
-rw-r--r--SConstruct34
-rw-r--r--site_scons/site_tools/libtool.py17
-rw-r--r--src/mongo/db/db.cpp4
-rw-r--r--src/mongo/db/fts/SConscript1
-rw-r--r--src/mongo/db/fts/ftsmongod.cpp2
-rw-r--r--src/mongo/db/pipeline/SConscript1
-rw-r--r--src/mongo/db/pipeline/aggregation.cpp2
-rw-r--r--src/mongo/scripting/SConscript1
-rw-r--r--src/mongo/scripting/scripting_server.cpp2
9 files changed, 40 insertions, 24 deletions
diff --git a/SConstruct b/SConstruct
index f1bf7a4a3cd..6222566afe7 100644
--- a/SConstruct
+++ b/SConstruct
@@ -418,7 +418,7 @@ add_option('variables-files',
link_model_choices = ['auto', 'object', 'static', 'dynamic', 'dynamic-strict']
add_option('link-model',
choices=link_model_choices,
- default='object',
+ default='auto',
help='Select the linking model for the project',
type='choice'
)
@@ -527,7 +527,7 @@ def decide_platform_tools():
elif mongo_platform.is_running_os('linux', 'solaris'):
return ['gcc', 'g++', 'gnulink', 'ar', 'gas']
elif mongo_platform.is_running_os('darwin'):
- return ['gcc', 'g++', 'applelink', 'ar', 'as', 'xcode']
+ return ['gcc', 'g++', 'applelink', 'ar', 'libtool', 'as', 'xcode']
else:
return ["default"]
@@ -1168,23 +1168,15 @@ if has_option("cache"):
addNoCacheEmitter(env['BUILDERS']['SharedLibrary'])
addNoCacheEmitter(env['BUILDERS']['LoadableModule'])
-# Normalize the link model. If it is auto, then a release build uses 'object' mode. Otherwise
-# we automatically select the 'static' model on non-windows platforms, or 'object' if on
-# Windows. If the user specified, honor the request, unless it conflicts with the requirement
-# that release builds use the 'object' mode, in which case, error out.
-#
-# We require the use of the 'object' mode for release builds because it is the only linking
-# model that works across all of our platforms. We would like to ensure that all of our
-# released artifacts are built with the same known-good-everywhere model.
+# Normalize the link model. If it is auto, then for now both developer and release builds
+# use the "static" mode. Somday later, we probably want to make the developer build default
+# dynamic, but that will require the hygienic builds project.
link_model = get_option('link-model')
-
if link_model == "auto":
- link_model = "object" if (env.TargetOSIs('windows') or has_option("release")) else "static"
-elif has_option("release") and link_model != "object":
- env.FatalError("The link model for release builds is required to be 'object'")
+ link_model = "static"
-# The only link model currently supported on Windows is 'object', since there is no equivalent
-# to --whole-archive.
+# 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']:
env.FatalError("Windows builds must use the 'object' or 'static' link models");
@@ -1377,14 +1369,14 @@ elif env.TargetOSIs('darwin'):
env['LINK_LIBGROUP_START'] = ''
env['LINK_LIBGROUP_END'] = ''
# NOTE: The trailing space here is important. Do not remove it.
- env['LINK_WHOLE_ARCHIVE_LIB_START'] = '-force_load '
+ env['LINK_WHOLE_ARCHIVE_LIB_START'] = '-Wl,-force_load '
env['LINK_WHOLE_ARCHIVE_LIB_END'] = ''
elif env.TargetOSIs('solaris'):
- env['LINK_LIBGROUP_START'] = '-z rescan-start'
- env['LINK_LIBGROUP_END'] = '-z rescan-end'
+ env['LINK_LIBGROUP_START'] = '-Wl,-z,rescan-start'
+ env['LINK_LIBGROUP_END'] = '-Wl,-z,rescan-end'
# NOTE: The leading and trailing spaces here are important. Do not remove them.
- env['LINK_WHOLE_ARCHIVE_LIB_START'] = '-z allextract '
- env['LINK_WHOLE_ARCHIVE_LIB_END'] = ' -z defaultextract'
+ env['LINK_WHOLE_ARCHIVE_LIB_START'] = '-Wl,-z,allextract '
+ env['LINK_WHOLE_ARCHIVE_LIB_END'] = ' -Wl,-z,defaultextract'
elif env.TargetOSIs('windows'):
env['LINK_WHOLE_ARCHIVE_LIB_START'] = '/WHOLEARCHIVE:'
env['LINK_WHOLE_ARCHIVE_LIB_END'] = ''
diff --git a/site_scons/site_tools/libtool.py b/site_scons/site_tools/libtool.py
new file mode 100644
index 00000000000..84a646ed066
--- /dev/null
+++ b/site_scons/site_tools/libtool.py
@@ -0,0 +1,17 @@
+import SCons
+
+def generate(env):
+
+ env['AR'] = 'libtool'
+ env['ARCOM'] = '$AR -static -o $TARGET $ARFLAGS $SOURCES'
+ env['ARFLAGS'] = ["-s", "-no_warning_for_no_symbols"]
+
+ def noop_action(env, target, source):
+ pass
+
+ # Disable running ranlib, since we added 's' above
+ env['RANLIBCOM'] = noop_action
+ env['RANLIBCOMSTR'] = 'Skipping ranlib for libtool generated target $TARGET'
+
+def exists(env):
+ return env.detect('libtool')
diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp
index 1535751900c..52d09a884a6 100644
--- a/src/mongo/db/db.cpp
+++ b/src/mongo/db/db.cpp
@@ -174,8 +174,6 @@ ntservice::NtServiceDefaultStrings defaultServiceStrings = {
L"MongoDB", L"MongoDB", L"MongoDB Server"};
#endif
-Timer startupSrandTimer;
-
void logStartup(OperationContext* opCtx) {
BSONObjBuilder toLog;
stringstream id;
@@ -591,7 +589,7 @@ ExitCode _initAndListen(int listenPort) {
uassertStatusOK(getGlobalAuthorizationManager()->initialize(startupOpCtx.get()));
/* this is for security on certain platforms (nonce generation) */
- srand((unsigned)(curTimeMicros64() ^ startupSrandTimer.micros()));
+ srand((unsigned)(curTimeMicros64()) ^ (unsigned(uintptr_t(&startupOpCtx))));
AuthorizationManager* globalAuthzManager = getGlobalAuthorizationManager();
if (globalAuthzManager->shouldValidateAuthSchemaOnStartup()) {
diff --git a/src/mongo/db/fts/SConscript b/src/mongo/db/fts/SConscript
index a0e16484d17..6111a897f0c 100644
--- a/src/mongo/db/fts/SConscript
+++ b/src/mongo/db/fts/SConscript
@@ -75,6 +75,7 @@ env.Library(
)
env.Library('ftsmongod', [
+ 'ftsmongod.cpp',
], LIBDEPS=["base","$BUILD_DIR/mongo/base"])
env.CppUnitTest( "fts_basic_phrase_matcher_test", "fts_basic_phrase_matcher_test.cpp",
diff --git a/src/mongo/db/fts/ftsmongod.cpp b/src/mongo/db/fts/ftsmongod.cpp
new file mode 100644
index 00000000000..c2b5648d56f
--- /dev/null
+++ b/src/mongo/db/fts/ftsmongod.cpp
@@ -0,0 +1,2 @@
+// This file intentionally blank. ftsmongod.cpp exists to anchor construction of the ftsmongod
+// library, which would otherwise have no object files.
diff --git a/src/mongo/db/pipeline/SConscript b/src/mongo/db/pipeline/SConscript
index 642fd8fa72d..b9d2ee31c33 100644
--- a/src/mongo/db/pipeline/SConscript
+++ b/src/mongo/db/pipeline/SConscript
@@ -7,6 +7,7 @@ env = env.Clone()
env.Library(
target='aggregation',
source=[
+ 'aggregation.cpp',
],
LIBDEPS=[
'aggregation_request',
diff --git a/src/mongo/db/pipeline/aggregation.cpp b/src/mongo/db/pipeline/aggregation.cpp
new file mode 100644
index 00000000000..ce0b6366130
--- /dev/null
+++ b/src/mongo/db/pipeline/aggregation.cpp
@@ -0,0 +1,2 @@
+// This file intentionally blank. aggregation.cpp exists to anchor construction of the aggregation
+// library, which would otherwise have no object files.
diff --git a/src/mongo/scripting/SConscript b/src/mongo/scripting/SConscript
index 20d222ffbc5..42972531d6f 100644
--- a/src/mongo/scripting/SConscript
+++ b/src/mongo/scripting/SConscript
@@ -165,6 +165,7 @@ else:
env.Library(
target='scripting_server',
source=[
+ 'scripting_server.cpp',
],
LIBDEPS=[
'scripting' if serverJs else 'scripting_none',
diff --git a/src/mongo/scripting/scripting_server.cpp b/src/mongo/scripting/scripting_server.cpp
new file mode 100644
index 00000000000..7ac0dd92502
--- /dev/null
+++ b/src/mongo/scripting/scripting_server.cpp
@@ -0,0 +1,2 @@
+// This file intentionally blank. scripting_server.cpp exists to anchor construction of the
+// scripting_server library, which would otherwise have no object files.