Skip to content

Commit

Permalink
SERVER-20974 Improve undefined behavior sanitizer integration
Browse files Browse the repository at this point in the history
  • Loading branch information
acmorrow committed Oct 19, 2015
1 parent 670a573 commit b0c0ab7
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 12 deletions.
26 changes: 15 additions & 11 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -1114,17 +1114,21 @@ if link_model.startswith("dynamic"):
env['LIBDEPS_TAG_EXPANSIONS'].append(libdeps_tags_expand_incomplete)
else:
env.AppendUnique(SHLINKFLAGS=["-Wl,--no-as-needed"])
if link_model == "dynamic-strict":
env.AppendUnique(SHLINKFLAGS=["-Wl,-z,defs"])
else:
# On BFD/gold linker environments, which are not strict by
# default, we need to add a flag when libraries are not
# tagged incomplete.
def libdeps_tags_expand_incomplete(source, target, env, for_signature):
if 'incomplete' not in target[0].get_env().get("LIBDEPS_TAGS", []):
return ["-Wl,-z,defs"]
return []
env['LIBDEPS_TAG_EXPANSIONS'].append(libdeps_tags_expand_incomplete)

# Using zdefs doesn't work at all with the sanitizers
if not has_option('sanitize'):

if link_model == "dynamic-strict":
env.AppendUnique(SHLINKFLAGS=["-Wl,-z,defs"])
else:
# On BFD/gold linker environments, which are not strict by
# default, we need to add a flag when libraries are not
# tagged incomplete.
def libdeps_tags_expand_incomplete(source, target, env, for_signature):
if 'incomplete' not in target[0].get_env().get("LIBDEPS_TAGS", []):
return ["-Wl,-z,defs"]
return []
env['LIBDEPS_TAG_EXPANSIONS'].append(libdeps_tags_expand_incomplete)

if optBuild:
env.SetConfigHeaderDefine("MONGO_CONFIG_OPTIMIZED_BUILD")
Expand Down
17 changes: 16 additions & 1 deletion etc/ubsan.blacklist
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
src:src/third_party/*
# Don't UBSAN most of third_party, but do ubsan WT
src:src/third_party/IntelRDFPMathLib20U1/*
src:src/third_party/asio-asio-1-11-0/*
src:src/third_party/boost-1.56.0/*
src:src/third_party/gperftools-2.2/*
src:src/third_party/libstemmer_c/*
src:src/third_party/mozjs-38/*
src:src/third_party/murmurhash3/*
src:src/third_party/pcre-8.36/*
src:src/third_party/pcre-8.37/*
src:src/third_party/s2/*
src:src/third_party/snappy-1.1.2/*
src:src/third_party/tz/*
src:src/third_party/unicode-8.0.0/*
src:src/third_party/yaml-cpp-0.5.1/*
src:src/third_party/zlib-1.2.8/*
1 change: 1 addition & 0 deletions src/mongo/s/catalog/legacy/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ env.Library(
'legacy_dist_lock_pinger.cpp',
],
LIBDEPS=[
'$BUILD_DIR/mongo/executor/network_interface',
'$BUILD_DIR/mongo/s/catalog/catalog_manager',
'$BUILD_DIR/mongo/s/catalog/dist_lock_manager',
],
Expand Down

0 comments on commit b0c0ab7

Please sign in to comment.