Index: build/config/compiler/BUILD.gn |
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn |
index cc2b7f55922bdd465896eeae06da6ff773e17423..164b97d26260f3e238834c36ffad1e9e53037f5c 100644 |
--- a/build/config/compiler/BUILD.gn |
+++ b/build/config/compiler/BUILD.gn |
@@ -350,10 +350,7 @@ config("compiler") { |
"-Wl,-z,now", |
"-Wl,-z,relro", |
] |
- |
- # TODO(zork): The mipsel build is broken in ffmpeg, guard this flag for now |
- # to hide the breakage. https://crbug.com/450771 |
- if (!using_sanitizer && cpu_arch != "mipsel") { |
+ if (!using_sanitizer) { |
ldflags += [ "-Wl,-z,defs" ] |
} |
} |
@@ -903,7 +900,17 @@ if (is_win) { |
"/Oy-", # disable omitting frame pointers, must be after /o2. |
"/Os", # favor size over speed. |
] |
- common_optimize_on_ldflags = [] |
+ if (!is_asan) { |
+ common_optimize_on_cflags += [ |
+ # Put data in separate COMDATs. This allows the linker |
+ # to put bit-identical constants at the same address even if |
+ # they're unrelated constants, which saves binary size. |
+ # This optimization can't be used when ASan is enabled because |
+ # it is not compatible with the ASan ODR checker. |
+ "/Gw", |
+ ] |
+ } |
+ common_optimize_on_ldflags = [ "/OPT:REF" ] |
} else { |
common_optimize_on_cflags = [ |
# Don't emit the GCC version ident directives, they just end up in the |
@@ -938,9 +945,15 @@ if (is_win) { |
# Specifically tell the linker to perform optimizations. |
# See http://lwn.net/Articles/192624/ . |
"-Wl,-O1", |
- "-Wl,--as-needed", |
"-Wl,--gc-sections", |
] |
+ |
+ if (!using_sanitizer) { |
+ # Functions interposed by the sanitizers can make ld think |
+ # that some libraries aren't needed when they actually are, |
+ # http://crbug.com/234010. As workaround, disable --as-needed. |
+ common_optimize_on_ldflags += [ "-Wl,--as-needed" ] |
+ } |
} |
} |