diff --git a/common.gypi b/common.gypi index c242572c8..3f2ec3cad 100644 --- a/common.gypi +++ b/common.gypi @@ -4386,6 +4386,14 @@ # '-Wl,--threads', # '-Wl,--thread-count=4', ], + 'conditions': [ + # TODO(thestig): Enable this for CrOS and Sanitizers. + [ 'chromeos==0 and asan==0 and lsan==0 and tsan==0 and msan==0 and ubsan==0 and ubsan_vptr==0', { + 'ldflags': [ + '-Wl,--detect-odr-violations', + ], + }], + ], }], ], 'conditions': [ diff --git a/config/compiler/BUILD.gn b/config/compiler/BUILD.gn index 164b97d26..48950664f 100644 --- a/config/compiler/BUILD.gn +++ b/config/compiler/BUILD.gn @@ -71,7 +71,7 @@ if (!is_win) { # # Base compiler configuration. # -# See also "runtime_library" below for related stuff and a discusison about +# See also "runtime_library" below for related stuff and a discussion about # where stuff should go. Put warning related stuff in the "warnings" config. config("compiler") { @@ -385,6 +385,13 @@ config("compiler") { #"-Wl,--threads", #"-Wl,--thread-count=4", ] + + # TODO(thestig): Make this flag work with GN. + #if (!is_chromeos && !(is_asan || is_lsan || is_tsan || is_msan)) { + # ldflags += [ + # "-Wl,--detect-odr-violations", + # ] + #} } if (linux_use_bundled_binutils) {